Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AssemblyVersion always included / verified with boxed List<T> #1190

Closed
lsallows opened this issue Feb 23, 2021 · 2 comments · Fixed by #1203
Closed

AssemblyVersion always included / verified with boxed List<T> #1190

lsallows opened this issue Feb 23, 2021 · 2 comments · Fixed by #1203
Assignees
Labels
Milestone

Comments

@lsallows
Copy link

Bug description
I am using the TypelessContractlessStandardResolver along with the options to omit the assembly version and allow assembly version mismatch. If the payload is just an object of type T then everything works as expected. If the payload is a List then the assembly version for type T is included and the deserialization fails if there is an assembly mismatch.

Repro steps

    [MessagePackObject]
    public class Message
    {
        [Key(0)]
        public string MessageName { get; set; }

        [Key(1)]
        public object Payload { get; set; }
    }

    [MessagePackObject]
    public class TestClass
    {
        [Key(0)]
        public int Prop1 { get; set; }
    }
    var msg = new Message()
    {
        MessageName = "MyMessage"
    };
               
    var testClass = new TestClass() { Prop1 = 1 };
    var payloadList = new List<TestClass>() { testClass };
    msg.Payload = payloadList;
    var opts = TypelessContractlessStandardResolver.Options
        .WithOmitAssemblyVersion(true)
        .WithAllowAssemblyVersionMismatch(true);
    
    // Includes Assembly Info - Not expected
    var bytes = MessagePack.MessagePackSerializer.Serialize(msg, opts);

    // Excludes Assembly info - Expected
    msg.Payload = testClass;
    bytes = MessagePack.MessagePackSerializer.Serialize(msg, opts);

Additional context

MessagePack 2.2.85
.NET Core 3.1

I am using MessagePack as the serializer for Service Fabric Remoting. Under this use case, the assembly versions will not always match between the client and the server.

@AArnott AArnott added the bug label Mar 6, 2021
@AArnott AArnott self-assigned this Mar 6, 2021
@AArnott
Copy link
Collaborator

AArnott commented Mar 6, 2021

I can't even find that the library uses AllowAssemblyVersionMismatch anywhere. That would be a regression, so I'm taking a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants