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

YamlIgnore is no longer respected during deserialization #959

Closed
julian-burger-ttd opened this issue Aug 25, 2024 · 1 comment
Closed

YamlIgnore is no longer respected during deserialization #959

julian-burger-ttd opened this issue Aug 25, 2024 · 1 comment

Comments

@julian-burger-ttd
Copy link
Contributor

Describe the bug
We are upgrading from 11.2.1 to 16.0.0. Aside from a handful of function signature breaking changes which were easy to deal with, we have found a functionality break. We have a base class with a [Yamlgnore] property. The derived class declares a new property of the same name. Previously this worked as expected. With 16.0.0 it fails with an AmbiguousMatchException. I didn't spend any time isolating exactly when it changed but it seems related to the refactoring to use Type.GetRuntimeProperty .

To Reproduce

    public class IgnoreTest
    {
        public class Base
        {
            [YamlIgnore]
            public object Prop { get; set; }
        }

        public class Derived<T> : Base
        {
            public new T Prop { get; set; }
        }

        [Fact]
        public void Test()
        {
            var yaml = @"
prop: Jack
";
            var sut = new DeserializerBuilder()
                .WithNamingConvention(CamelCaseNamingConvention.Instance)
                .Build();

            sut.Deserialize<Derived<string>>(yaml);
        }
    }

Perhaps there is some configuration bit we don't know about to make this work?

@EdwardCooke
Copy link
Collaborator

This will go out in the next release

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