Attributes and utilities for testing AOT compilation and IL trimming behavior in .NET applications.
$ dotnet add package ANcpLua.Roslyn.Utilities.Testing.AotAttributes and utilities for testing AOT compilation and IL trimming behavior in .NET applications.
using ANcpLua.Roslyn.Utilities.Testing.Aot;
public class MyAotTests
{
// AOT test - returns 0 for success
[AotTest]
public static int BasicAotTest()
{
// Test code runs in AOT-compiled binary
return 0; // Success
}
// Trim test with full trimming
[TrimTest(TrimMode = TrimMode.Full)]
public static int TrimTest()
{
TrimAssert.TypePreserved("System.String", "System.Private.CoreLib");
return 0;
}
// AOT test with disabled feature switches
[AotTest(DisabledFeatureSwitches = [FeatureSwitches.JsonReflection])]
public static int AotWithoutJsonReflection()
{
// JSON source generation only
return 0;
}
}
MIT