Page 1 of 1

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

Posted: Sat Mar 16, 2024 7:17 pm
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.

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

Posted: Mon Mar 18, 2024 9:20 am
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.

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

Posted: Mon Mar 18, 2024 1:37 pm
by Admin
Fixed in the 2025 build.