Fix ArgumentException in SeparatedSyntaxList.ReplaceSeparator to use proper message and paramName#80690
Merged
CyrusNajmabadi merged 6 commits intomainfrom Oct 22, 2025
Merged
Conversation
…oper messages and parameter names Co-authored-by: CyrusNajmabadi <[email protected]>
Copilot
AI
changed the title
[WIP] Fix replaced separator error message in SeparatedSyntaxList
Fix ArgumentException in SeparatedSyntaxList.ReplaceSeparator to use proper message and paramName
Oct 14, 2025
| Assert.Equal(1, newList.GetSeparator(1).GetLeadingTrivia().Count); | ||
| } | ||
|
|
||
| [Fact] |
Contributor
Author
There was a problem hiding this comment.
Done. Removed the test methods in commit 7c89d.
Co-authored-by: CyrusNajmabadi <[email protected]>
CyrusNajmabadi
approved these changes
Oct 14, 2025
| 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)); |
Contributor
There was a problem hiding this comment.
@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
Contributor
Author
There was a problem hiding this comment.
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 |
Contributor
Author
There was a problem hiding this comment.
Done. Removed Program.cs from .gitignore in commit 26c01.
CyrusNajmabadi
approved these changes
Oct 16, 2025
Co-authored-by: CyrusNajmabadi <[email protected]>
Contributor
|
@dotnet/roslyn-compiler ptal. |
333fred
approved these changes
Oct 22, 2025
This was referenced Oct 25, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.