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

Objects with private properties can't share property names #9

Open
xbrady opened this issue Feb 26, 2019 · 0 comments
Open

Objects with private properties can't share property names #9

xbrady opened this issue Feb 26, 2019 · 0 comments

Comments

@xbrady
Copy link

xbrady commented Feb 26, 2019

This is kind of difficult to explain, but here is the code to reproduce:

public class TestMain
    {
        public string TestProperty
        {
            get
            {
                return "Test";
            }
        }
        private TestDetail TestDetails { get; set; } = new TestDetail();

    }
    public class TestDetail
    {
        public string TestProperty { get; set; } = "TestDetail";
        
    }

Called with the following:

TestMain tr = new TestMain();

SharpSerializer serializer = new SharpSerializer();
serializer.Serialize(tr, "test.bin");

SharpSerializer serializer2 = new SharpSerializer();
serializer2.Deserialize("test.bin");

This will throw the following exception when deserializing:
ArgumentException: Property set method not found.

If you rename the TestProperty on the TestMain class, or the TestDetail class then it will deserialize without issues.

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

1 participant