Tags: dotnet/roslyn
Tags
Add a notification handler for project context changed. (#81942) This handler will then trigger a refresh for all providers using AsyncRefreshQueue. This is needed because semantic highlighting, diagnostics, inlay hints could all be different based on the selected project context.
Add a notification handler for project context changed. (#81942) This handler will then trigger a refresh for all providers using AsyncRefreshQueue. This is needed because semantic highlighting, diagnostics, inlay hints could all be different based on the selected project context.
Build Branch: refs/heads/release/dev17.12 Internal ID: 20250126.6 Internal VS ID: rel.d17.12-36806.00
Build Branch: refs/heads/main Internal ID: 20251124.9 Internal VS ID: rel.d18.3-11304.161
Build Branch: refs/heads/release/dev18.0 Internal ID: 20251124.6 Internal VS ID: rel.d18.0-11304.174
Build our libraries against net10.0 (#81545) Missed as part of building the Roslyn LSP against net10.0. We should also build our libraries against net10.0.
Improve error message for misplaced variable designator in property p… …atterns (#81287) ## Summary: Improve error messages when variable designation is in incorrect order with property pattern ### Problem Statement When users write `o is string s { Length: 5 }` (with designation before property pattern), the compiler produced confusing error messages: - `error CS1026: ) expected` - `error CS1002: ; expected` - `error CS1513: } expected` The correct syntax should be `o is string { Length: 5 } s` (designation after property pattern). ### Solution This PR adds a new error code `ERR_DesignatorBeneathPattern` (CS8525) that provides a clear error message: ``` error CS8525: The variable designator 's' must come after any property pattern. ``` ### Changes Made ✅ **Error Code & Resources:** - Added `ERR_DesignatorBeneathPattern` error code (CS8525) to `ErrorCode.cs` - Added error message to `CSharpResources.resx` - Updated all XLF localization files - Added error code to `ErrorFacts.cs` ✅ **Parser Implementation:** - Modified `parsePropertyPatternClause` local function in `ParsePatternContinued` to detect identifier followed by `{` - When detected, the parser now: - Consumes the misplaced identifier token - Parses the property pattern - Reports the new CS8525 error with the variable name - Places the identifier token as skipped syntax on the property pattern - Continues parsing to provide better recovery ✅ **Testing:** - Added 1 test in `PatternParsingTests.cs`: - `DesignatorBeforePropertyPattern` - tests `string s { Length: 5 }` - All 301 existing pattern parsing tests still pass - Verified the exact scenario from issue #50220 ### Scope This fix only handles the property pattern case (`x { ... }`). Positional patterns (`x ( ... )`) are not covered by this change. ### Validation - ✅ Builds successfully with no warnings - ✅ All 302 pattern parsing tests pass (301 passed, 1 skipped) - ✅ Correct syntax continues to work without the new error - ✅ Error message is clear and concise - ✅ Simplified implementation with direct token consumption - ✅ No security vulnerabilities introduced Fixes #50220 <!-- START COPILOT CODING AGENT TIPS --> --- 💬 We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey). --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: CyrusNajmabadi <[email protected]> Co-authored-by: Cyrus Najmabadi <[email protected]>
Improve error message for misplaced variable designator in property p… …atterns (#81287) ## Summary: Improve error messages when variable designation is in incorrect order with property pattern ### Problem Statement When users write `o is string s { Length: 5 }` (with designation before property pattern), the compiler produced confusing error messages: - `error CS1026: ) expected` - `error CS1002: ; expected` - `error CS1513: } expected` The correct syntax should be `o is string { Length: 5 } s` (designation after property pattern). ### Solution This PR adds a new error code `ERR_DesignatorBeneathPattern` (CS8525) that provides a clear error message: ``` error CS8525: The variable designator 's' must come after any property pattern. ``` ### Changes Made ✅ **Error Code & Resources:** - Added `ERR_DesignatorBeneathPattern` error code (CS8525) to `ErrorCode.cs` - Added error message to `CSharpResources.resx` - Updated all XLF localization files - Added error code to `ErrorFacts.cs` ✅ **Parser Implementation:** - Modified `parsePropertyPatternClause` local function in `ParsePatternContinued` to detect identifier followed by `{` - When detected, the parser now: - Consumes the misplaced identifier token - Parses the property pattern - Reports the new CS8525 error with the variable name - Places the identifier token as skipped syntax on the property pattern - Continues parsing to provide better recovery ✅ **Testing:** - Added 1 test in `PatternParsingTests.cs`: - `DesignatorBeforePropertyPattern` - tests `string s { Length: 5 }` - All 301 existing pattern parsing tests still pass - Verified the exact scenario from issue #50220 ### Scope This fix only handles the property pattern case (`x { ... }`). Positional patterns (`x ( ... )`) are not covered by this change. ### Validation - ✅ Builds successfully with no warnings - ✅ All 302 pattern parsing tests pass (301 passed, 1 skipped) - ✅ Correct syntax continues to work without the new error - ✅ Error message is clear and concise - ✅ Simplified implementation with direct token consumption - ✅ No security vulnerabilities introduced Fixes #50220 <!-- START COPILOT CODING AGENT TIPS --> --- 💬 We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey). --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: CyrusNajmabadi <[email protected]> Co-authored-by: Cyrus Najmabadi <[email protected]>
Build Branch: refs/heads/release/dev18.3 Internal ID: 20251105.5 Internal VS ID: rel.d18.3-11222.16
Build Branch: refs/heads/release/dev18.0 Internal ID: 20251029.7 Internal VS ID: rel.d18.0-11222.15
PreviousNext