- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 268
Closed
Description
First, thanks for updating MemoryPack to work with .NET 7 and AOT.
Unfortunately my native AOT test program (latest .NET 7) is crashing with the error below:

(it works OK in debug and release mode in Visual Studio, but crashes only after publishing and running the AOT executable)
Here is the full test code:
using MemoryPack;
namespace Tests
{
    [MemoryPackable]
    public partial class MemPackObject
    {
        public string TestString { get; set; }
    }
    class MemPackTest
    {
        static void Main(string[] args)
        {
            MemPackObject test_object = new MemPackObject();
            test_object.TestString = "ABC";
            Console.WriteLine("Initial value before serializing: " + test_object.TestString);
            byte[] serialized_object = MemoryPackSerializer.Serialize(test_object);
            MemPackObject? deserialized_object = MemoryPackSerializer.Deserialize<MemPackObject>(serialized_object);
            if (deserialized_object != null)
            {
                Console.WriteLine("Final value after deserializing: " + deserialized_object.TestString);
            }
            Console.WriteLine("Test completed. Press any key to exit");
            Console.ReadKey();
        }
    }
}
MitchRazga
Metadata
Metadata
Assignees
Labels
No labels