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
When creating a mapping method from Source to Target classes, where Target has a readonly property, analyzer shows the RMG012 warning, which doesn't make sense, as it would not be possible to map to a readonly property anyway.
To Reproduce
Create Source class with any set of properties (e.g. FirstName and LastName)
Create Target class with all the properties from Source plus a readonly property (e.g. FullName => FirstName + LastName)
Create a Mapper class and a method to map from Source to Target
Check the analyzer displays RMG012 warning
Expected behavior
As the target property is readonly (and, thus, cannot be assigned to), the aforementioned warning should not be displayed.
Environment
Mapperly Version: 2.7.0
.NET Version: .NET 7
IDE: Visual Studio v17.5.4
OS: Windows 11
The text was updated successfully, but these errors were encountered:
I just upgraded Mapperly to version 2.8.0 and, although issue #345 is part of this release, this problem still occurs, as can be seen below:
Classes PersonEntity and PersonDto have settings just like I described above, with both having FirstName and LastName properties and PersonEntity only having FullName (readonly) property:
Please disregard my previous comment. I just check it again (with version 2.8.0) and it is working as expected now.
Yesterday I tested right after I updated the package, so, most likely the alert was still showing because VS was still referencing the previous version (even though I had built the whole solution).
When creating a mapping method from
Source
toTarget
classes, whereTarget
has a readonly property, analyzer shows the RMG012 warning, which doesn't make sense, as it would not be possible to map to a readonly property anyway.To Reproduce
Source
class with any set of properties (e.g.FirstName
andLastName
)Target
class with all the properties fromSource
plus a readonly property (e.g.FullName => FirstName + LastName
)Mapper
class and a method to map fromSource
toTarget
Expected behavior
As the target property is readonly (and, thus, cannot be assigned to), the aforementioned warning should not be displayed.
Environment
The text was updated successfully, but these errors were encountered: