Closed xiaoyuvax closed 8 months ago
Hello. Currently, MemoryPack uses reflection in part to resolve Formatter. Therefore, it is not able to fully pass the AOT check by the compiler.
However, Try the version after #237 is merged. For example, the following code you are concerned about worked with NativeAOT on my end.
var dict = new Dictionary<string, MyType>
{
{ "a", new MyType { X = 100 } }
};
var bin = MemoryPackSerializer.Serialize(dict);
var d = MemoryPackSerializer.Deserialize<IDictionary<string, MyType>>(bin)!;
System.Console.WriteLine(d["a"].X);
[MemoryPackable]
partial class MyType
{
public int X { get; set; }
}
If you have specific problematic code, please let us know, and I welcome a reopen.
when publish with NATIVEAOT, following warnings thrown, does it matter?
during runtime (seems built-in types were trimmed):
Can MemoryPack be sured to be nativeaot compaitible?