Building with Native AOT actually works for the most part.
However, it seems that warnings occur because the compiler does not guarantee the operation.
/Users/s24061/dev/MemoryPack/src/MemoryPack.Core/bin/Release/net8.0/MemoryPack.Core.dll : warning IL2104: Assembly 'MemoryPack.Core' produced trim warnings. For more information see https://aka.ms/dotnet-illink/libraries [/Users/s24061/dev/MemoryPack/sandbox/SandboxConsoleApp/SandboxConsoleApp.csproj]
/Users/s24061/dev/MemoryPack/src/MemoryPack.Core/bin/Release/net8.0/MemoryPack.Core.dll : warning IL3053: Assembly 'MemoryPack.Core' produced AOT analysis warnings. [/Users/s24061/dev/MemoryPack/sandbox/SandboxConsoleApp/SandboxConsoleApp.csproj]
If we add <IsAotCompatible>true</IsAotCompatible> to MemoryPack.Core.csproj, will see many warnings of the following types:
IL2072
IL2090
IL2091
IL3050
To fix this, it may be necessary to change to a mechanism that does not use reflection.
Building with Native AOT actually works for the most part. However, it seems that warnings occur because the compiler does not guarantee the operation.
If we add
<IsAotCompatible>true</IsAotCompatible>
to MemoryPack.Core.csproj, will see many warnings of the following types:To fix this, it may be necessary to change to a mechanism that does not use reflection.