Releases: dotnet/vscode-csharp
v2.142.16-prerelease
2.142.x
- Update Roslyn to 5.8.0-1.26262.9 (PR: #9293)
- Update Razor to 10.4.0-preview.26262.9 (PR: #9293)
- Don't crash lowering a generic component type argument with mixed literal/expression content (PR: #83645)
- Avoid _ collision in bind-*:after property accessor (PR: #83572)
- Fix ArgumentOutOfRangeException when orphan end tag follows HTML text (PR: #83574)
- Fix formatting of multiline expressions in attributes (PR: #83566)
- Implement call hierarchy LSP methods in Razor (PR: #83548)
- Add prepareRename support to Razor (PR: #83599)
- Update Roslyn to 5.8.0-1.26256.6 (PR: #9291)
- Update Razor to 10.4.0-preview.26256.6 (PR: #9291)
v2.140.8
2.140.x
This update brings new language features like Type Hierarchy and Call Hierarchy, major file-based apps improvements, significant performance gains, extensive Razor formatting and editing enhancements, Blazor WebAssembly debugging, and MAUI tooling improvements.
C# Language Support
Selection Range
The LSP now supports Selection Range (Expand Selection / Shrink Selection), enabling smart expanding and shrinking of text selections based on the syntactic structure of your C# code. For example, you can progressively select from a variable name → the containing statement → the containing block → the method → the class, all with keyboard shortcuts. (roslyn#82809)
Type Hierarchy and Call Hierarchy
Two powerful navigation features are now available for C# in VS Code:
- Type Hierarchy lets you explore the full inheritance chain of any class, interface, or struct — navigate through base types and derived types without leaving the editor. (roslyn#83011)
- Call Hierarchy lets you trace incoming and outgoing calls for any method, making it easy to understand how your code connects. Interface implementation categories for overrides are correctly shown, so you get an accurate picture of the full call chain. (roslyn#82865)
File-based apps: automatic discovery and improved editing
C# file-based apps (standalone .cs files that run without a project file) can now be automatically discovered in the opened workspace folders. Set dotnet.fileBasedApps.enableAutomaticDiscovery to true to use it. This is particularly recommended when using the new #:include directive to enable file-based apps made up of multiple .cs files.
Beyond discovery, the editing experience for file-based apps has been refined:
- Transitive
#:directives are now handled correctly, so transitive dependencies resolve properly. #:directives are preserved during formatting, preventing the formatter from mangling file-based app metadata.- Completions for
#:includedirectives help you discover available files as you type. - Improved colorization of file-based app directives makes them visually distinct from regular C# code.
Performance
Faster solution loading with parallel analyzer initialization
Solution-level analyzers now load in parallel during project initialization. In solutions with many analyzers (which is common when using .NET Analyzers, StyleCop, or other code analysis packages), this can meaningfully reduce the time between opening a solution and seeing your first diagnostics. (roslyn#82447)
Reduced memory allocations across the language server
A broad sweep of allocation reductions has been made across many hot paths in the language server:
- Syntax trivia handling — modified search and walk methods now check green nodes first, avoiding unnecessary allocations.
- Text diffing and source text operations — internal text line data structures now pack data more efficiently, reducing per-line overhead.
- Completion — repeated
int.ToStringcalls during completion item generation are now avoided. - Document analysis and code fix service — result creation and predicate evaluation now reuse objects instead of allocating.
These improvements contribute to lower GC pressure and smoother editing, especially in large codebases.
Razor
Unused directives: fade, remove, and sort
Unused @using directives in Razor files now appear faded, just like unused using statements in C# files. A new "Remove unnecessary usings" code action lets you clean them up in one click.
Additionally, two new commands are available for Razor files:
- Remove and Sort Usings — removes unused directives and sorts the remainder.
- Sort and Consolidate Usings — sorts and consolidates
@usingdirectives without removing any.
These features bring Razor's @using management in line with the C# editing experience. (vscode-csharp#9040)
Generate Method code action
The Generate Method code action now works in Razor files. When you call a method that doesn't exist yet, you can generate a stub directly from the Razor editor — no need to switch to a .cs file first. This also works from the C# editor for methods referenced in Razor documents. (vscode-csharp#9162)
Rename in Razor source-generated documents
Rename operations now work correctly in Razor source-generated documents, enabling more seamless refactoring across Razor and C# boundaries. Previously, renames could fail when the source-generated document couldn't be mapped back. (vscode-csharp#9155)
Formatting fixes
A large number of Razor formatting issues have been resolved in this release:
- Multiline
@ifstatements are now formatted correctly. - Ternary expressions inside Razor blocks no longer break formatting.
- Wrapped CSS in Razor files is now indented properly.
<pre>tags are now treated like<textarea>tags, so their content is preserved as-is.- Void tag helpers no longer break HTML formatting.
- Script tags that are or contain tag helpers are now formatted correctly.
- Short HTML tag attributes are now formatted correctly.
- Block-bodied lambda attributes no longer break formatting.
- Trailing content after Razor comments no longer causes formatting errors.
Bug fixes
- Diagnostics no longer crash with a null reference exception when pulling diagnostics for certain document configurations. (vscode-csharp#9206)
- Unparseable document URIs no longer crash the Razor language server. (vscode-csharp#9206)
- Code actions for unmapped directive spans now correctly apply as Razor content. (vscode-csharp#9067)
- "Remove directive" code action is no longer incorrectly offered for multi-line directives. (vscode-csharp#9056)
- Fix ArgumentOutOfRangeException when orphan end tag follows HTML text (PR: razor#13129)
- Fix compiler crash for malformed attributes (PR: razor#13120)
Debugging
Blazor WebAssembly debugging
The extension now supports debugging Blazor WebAssembly applications targeting .NET 9 and later. You can set breakpoints, step through code, and inspect variables in your Blazor WASM projects directly from VS Code, using the monovsdbg debugger. This brings the Blazor WASM debugging experience closer to the server-side experience you're already familiar with. (vscode-csharp#7220)
Hot Reload improvements
Several Hot Reload issues have been resolved. The DevKit Hot Reload flow now works correctly, and exception details are included in internal error messages to make troubleshooting easier. (vscode-csharp#9155, vscode-csharp#9188)
Debugger expression evaluation
Evaluations inside ref-returning methods now work correctly during debugging. Previously, attempting to evaluate an expression in a method that returns by ref could produce incorrect results. (vscode-csharp#9096)
MAUI
XAML C# Expressions (XEXPR)
The XAML tooling now has limited support for C# expressions in XAML (XEXPR), a new feature that allows you to write C# expressions directly in XAML markup. (vscode-csharp#9225)
Implicit XML namespace support
Implicit XML namespaces for MAUI are now supported, reducing the need for explicit xmlns declarations in your XAML files. This simplifies MAUI XAML authoring by letting you reference common types without namespace prefixes. (vscode-csharp#9091)
Bug fixes
- SslStream disposal crash — an intermittent crash caused by a disposed
SslStreamin the XAML tooling has been fixed. This was reported by multiple users as the C# language server crashing several times a day. (vscode-csharp#9225) - Debug session shutdown crash — the
msvsmonprocess no longer crashes during debug session shutdown when XAML Hot Reload is enabled. (vscode-csharp#9225) - Hot Reload error reporting — XAML Hot Reload errors now display correctly when exceptions originate from indirectly-loaded views. (vscode-csharp#9225)
- Null reference exception — an unhandled null reference exception in the XAML Language Service has been fixed. (vscode-csharp#9091)
- Legacy Hot Reload conflict — legacy XAML Hot Reload is now automatically disabled when Source Generators are active, preventing conflicts. (vscode-csharp#9091)
v2.136.19-prerelease
2.136.x
- Update Roslyn to 5.7.0-1.26220.12 (PR: #)
- File-based apps: Adjust heuristics to properly handle transitive directives (PR: #83185)
- Ensure we don't touch the remote host during new document formatting (PR: #83212)
- Allow creation of DocumentUri for uris System.Uri cannot parse (PR: #83210)
- Fix property pattern completion filtering out member being edited (PR: #83230)
- Support MatchPriority comparison in LSP completion (PR: #83164)
- Have CompleteStatement handle EOF statements (PR: #83205)
- Update Razor to 10.0.0-preview.26217.1 (PR: #9206)
- Update Roslyn to 5.7.0-1.26217.5 (PR: #9155)
- Allow cohost rename in Razor source-generated docs (PR: #83217)
- Allow manual creation of hot reload brokered services in VSCode (PR: #83082)
- Use standard LSP for source generator contents (PR: #83119)
- Fix restore of misc project for virtual files and older SDKs (PR: #83172)
- Improve TextLine and line table performance by packing existing data into unused bits (PR: #83000)
- Restore removed brokered service descriptors for hot reload (PR: #83184)
- Update xamlTools to 18.7.11721.33 (PR: #9225)
- Fix msvsmon crash during debug session shutdown with XAML Hot Reload enabled (PR: AzDO#728217)
- Fix SslStream disposal crash (Issues: 9146, 9183, 9175, PR: AzDO#728722)
- Fix XAML Hot Reload error reporting when exceptions originate from indirectly-loaded views (PR: AzDO#729745)
- XAML C# Expressions (XEXPR) limited support (PR: AzDO#721767)
v2.135.19-prerelease
2.135.x
- Bump lodash from 4.17.23 to 4.18.1 (PR: #9152)
- Adding changes to support use monovsdbg to debug wasm apps. (PR: #7220)
- Update Roslyn to 5.7.0-1.26213.1 (PR: #9188)
- Fix devkit hot reload (PR: #83157)
- Fix Call Hierarchy missing interface implementation category for overrides (PR: #83132)
- Skip unmappable source-generated document edits in rename (PR: #83080)
- Fix misleading error when
#!appears anywhere other than the start of the file (PR: #83112) - Fix mishandling of multiple output path changes in a single batch (PR: #83121)
- Add option for import completion commit behavior (PR: #82916)
- Fixers: Fix to add bounds checks and strip all boundary \r/\n chars (PR: #83098)
- Add LSP TypeHierarchy Support (PR: #83011)
- Update Razor to 10.0.0-preview.26208.5 (PR: #9162)
- Support Generate Method code action in Razor and C# editors (PR: #12960)
v2.134.7-prerelease
2.134.x
- Add setting
dotnet.fileBasedApps.enableAutomaticDiscovery(PR: #9096) - Update Roslyn to 5.7.0-1.26203.6 (PR: #9096)
- File-based apps automatic discovery (PR: #82863)
- Fix evaluations inside ref-returning methods (PR: #83037)
- Fix with-element indentation in collection expressions on multiple lines (PR: #83030)
- Do not crash if URI not parseable and no default handler exists (PR: #83024)
- Allow generate method to run on Razor documents (PR: #83028)
- Preserve #: file-based app directives during formatting (PR: #82996)
- Move inheritance margin logic to a features service (PR: #83001)
- Don't format plain blocks as member declaration blocks in top level code (PR: #82976)
- Add LSP CallHierarchy support (PR: #82865)
- Move CallHierarchy logic to the Features layer (PR: #82864)
- Handle misc project having an AdditionalDocument and not a Document (PR: #82956)
- Fix structure guideline anchor for initializer expressions with multi-line argument lists (PR: #82946)
- Navigate to position instead of span for Go to Implementation (PR: #82906)
- Only cache diagnostics for legacy projects (PR: #82643)
- Improve classification of file-based app directives (PR: #82627)
- Add support for skipping analyzing banned API analysis in generated files (PR: #82713)
- Add regex search support to NavigateTo (PR: #82706)
- Add completion provider for
#:includedirectives (PR: #82625) - Modify SyntaxNode trivia search/walk methods to utilize green node checks (PR: #82893)
- Fix handling of added import trivia (PR: #82788)
- DeterministicKeyBuilder: deduplicate ParseOptions across SyntaxTrees (PR: #82895)
- Fix InvalidCastException in split-if refactoring for top-level statements (PR: #82807)
v2.133.5-prerelease
2.133.x
v2.131.79-prerelease
2.131.x
- Update Roslyn to 5.6.0-2.26163.11 (PR: #9068)
- Reduce allocations in normal elfie usage (PR: #82743)
- Reduce allocations in GetEscapedMetadataName (PR: #82716)
- Cache diagnostics for method body compilation. (PR: #82667)
- Unsafe evolution: handle
new()constraint (PR: #82647) - Unsafe evolution: add LangVersion error for updated memory safety rules (PR: #82687)
- Fix/76886 await nullable value type (PR: #82146)
- ImplementSynthesizedBackingFieldSymbolBase.TryGetFirstLocation (PR: #82679)
- Fix visiting unreachable
whenclauses in NullableWalker (PR: #82563) - Reduce allocations in DocumentAnalysisExecutor ctor (PR: #82669)
- Fix IDE0059 to not flag writes to by-ref parameters or ref locals as redundant (PR: #82664)
- Use a sequence point for custom awaiters with runtime async (PR: #82605)
- Improve trivia handling in 'use as expression'. (PR: #82577)
- Update Razor to 10.0.0-preview.26155.3 (PR: #9056)
- Don't offer to remove directives when not on a single line directive (PR: #12862)
- Update Roslyn to 5.6.0-2.26159.3 (PR: #9057)
- Reduce allocations during source text diffing (PR: #82462)
- Don't log named pipe connection failures as errors in BuildServerConnection (PR: #82609)
- Ensure that lambdas are not cached in runtime async (PR: #82559)
- Ensure that a double-dispose of CPSProject doesn't throw (PR: #82557)
- Add support for nullable with runtime async (PR: #82516)
- Fix invalid
csharp_space_around_declaration_statementsoption value (PR: #80996) - Avoid eliding nested pointer-to-ref conversions (PR: #82263)
- Update Razor to 10.0.0-preview.26152.1 (PR: #9040)
- Fade unused directives, add "Remove unnecessary" code action and support Remove and Sort commands (PR: #12831)
- Add Remove and Sort Usings command handling (PR: #12834)
- Create "Sort and Consolidate Usings" code action (PR: #12824)
- Fix formatting of wrapped CSS (PR: #12823)
- Format (or don't!) pre tags like textarea tags (PR: #12813)
- Fix formatting of ternary expressions (and others?) (PR: #12808)
- Fix formatting of multiline
@ifstatements (PR: #12814)
- Update Roslyn to 5.6.0-2.26127.2 (PR: #9034)
- Fix signature help crash when invoked through extension property (PR: #82537)
- Fix ReflectionTypeLoadException in CodeStyleHostLanguageServices MEF composition (PR: #82442)
- Parallelize loading solution-level analyzers (PR: #82447)
- Reduce allocations under CodeFixService.GetShouldIncludeDiagnosticPredicate (PR: #82492)
- Extensions: fix crash with targeted attribute on extension block (PR: #82463)
- Improve navigate-to filtering to avoid scanning documents unnecessarily. (PR: #82431)
- Remove
IQueueItemabstraction and standardize CLSP queue pipeline onQueueItem(PR: #82410) - Remove error reporting out of clasp and rely on host to report errors (PR: #82435)
- Report unnecessary imports diagnostics in Razor generated files (PR: #82419)
- Update Razor to 10.0.0-preview.26121.1 (PR: #9025)
v2.130.5
2.130.x
This update brings significant improvements to reliability, diagnostics tooling, language server performance, and Razor editing.
Reliability
Improved error reporting when the language server encounters an error
The experience when the language server crashes has been significantly improved. Previously, crashes could go unnoticed (only visible in logs) or spam users with multiple meaningless notifications that had no actionable items.
Now, when the language server encounters an unrecoverable error:
- A single, consolidated notification is shown instead of 3+ duplicate error toasts.
- Error notifications include a "Report Issue" button that opens the issue reporter with logs pre-filled.
- Server crashes can trigger a restart of the extension, so you can get back to work quickly.
Under the hood, the extension now uses the built-in VS Code LSP client support for named pipe connections, delegating process lifecycle management to VS Code itself. This means better handling of process crashes, cleaner shutdown behavior, and fewer lingering processes. (vscode-csharp#8982, roslyn#82376)
Language server now shuts down when VS Code exits
The language server now accepts the extension host process ID on startup. If the parent VS Code process terminates unexpectedly, the language server will automatically shut itself down, preventing orphaned server processes from lingering in the background. (vscode-csharp#8976, roslyn#82346)
Performance
Balanced source generator execution (default)
Source generator execution now defaults to Balanced mode. In this mode, source generators only run on explicit actions like file save, build task execution, or the C#: Rerun Source Generators command. This is a significant change from the previous default (Automatic), which ran source generators on every keystroke.
Benchmarks show measurable improvements in both CPU and memory usage:
| Typing Iterations | Mode | Mean Time | Allocated Memory |
|---|---|---|---|
| 1000 | Automatic | 4,345 ms | 216 MB |
| 1000 | Balanced | 3,897 ms | 186 MB |
If you need real-time source generator updates while typing, you can switch back via the dotnet.server.sourceGeneratorExecution setting (requires restart). (vscode-csharp#8970, roslyn#82330)
Reduced memory and CPU usage in the language server
Several internal optimizations reduce allocations during analysis result creation, pattern matching operations, and file system watching:
- Improved pattern matching elimination — redundant evaluations during pattern matching are now eliminated more aggressively. (roslyn#82142)
- Reduced file system watchers —
FileSystemWatcherinstances are now limited to one per drive root, reducing overhead on large solutions. (roslyn#82211) - Lower allocations during analysis — analysis result creation now allocates less memory. (roslyn#82139)
Diagnostics Tooling
New "Capture Logs" command
A new C#: Capture Logs command lets you quickly record C# and C# LSP log activity for troubleshooting. When you run the command, it:
- Sets the log level to Trace
- Captures all log output until you cancel
- Packages the logs (including your current C# settings) into a downloadable
.zipfile
This makes it much easier to provide detailed diagnostic information when reporting issues. (vscode-csharp#8942)
Logs included when recording a server trace
The existing C#: Record Language Server Trace command now also captures log output alongside the trace data, and optionally lets you collect memory or GC dumps before and after the trace. All data is bundled into a single archive for easy sharing. (vscode-csharp#8951)
New "Collect Dump" command
A new C#: Collect Dump command allows you to collect either a Memory dump or a GC dump of the language server process on demand. The generated archive additionally includes logs and settings, making it invaluable for diagnosing performance or memory issues. (vscode-csharp#8966)
Razor logs now included in diagnostics
The Capture Logs, Collect Dump, and Record Trace commands now also collect Razor language server logs, so you get a complete picture of all language services activity in a single archive. (vscode-csharp#8988)
All settings now captured when collecting logs
Log captures now include the complete set of C# extension settings (including server-only settings defined in package.json), not just the subset used by the extension code. This ensures that when you share a diagnostics archive, the full configuration context is available. (vscode-csharp#8954)
Settings
New dotnet.server.environmentVariables setting
You can now pass custom environment variables to the language server process via the dotnet.server.environmentVariables setting. This is useful for advanced scenarios like overriding the .NET garbage collector:
{
"dotnet.server.environmentVariables": {
"DOTNET_GCName": "libclrgc.dylib",
"DOTNET_gcServer": "0"
}
}Changes to this setting prompt a window reload. (vscode-csharp#8967)
dotnet.server.crashDumpPath now triggers a restart prompt
Changing the dotnet.server.crashDumpPath setting now properly prompts you to restart the extension for the change to take effect. Previously, the setting would silently have no effect until a manual restart.
Additionally, all settings that require an extension restart now use a consistent (Requires extension restart) label in their descriptions. (vscode-csharp#8973)
C# Language Service
IntelliSense and completions
- Property and extension method items with the same name are now both shown in the completion list, instead of one hiding the other. (roslyn#82315)
thisis no longer recommended insidenameofin an attribute, reducing noise in completion suggestions. (roslyn#82299)- The
enableFileBasedProgramssetting change is now properly handled in the editor without requiring a restart. (roslyn#82214)
Bug fixes
- Fixed workspace search always returning no results for the first query after opening a solution. (roslyn#82276)
- Fixed
GetDeconstructionInforeturning incorrect results on converted deconstruction assignments. (roslyn#82324) - Fixed a crash in the "Simplify LINQ expression" code fix. (roslyn#82392)
- The "Use with-element" suggestion is no longer offered in projects targeting C# versions prior to 15. (roslyn#82389)
- Fixed an issue where
isReferenceAssemblywas incorrectly set totrueeven when the implementation assembly was found. (roslyn#82242)
Razor
Formatting fixes
- Fixed formatting when there are two markup elements on the same line inside a C# block, and prevented a crash caused by block-bodied lambdas in attributes. (razor#12786)
- Fixed indentation after complete tags that regressed due to an incorrect regex group. (razor#12784)
- Improved handling of VS Code newline behavior — the formatter now correctly handles blank line insertion between elements and newline rearrangement in long HTML tags. (razor#12773)
- Fixed indentation following a self-closing tag with a lambda attribute. (razor#12727)
Debugging
- Fixed breakpoint placement for
@codeblocks in the middle of Razor documents. Previously, breakpoints could be placed on incorrect lines when code blocks appeared after markup content. (razor#12741)
Other improvements
- The
html.autoClosingTagssetting is now properly honored in VS Code. (razor#12735)
v2.123.34-prerelease
This release also includes the unreleased changes from 2.122.x.
2.123.x
-
Improve error reporting UX when server encounters an error (PR: #8982)
-
Update Roslyn to 5.5.0-2.26117.2 (PR: #8982)
- Improve error handling when the server hits an unrecoverable error (PR: #82376)
- Remove deprecated IntelliCode starred-completion support from Roslyn Language Server (PR: #82411)
- Fix
GetDeconstructionInfoon converted deconstruction assignment (PR: #82324) - Fix crash in simplify linq expression (PR: #82392)
- Do not suggest using with-element in pre-C# 15 (PR: #82389)
-
Collect Razor logs (PR: #8988)
-
Update Razor to 10.0.0-preview.26115.1 (PR: #9007)
- Fix one formatting bug, and prevent another from crashing the formatter (PR: #12786)
- Fix indentation after complete tags (PR: #12784)
- Handle VS Code newline behaviour (PR: #12773)
- Fix indentation following self closing tag with lambda attribute (PR: #12727)
- Fix breakpoint placement for code blocks in the middle of documents (PR: #12741)
- Fix: Honor html.autoClosingTags setting in VS Code Cohosting (PR: #12735)
2.122.x
-
Use the package.json to gather all defined settings (PR: #8954)
-
Consolidate duplicate log collection sections in SUPPORT.md (PR: #8974)
-
Add crashDumpPath to settings that trigger restart prompt and standardize restart descriptions (PR: #8973)
-
Add command to collect memory and GC dumps (PR: #8966)
-
Add dotnet.server.environmentVariables setting for custom language server env vars (PR: #8967)
-
Pass the extension host process id to the Roslyn LSP on startup (PR: #8976)
-
Enable and switch to
Balancedsource generator execution (PR: #8970)Balancedmode improves language server performance by only running source generators on explicit actions like file save, build task execution, or thecsharp.rerunSourceGeneratorscommand. This is in contrast to the previous default,Automatic, which ran source generators on every keystroke.- The
dotnet.server.sourceGeneratorExecutionoption allows you to switch betweenBalancedandAutomaticsource generator execution (requires restart).
-
Update Roslyn to 5.5.0-2.26109.18 (PR: #8976)
- Adds
--clientProcessIdoption so server can shutdown when the parent does (PR: #82346) - Show both property and extension method items with identical name (PR: #82315)
- Add LSP server support for balanced source generator execution with refresh (PR: #82330)
- Handle change in enableFileBasedPrograms setting in the editor (PR: #82214)
- No longer recommend 'this' inside nameof in an attribute (PR: #82299)
- Fix workspace search always returning no results for first query (PR: #82276)
- Improve elimination of redundant evaluations during pattern matching operation (PR: #82142)
- Limit the FileSystemWatchers to one per drive root for DefaultFileChangeWatcher (PR: #82211)
- Reduce allocations during analysis result creation. (PR: #82139)
- Set isReferenceAssembly to false if we found the implementation assembly (PR: #82242)
- Remove console title change from language server Program.cs (PR: #82229)
- Adds