Cysharp / MemoryPack

Zero encoding extreme performance binary serializer for C# and Unity.
MIT License
3.29k stars 193 forks source link

Native AOT fully compatibility #251

Closed hadashiA closed 6 days ago

hadashiA commented 7 months ago

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:

To fix this, it may be necessary to change to a mechanism that does not use reflection.

github-actions[bot] commented 1 month ago

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 30 days.