Skip to main content

Analyzer diagnostics

Mapperly emits several diagnostics:

Rule IDSeverityDescription
RMG001ErrorA mapping method has an unsupported signature.
RMG002ErrorNo accessible parameterless constructor found.
RMG003WarningNo overlapping enum members found.
RMG004WarningIgnored target member not found.
RMG005ErrorMapping target member not found.
RMG006ErrorMapping source member not found.
RMG007ErrorCould not map member.
RMG008ErrorCould not create mapping.
RMG009InfoCannot map to read only member.
RMG010InfoCannot map from write only member.
RMG011InfoCannot map to write only member path.
RMG012InfoSource member was not found for target member
RMG013ErrorNo accessible constructor with mappable arguments found
RMG014WarningCannot map to the configured constructor to be used by Mapperly
RMG015InfoCannot map to init only member path
RMG016ErrorInit only member cannot handle target paths
RMG017WarningAn init only member can have one configuration at max
RMG018ErrorPartial static mapping method in an instance mapper
RMG020InfoSource member is not mapped to any target member
RMG021WarningIgnored source member not found
RMG022ErrorInvalid object factory signature
RMG023ErrorMapping source member for a required target member not found
RMG024ErrorThe reference handler parameter is not of the correct type
RMG025ErrorTo use reference handling it needs to be enabled on the mapper attribute
RMG026InfoCannot map from indexed member
RMG027WarningA constructor parameter can have one configuration at max
RMG028ErrorConstructor parameter cannot handle target paths
RMG029ErrorQueryable projection mappings do not support reference handling
RMG030ErrorReference loop detected while mapping to an init only member
RMG031WarningReference loop detected while mapping to a constructor member
RMG032WarningThe enum mapping strategy ByName cannot be used in projection mappings
RMG033InfoObject mapped to another object without deep clone
RMG034ErrorDerived source type is specified multiple times, a source type may only be specified once
RMG035ErrorDerived source type is not assignable to parameter type
RMG036ErrorDerived target type is not assignable to return type
RMG037InfoAn enum member could not be found on the source enum
RMG038InfoAn enum member could not be found on the target enum
RMG039ErrorEnum source value is specified multiple times, a source enum value may only be specified once
RMG040ErrorA target enum member value does not match the target enum type
RMG041ErrorA source enum member value does not match the source enum type
RMG042ErrorThe type of the enum fallback value does not match the target enum type
RMG043WarningEnum fallback values are only supported for the ByName and ByValueCheckDefined strategies, but not for the ByValue strategy
RMG044WarningAn ignored enum member can not be found on the source enum
RMG045WarningAn ignored enum member can not be found on the target enum
RMG046ErrorThe used C# language version is not supported by Mapperly, Mapperly requires at least C# 9.0
RMG047ErrorCannot map to member path due to modifying a temporary value, see CS1612
RMG048ErrorUsed mapper members cannot be nullable
RMG049WarningSource member is ignored and also explicitly mapped
RMG050WarningTarget member is ignored and also explicitly mapped
info

Mapperly only emits updated source code on build. You won't see the updated mapper code or mapper diagnostics until you perform a build.

This is done for performance reasons, otherwise the IDE could become laggy.

Editorconfig‚Äč

The severity of these diagnostics can be customized via an .editorconfig file:

.editorconfig
[*.cs]
dotnet_diagnostic.{RuleID}.severity = error
dotnet_diagnostic.RMG020.severity = error