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)