GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [v3] Issue with AOT Platforms - DynamicAssembly · Issue #1906 · MessagePack-CSharp/MessagePack-CSharp

[v3] Issue with AOT Platforms - DynamicAssembly #1906

New issue
Copy link
New issue
Copy link
Closed as not planned
Closed as not planned
[v3] Issue with AOT Platforms - DynamicAssembly#1906
Copy link
Labels
unity
Milestone
v3.0

Description

@evorowy-jk
evorowy-jk
opened on Jul 29, 2024
Issue body actions

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)

Activity

  1. evorowy-jk commented on Jul 29, 2024

    @evorowy-jk
    evorowy-jk
    on Jul 29, 2024
    Author
    More actions

    Is there any workaround that I can use to safely use message pack on AOT?

    For the following class if I omit DynamicObjectResolver.Instance

    [MessagePackObject(true)]
        public class PlayerData : IPlayerData
        {
            public SemVersion Version { get; set; } = new();
            public int A;
            public List<A> Items { get; set; } = new();
        }
    

    It is unable to find Formatter for List (A has MessagePackObjectAttribute too).

    Is there some other way that I should take when working with MessagePack?

  2. neuecc commented on Jul 30, 2024

    @neuecc
    neuecc
    on Jul 30, 2024
    Member
    More actions

    The code generated by the Source Generator is applied first, so it should not normally reach the DynamicObjectResolver.
    Can you check the code generated by the Source Generator?

  3. AArnott
    added this to the v3.0 milestone on Jul 30, 2024
  4. AArnott
    added
    unity
    on Jul 30, 2024
  5. AArnott commented on Sep 25, 2024

    @AArnott
    AArnott
    on Sep 25, 2024
    Collaborator
    More actions

    Closing due to non-response from OP. Also, we've made several fixes in this area lately. Ideally the OP can test on the latest from our develop branch.

  6. AArnott
    closed this as not plannedon Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    unity

    Type

    No type

    Projects

    No projects

      Milestone

      • v3.0

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.