Skip to content

fix: don't let generic user mapping override explicitly referenced mappings#2339

Merged
latonz merged 1 commit into
riok:mainfrom
latonz:fix/2277-generic-user-mapping-overrides-use
Jun 22, 2026
Merged

fix: don't let generic user mapping override explicitly referenced mappings#2339
latonz merged 1 commit into
riok:mainfrom
latonz:fix/2277-generic-user-mapping-overrides-use

Conversation

@latonz

@latonz latonz commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

A generic user-implemented mapping method matched any source/target type pair during mapping resolution, which happens before the Use= named mapping reference is resolved. As a result a generic method (e.g. T Identity(T)) shadowed mappings that were explicitly referenced via Use on individual members.

Generic template matching is now skipped when a mapping is explicitly referenced by name, letting the UseNamedMappingBuilder resolve it. The named mapping builder also instantiates a concrete mapping when a generic method is referenced by name directly.

Closes #2277

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)

@latonz latonz self-assigned this Jun 22, 2026
…ppings

A generic user-implemented mapping method matched any source/target type
pair during mapping resolution, which happens before the Use= named mapping
reference is resolved. As a result a generic method (e.g. T Identity<T>(T))
shadowed mappings that were explicitly referenced via Use on individual
members.

Generic template matching is now skipped when a mapping is explicitly
referenced by name, letting the UseNamedMappingBuilder resolve it. The named
mapping builder also instantiates a concrete mapping when a generic method is
referenced by name directly.

Closes riok#2277
@latonz
latonz force-pushed the fix/2277-generic-user-mapping-overrides-use branch from 3cf8232 to 1027dd3 Compare June 22, 2026 18:23
@latonz latonz added the bug Something isn't working label Jun 22, 2026
@latonz
latonz merged commit 29631fe into riok:main Jun 22, 2026
17 of 18 checks passed
@latonz
latonz deleted the fix/2277-generic-user-mapping-overrides-use branch June 22, 2026 18:33
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.

Generic user mapping function overwrites specified function on other parameter

1 participant