version 2023: System.Reflection.TargetException: Non-static method requires a target

Issues related to VMProtect
Post Reply
weloveayaka
Posts: 58
Joined: Wed Jul 05, 2023 6:21 am

version 2023: System.Reflection.TargetException: Non-static method requires a target

Post by weloveayaka »

Hello Admin, I found a new problem in 2023.
I apologize for asking so many questions.
I will use reply instead of opening a new topic next time

Code: Select all


static void Main(string[] args)
{
    Console.WriteLine("start");
    TestNullable2();
    Console.WriteLine("Finished");
    Console.ReadLine();
}


[Obfuscation(Exclude = false, Feature = "ultra")]
public static int? TestNullable(int? value)
{
    return value;
}

[Obfuscation(Exclude = false, Feature = "ultra")]
static void TestNullable2()
{
    int? nullableResult = TestNullable(null);   <---------  System.Reflection.TargetException: Non-static method requires a target  (I'm not sure which line)
    System.Console.WriteLine("TestNullable Result: " + nullableResult);   
    if (nullableResult != null)
    {
        System.Console.WriteLine("TestNullable failed!");
    }
}
P.S. Stack trace deocder only get "Main", and not shows TestNullable/TestNullable2 in stacktrace.
Admin
Site Admin
Posts: 2586
Joined: Mon Aug 21, 2006 8:19 pm
Location: Russia, E-burg
Contact:

Re: version 2023: System.Reflection.TargetException: Non-static method requires a target

Post by Admin »

P.S. Stack trace deocder only get "Main", and not shows TestNullable/TestNullable2 in stacktrace.
The stacktrace will not contain "TestNullable2" because virtualized TestNullable2 is always "hidden" when it was called from other virtuialized method.
Admin
Site Admin
Posts: 2586
Joined: Mon Aug 21, 2006 8:19 pm
Location: Russia, E-burg
Contact:

Re: version 2023: System.Reflection.TargetException: Non-static method requires a target

Post by Admin »

Fixed in the 2025 build.
Post Reply