Skip to content

fix: do not emit RMG012 for getter-only target members with queryable projections#2227

Merged
latonz merged 3 commits intoriok:mainfrom
Demivan:main
Apr 13, 2026
Merged

fix: do not emit RMG012 for getter-only target members with queryable projections#2227
latonz merged 3 commits intoriok:mainfrom
Demivan:main

Conversation

@Demivan
Copy link
Copy Markdown
Contributor

@Demivan Demivan commented Apr 10, 2026

Do not emit RMG012 for getter-only target members with queryable projections

Description

When a mapper has a queryable projection and getter-only properties (expression-bodied or { get; }) Mapperly is incorrectly triggering RMG012. BuildInitMemberMappings included all target members in expression context without checking if they could actually be set.

Fixes #2226

Checklist

  • I did not use AI tools to generate this PR, or I have manually verified that the code is correct, optimal, and follows the project guidelines and architecture
  • I understand that low-quality, AI-generated PRs will be closed immediately without further explanation
  • The existing code style is followed
  • The commit message follows our guidelines
  • Performed a self-review of my code
  • Hard-to-understand areas of my code are commented
  • The documentation is updated (as applicable)
  • Unit tests are added/updated
  • Integration tests are added/updated (as applicable, especially if feature/bug depends on roslyn or framework version in use)

Demivan added 2 commits April 10, 2026 21:58
… projections

When a mapper has a queryable projection and getter-only
properties (expression-bodied or { get; }) incorrectly
triggered RMG012. BuildInitMemberMappings included all
target members in expression context without checking
if they could actually be set.
Copy link
Copy Markdown
Contributor

@latonz latonz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the contribution! ❤️

@latonz latonz added the bug Something isn't working label Apr 11, 2026
@latonz latonz merged commit 48d4b7b into riok:main Apr 13, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RMG012 emitted for getter-only target properties when queryable projection exists

2 participants