Details
-
Bug
-
Resolution: Fixed
-
Major - P3
-
2.7.0
-
None
-
Fully Compatible
Description
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.