Replies: 1 comment
-
That's by design, you'll have to change your code accordingly. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
With AutoMapper v11.0.1, there are some cases where source types will fail to map to destination types if destination types contain a constructor with optional parameters.
This behaviour has been narrowed down to a change produced as part of this commit, specifically the change to the
TypeMap.ConstructorParameterMatches
method.Prior to this commit, this method would exclude constructor parameters that were optional (i.e. had default values) but now it includes them. This in turn changes the assignment function that gets created in
TypeMapPlanBuilder.CreateAssignmentFunc
so that it won't necessarily call any custom map function that is defined for the property.Further details and a full investigation history can be seen on this StackOverflow post.
Source/destination types
Source types:
Destination types:
Mapping configuration
Version: 11.0.1
Expected behavior
Assume the following write model:
And the following map:
In v10, all properties would have mapped successfully to the destination types and
count
would be 3.Actual behavior
In v11, the
ChildGroup
property is not mapped.Steps to reproduce
Beta Was this translation helpful? Give feedback.
All reactions