-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Fix ArgumentException in SeparatedSyntaxList.ReplaceSeparator to use proper message and paramName #80690
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
…oper messages and parameter names Co-authored-by: CyrusNajmabadi <[email protected]>
| Assert.Equal(1, newList.GetSeparator(1).GetLeadingTrivia().Count); | ||
| } | ||
|
|
||
| [Fact] |
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 remove these tests
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.
Done. Removed the test methods in commit 7c89d.
Co-authored-by: CyrusNajmabadi <[email protected]>
| newSeparator.Language != nodesWithSeps[index].Language) | ||
| { | ||
| throw new ArgumentException("newSeparator"); | ||
| throw new ArgumentException("New separator must have the same RawKind and Language as the separator being replaced.", nameof(newSeparator)); |
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 Break this into two separate checks, and add two new resource string exception messages. One for needing to have the same RawKind and one for needing to have the same Language. #Closed
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.
Done. Split into two separate checks with dedicated resource strings SeparatorTokenMustHaveSameRawKind and SeparatorTokenMustHaveSameLanguage in commit 0c9ca.
…cated resource strings Co-authored-by: CyrusNajmabadi <[email protected]>
Co-authored-by: CyrusNajmabadi <[email protected]>
.gitignore
Outdated
|
|
||
| # WPF temp projects | ||
| *wpftmp.* | ||
| Program.cs |
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 remove this.
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.
Done. Removed Program.cs from .gitignore in commit 26c01.
Co-authored-by: CyrusNajmabadi <[email protected]>
|
@dotnet/roslyn-compiler ptal. |
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.
LGTM Thanks (commit 6)
Fix ArgumentException in SeparatedSyntaxList.ReplaceSeparator
Fixes the issue where
ReplaceSeparatormethod throwsArgumentExceptionwith parameter names as messages instead of proper exception messages.Changes Made
Details
CodeAnalysisResources.MissingListItemas message andnameof(separatorToken)as paramNameCodeAnalysisResources.SeparatorTokenMustHaveSameRawKindCodeAnalysisResources.SeparatorTokenMustHaveSameLanguageVerification
Before fix:
After fix:
Original prompt
Fixes #2496
💡 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.