Skip to content

ArgumentOutOfRangeException when accessing private Enum #10

@GoogleCodeExporter

Description

@GoogleCodeExporter
What steps will reproduce the problem?
1.
This enum:
----------
public enum EnumA
{
    One,
    Two,
    Three
}

This class:
-----------
public class ClassD
{
    private EnumA _foo;

    public void SetFoo(EnumA foo)
    {
        _foo = foo;
    }

    public EnumA GetFoo()
    {
        return _foo;
    }
}

This test:
----------
[Test]
public void Cant_deserialize_enum()
{
    var value = new ClassD();
    value.SetFoo(EnumA.One);
    var accessor = TypeAccessor.Create(typeof(ClassD));
    var accessed = accessor[value, "_foo"];
    var foo = (EnumA)accessed;
}

What is the expected output? What do you see instead?
It should deserialize--flipping _foo to a public field shows correct behavior, 
private results in ArgumentOutOfRangeException 


What version of the product are you using? On what operating system?


Please provide any additional information below.


Original issue reported on code.google.com by daniel.crenna on 6 Apr 2014 at 4:40

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions