Skip to content

Runtime Error (IL2CPP) with MessagePackHubProtocol after MessagePack 3.x Upgrade - Contradicts AOT Documentation #62758

@cubed-it

Description

@cubed-it

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Hello,

I'm experiencing a persistent runtime error when using Microsoft.AspNetCore.SignalR.Protocols.MessagePack in a Unity project compiled with IL2CPP, specifically after upgrading the MessagePack library from version 2.6.100-alpha to 3.0.3 or newer.

While the official documentation (https://learn.microsoft.com/en-us/aspnet/core/signalr/messagepackhubprotocol?view=aspnetcore-9.0#messagepack-support-in-ahead-of-time-compilation-environment) outlines support for MessagePack in AOT environments like Unity (with pre-generated serializers, which I have implemented), the combination of SignalR's MessagePack protocol with the newer MessagePack library versions is failing during IL2CPP runtime.

The error message observed is:
MessagePackWriter/Reader overload is not supported in MessagePackSerializer.NonGenerics

This behavior indicates a conflict in type and method resolution within the IL2CPP compilation process that doesn't occur under Mono's JIT compilation. This issue is reproducible across various Unity versions and platforms (Windows, Android).

I've created a detailed issue with a minimal reproducible example in my repository for further investigation, which provides more context and specific observations:
MessagePack-CSharp/MessagePack-CSharp#2148

Could this be related to internal changes in MessagePack 3.x, or an interaction issue with how SignalR.Protocols.MessagePack integrates a subset of MessagePack's source code, especially when IL2CPP attempts to reconcile this with an externally referenced newer MessagePack library?

Thank you for your time and assistance.

Expected Behavior

No response

Steps To Reproduce

No response

Exceptions (if any)

No response

.NET Version

No response

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions