[v3] Issue with AOT Platforms - DynamicAssembly · Issue #1906 · MessagePack-CSharp/MessagePack-CSharp · GitHub
Skip to content

[v3] Issue with AOT Platforms - DynamicAssembly #1906

Description

@evorowy-jk

Unfortunately on Unity 6, (nuget MessagePack 3.0.129-beta) with following MessagePack initialization code:

StaticCompositeResolver.Instance.Register(new[]
{
    MasterMemoryResolver.Instance, 
    UlidMessagePackResolver.Instance,
                    
    StandardResolver.Instance
});

During Runtime on Android (IL2CPP build) there is an error with DynamicAssembly:

Error Unity PlatformNotSupportedException: Operation is not supported on this platform.
Error Unity   at System.Reflection.Emit.AssemblyBuilder.DefineDynamicAssembly (System.Reflection.AssemblyName name, System.Reflection.Emit.AssemblyBuilderAccess access) [0x00000] in <00000000000000000000000000000000>:0 
Error Unity   at MessagePack.Internal.DynamicAssembly..ctor (System.String moduleName) [0x00000] in <00000000000000000000000000000000>:0 
Error Unity   at MessagePack.Resolvers.DynamicObjectResolver+<>c.<.cctor>b__4_0 () [0x00000] in <00000000000000000000000000000000>:0 
Error Unity   at ListWithEvents`1[T]..ctor () [0x00000] in ./Library/PackageCache/com.unity.addressables/Runtime/ResourceManager/Util/ListWithEvents.cs:8 
Error Unity   at System.Lazy`1[T].ExecutionAndPublication (System.LazyHelper executionAndPublication, System.Boolean useDefaultConstructor) [0x00000] in <00000000000000000000000000000000>:0 

It is somewhat connected with the defines - previously defining MESSAGEPACK_FORCE_AOT didn't result in any change - it was still trying to use DynamicAssembly on platforms that doesn't support it.

Source: #1888 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions