-
Notifications
You must be signed in to change notification settings - Fork 5.2k
UnsafeAccessor
- ambiguous name and signature match
#119972
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UnsafeAccessor
- ambiguous name and signature match
#119972
Conversation
Handle the case where there is an ambiguous name and signature match, but one is generic and the other isn't.
This needs to be ported to both .NET 10 and 9 when verified. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes an issue with UnsafeAccessor ambiguity when there are methods with the same name and signature, but one is generic and the other is not. The fix ensures proper handling of generic method resolution in UnsafeAccessor implementations.
Key changes:
- Added validation for generic parameter count matching in both CoreCLR and AOT implementations
- Restructured generic signature validation logic for better clarity
- Added comprehensive test coverage for ambiguous method name scenarios
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
src/tests/baseservices/compilerservices/UnsafeAccessors/UnsafeAccessorsTests.Generics.cs |
Added test cases for ambiguous method names and updated existing test method names for consistency |
src/coreclr/vm/unsafeaccessors.cpp |
Fixed generic signature validation logic to properly handle ambiguous cases |
src/coreclr/tools/Common/TypeSystem/IL/UnsafeAccessors.cs |
Added generic parameter count validation for AOT implementation |
Tagging subscribers to this area: @dotnet/area-system-runtime-compilerservices |
/backport to release/9.0-staging |
Started backporting to release/9.0-staging: https://github.com/dotnet/runtime/actions/runs/17931516821 |
/backport to release/10.0 |
Started backporting to release/10.0: https://github.com/dotnet/runtime/actions/runs/17931525426 |
@AaronRobinsonMSFT backporting to "release/9.0-staging" failed, the patch most likely resulted in conflicts: $ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch
Applying: UnsafeAccessor - ambiguous name and signature match
Using index info to reconstruct a base tree...
M src/coreclr/tools/Common/TypeSystem/IL/UnsafeAccessors.cs
A src/coreclr/vm/unsafeaccessors.cpp
M src/tests/baseservices/compilerservices/UnsafeAccessors/UnsafeAccessorsTests.Generics.cs
Falling back to patching base and 3-way merge...
Auto-merging src/coreclr/tools/Common/TypeSystem/IL/UnsafeAccessors.cs
CONFLICT (modify/delete): src/coreclr/vm/unsafeaccessors.cpp deleted in HEAD and modified in UnsafeAccessor - ambiguous name and signature match. Version UnsafeAccessor - ambiguous name and signature match of src/coreclr/vm/unsafeaccessors.cpp left in tree.
Auto-merging src/tests/baseservices/compilerservices/UnsafeAccessors/UnsafeAccessorsTests.Generics.cs
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0001 UnsafeAccessor - ambiguous name and signature match
Error: The process '/usr/bin/git' failed with exit code 128 Please backport manually! |
Fixes #119875
Handle the case where there is an ambiguous name and signature match, but one is generic and the other isn't.
Validated new test on coreclr, native AOT and mono.