Skip to content

.NET 7 Native AOT error: Generic virtual method pointer lookup failure #75

@littlehoneybunnytuttifruttipumpkinpie

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:
image

(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();
        }

    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions