-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Fix CS0419 to display fully qualified type names for ambiguous cref symbols #81148
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
Conversation
…ce warnings Co-authored-by: CyrusNajmabadi <[email protected]>
| Assert.Equal(SymbolKind.Property, symbol.Kind); | ||
| } | ||
|
|
||
| [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/12345")] |
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.
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.
Fixed in eaef250
| var source = """ | ||
| namespace System | ||
| { | ||
| public class TypeA |
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.
@copilot makes these non-public, so you don't have to have the warning diagnostics about missing xml doc comments.
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.
Fixed in 3effaa8
Co-authored-by: CyrusNajmabadi <[email protected]>
Co-authored-by: CyrusNajmabadi <[email protected]>
src/Compilers/CSharp/Test/Symbol/DocumentationComments/CrefTests.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: CyrusNajmabadi <[email protected]>
|
@RikkiGibson ptal. |
Plan for fixing CS0419 to include fully qualified references
SymbolDisplayFormat.CSharpErrorMessageFormatfor displaying symbolsSummary
Successfully fixed CS0419 to display fully qualified type names in ambiguous reference warnings, matching the behavior of CS0104. The warning message now clearly shows the namespace qualification of ambiguous types and methods, making it obvious where the conflicts are coming from.
Changes Made
Binder_Crefs.cs: Modified two locations where
WRN_AmbiguousXMLReferenceis generated:ProcessParameterlessCrefMemberLookupResults- tested byAmbiguousReferenceInDifferentNamespacesPerformCrefOverloadResolution- tested byAmbiguousReferenceInDifferentNamespaces_WithParametersFormattedSymbolusingSymbolDisplayFormat.CSharpErrorMessageFormatCrefTests.cs: Added test cases that verify the new behavior:
AmbiguousReferenceInDifferentNamespaces: Tests ambiguous types without parameter listsAmbiguousReferenceInDifferentNamespaces_WithParameters: Tests ambiguous methods with parameter listsExample
Before:
After:
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.