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

'MessagePack.IgnoreMemberAttribute' is not Inherited(after overriding property) in 2.5.140. #1717

Open
Halfason opened this issue Dec 15, 2023 · 2 comments

Comments

@Halfason
Copy link

Halfason commented Dec 15, 2023

Bug description

'MessagePack.IngoreMemberAttribute' is not Inherited(after overriding property) in 2.5.140.
But it is Inherited(after overriding property) in1.9.11.

Repro steps

class Program
{
    static void Main(string[] args)
    {
        Class2 class2 = new Class2();
        //in 1.9.11 success.
        //in 2.5.140 MessagePackDynamicObjectResolverException is thrown:
        //all public members must mark KeyAttribute or IgnoreMemberAttribute.
        //type:MessagePack2._5.Class2 member:Value
        byte[] buffer = MessagePack.MessagePackSerializer.Serialize(class2);
        class2 = MessagePack.MessagePackSerializer.Deserialize<Class2>(buffer);
    }
}

[MessagePack.MessagePackObject]
public abstract class Class1
{
    [MessagePack.IgnoreMember]
    public virtual int Value { get; set; }
}

//For the convenience of display, other members that need to be serialized are hidden, 
//which is definitely not the case in reality
[MessagePack.MessagePackObject]
public class Class2 : Class1
{
    public override int Value { get; set; }
}

Expected behavior

'MessagePack.IngoreMemberAttribute' is Inherited(after overriding property).
Because the following:
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = true)]

Actual behavior

As Bug description.

  • Version used: 1.9.11, 2.5.140
  • Runtime: .netframework 4.7.2, win10, x64, nuget package

Additional context

Migrating from MessagePack v1.x to MessagePack v2.x.

@Halfason
Copy link
Author

DEMO.zip
The Repro steps files.

@AArnott AArnott changed the title 'MessagePack.IngoreMemberAttribute' is not Inherited(after overriding property) in 2.5.140. 'MessagePack.IgnoreMemberAttribute' is not Inherited(after overriding property) in 2.5.140. Dec 30, 2023
@AArnott
Copy link
Collaborator

AArnott commented Dec 30, 2023

Sponsorship may be an effective way to lead a contributor of this repo to prioritize addressing this issue. As a free and open source library, all or the majority of its development is done without any monetary benefit to its authors, and all of it is made available free of charge. But sponsorship is very much appreciated and, with agreement from a particular contributor and/or the owning team, can be a great way to support the project and help get your favorite features or bugs addressed in an upcoming version.
If sponsorship to drive completion of a feature or bug fix is an interesting option to you, please let us know. You can reach out to me privately on keybase.io or gitter.im as well.

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

No branches or pull requests

2 participants