-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: 2.7.0
-
Component/s: Serialization
-
None
-
Fully Compatible
Consider the following immutable class:
public class C { public C(int x) { X = x; } public static C Default { get; } = new C(0); public int X { get; } }
The ImmutableTypeClassMapConvention refuses to map such a class, because when obtaining the properties of a type, it calls the GetProperties method with no parameters. According to the MSDN documentation, both instance and static properties of a type are returned in this case.
The suggested fix is to consider instance properties only by setting the correct BindingFlags.