You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Environment (please complete the following information):
Mapperly Version: 3.4.0
.NET Version: .NET 8.0.201
Target Framework: net8.0
Compiler version: 4.9.0-3.24121.1 (a98c90d5)
C# Language Version: 12.0
IDE: Visual Studio v17.9.2
OS: Windows 11 Pro 23H2 22631.3155
Additional context
This issue was reported to me from a offshore developer and coworker. Here is the relevant information provided to me by him:
This problem only occurs when the Mapper is defined as it is now. If I delete one method, for example, delete ToInt, or adjust the order of methods, for example, move public partial TargetC ToTargetFrom(SourceC source); to the end of the class file, the generated code is correct, only one MapToTargetC method is generated. This is obviously not normal.
So I think this should be a bug in Mapperly.
The text was updated successfully, but these errors were encountered:
On a first glance this looks like Mapperly may not resolve the user-defined mappings correctly when reference handling is enabled: TargetC ToTargetFrom(SourceC) is not resolved when generating the mapping from SourceB.CList to TargetB.CList. This leads to a new mapping named MapToTargetC which even includes the mapping of the name (since the C mapping was not resolved, the user configuration on the mapping method was not resolved either).
I'll look into it as soon as I find the time.
As a workaround it may work if you disable reference handling or add a [ReferenceHandler] IReferenceHandler refHandler parameter to all mapping methods and provide an implementation yourself.
latonz
changed the title
Multiple Maps Generated for same type, some correct, some incorrect
Enabled reference handling does not resolve user-defined mapping methods correctly
Mar 8, 2024
Mapperly is generating multiple maps for the same type, some of which honor the mapping ignores, others that occlude it.
Declaration code
Actual generated code
Expected generated code
Environment (please complete the following information):
Additional context
This issue was reported to me from a offshore developer and coworker. Here is the relevant information provided to me by him:
The text was updated successfully, but these errors were encountered: