This project uses GitHub Issues to track bugs and feature requests. Please search the existing issues before filing new issues to avoid duplicates. For new issues, file your bug or feature request as a new Issue.
This repository tracks issues related to the C# extension. Any issues related to the C# editing experience, Roslyn language server and other basic C# functionality should be filed here (regardless of if you're using C# Dev Kit or not).
For C# Dev Kit only features such as the Solution Explorer, Test Window, etc, please see https://github.com/microsoft/vscode-dotnettools/blob/main/SUPPORT.md
For help and questions about using this project, please see the README.
We highly recommend using the C# extension's built-in command, CSharp: Report an issue (csharp.reportIssue) to create a pre-filled issue template. This will include helpful details such as local dotnet installations, installed extensions, and other information.
When investigating issues, the C# extension provides a command to collect logs, activity logs, traces, and dumps. This is the recommended way to collect diagnostic information as it automatically captures all relevant files in a single archive.
-
Invoke the Collect Logs Command:
- Open the Command Palette (
Ctrl+Shift+PorCmd+Shift+Pon macOS). - Search for and select
CSharp: Collect C# Logs(csharp.collectLogs).
- Open the Command Palette (
-
Select Additional Logs to Collect:
- You will be presented with a multi-select picker. Choose from:
- Record Activity - Capture live C#, LSP trace, and Razor log output
- Performance Trace - Record a dotnet-trace of the language server
- Memory Dump - Process memory dump using dotnet-dump
- GC Dump - Garbage collector heap dump using dotnet-gcdump
- You will be presented with a multi-select picker. Choose from:
-
Customize Arguments:
- For each selected tool (dotnet-trace, dotnet-dump, dotnet-gcdump), you will be prompted to review and customize the arguments.
-
Choose Where to Save:
- You will be prompted to choose a save location for the log archive. Choose a location to save the
.zipfile.
- You will be prompted to choose a save location for the log archive. Choose a location to save the
-
Reproduce the Issue:
- If you selected Record Activity or Performance Trace, a notification will appear indicating that recording is in progress.
- While the notification is visible, perform the actions that reproduce the issue.
- The extension automatically sets the log level to
Traceduring capture to collect detailed information. - Click the
Cancelbutton on the notification to stop recording.
-
Zip File is Saved:
- You will be notified that the archive has been saved and a button is provided to open the containing folder.
-
Share the Logs:
- The saved archive may contain (depending on selections):
csharp.log- The existing C# log filecsharp-lsp-trace.log- The existing LSP trace log filerazor.log- The existing Razor log filecsharp.activity.log- Captured C# log activity during the recording sessioncsharp-lsp-trace.activity.log- Captured LSP trace activity during the recording sessionrazor.activity.log- Captured Razor log activity during the recording sessioncsharp-settings.json- Current C# extension settings.nettracefile from dotnet-trace (if Performance Trace selected).dmpmemory dump files (if Memory Dump selected).gcdumpGC dump files (if GC Dump selected)
- Attach the archive to your GitHub issue or share it privately (see Sharing information privately).
- The saved archive may contain (depending on selections):
Warning
The logs may contain file paths, project names, and other workspace information. Review the contents before sharing publicly.
If you need to set the trace level manually:
-
In the C# output window (
View->Output), set the log level toTrace. -
In the C# LSP Trace Logs output window, set the log level to
Trace.
Other Ways to Set the Log Level:
- When launching VS Code from the CLI, pass the
--log ms-dotnettools.csharp:traceparameter. - Invoke the
Developer: Set Log Levelcommand from the VS Code command palette, find theC#entry, and set the level.
For issues with Razor, the Razor Log output window can contain useful information.
-
Set the Log Level to Trace:
-
Reproduce the Issue:
- Perform the actions that reproduce the issue.
-
Copy the Logs:
- Select all contents of the window (e.g.,
Ctrl+A) and paste them into the GitHub issue when requested.
- Select all contents of the window (e.g.,
-
Reset the Log Level:
- Once the logs are collected, reset the log level to
Info.
- Once the logs are collected, reset the log level to
Missing language features are often caused by a failure to load the project(s) or solution. To diagnose and resolve these issues, follow these steps:
-
Provide General Logs:
- Include the information from the issue template and the general logs (see the "Capturing activity trace logging" section above). These logs are essential for troubleshooting.
-
Check the Active Project Context:
-
Verify the Solution Explorer (C# Dev Kit):
- If you are using C# Dev Kit, check the Solution Explorer to ensure the project is displayed with the expected references.
- If the references or structure are not as expected, include the contents of the
Projectsoutput window in your issue report.
When troubleshooting project load problems, collecting MSBuild binary logs from design-time builds can provide additional diagnostic detail.
-
Configure the binary log path:
- Open VS Code settings.
- Set
dotnet.projects.binaryLogPathto a writable folder where logs should be saved. - You can set this in your
settings.json, for example:
{ "dotnet.projects.binaryLogPath": "C:\\temp\\csharp-binlogs" } -
Reload and reproduce:
- Reload VS Code (or reopen the workspace) after changing the setting.
- Reproduce the project load issue so the extension performs design-time builds.
-
Collect the generated
.binlogfiles:- After reproducing the issue, check the configured folder for new
.binlogfiles. - Attach relevant binary logs to the GitHub issue, or share them privately (see Sharing information privately).
- After reproducing the issue, check the configured folder for new
Warning
Binary logs can contain machine-specific and workspace-specific information (for example file paths and project details). Review logs before sharing publicly.
If you encounter issues with document classification (e.g., incorrect syntax highlighting or colorization), please provide the following information to help us diagnose the problem:
-
Theme in Use:
- Specify the name of the theme you are currently using in VSCode (e.g., "Dark+", "Light+", or a custom theme).
-
Tokens and Scope Information:
-
The
Developer: Inspect Editor Tokens and Scopescommand shows information about the problematic word or section:- Open the Command Palette (
Ctrl+Shift+PorCmd+Shift+Pon macOS). - Search for and select
Developer: Inspect Editor Tokens and Scopes(editor.action.inspectTMScopes). - Click on the word or section with incorrect colorization to display the token and scope information.
- Open the Command Palette (
-
Take a screenshot of the output and include it in your issue report.
-
For issues with diagnostics, please provide values of the background analysis scope options, dotnet.backgroundAnalysis.analyzerDiagnosticsScope and dotnet.backgroundAnalysis.compilerDiagnosticsScope
If the language server crashes, general logs are often helpful for diagnosing the issue. However, in some cases, logs alone may not provide enough information and we may need a crash dump. Follow these steps to collect a crash dump:
- Set the
dotnet.server.crashDumpPathsetting in VSCode to a user-writable folder where crash dumps can be saved. - Reproduce the issue
- When the server crashes, a dump in the specified folder will be created.
Warning
The dump will contain detailed information about the workspace. See Sharing information privately
Detailed logs, dumps, traces, and other information can sometimes contain private information that you do not wish to share publicly on GitHub (for example file paths and file contents). Instead, you can utilize the Developer Community page to share these privately to Microsoft.
- Go to https://developercommunity.visualstudio.com/dotnet/report
- Fill in the issue title, reference the GitHub issue in the description, and upload the attachments. Note that there is a 2 GB limit on attached files. Dumps can often be larger than that, so we recommend compressing them to a
.zipbefore uploading.
4. Once created, a comment on the GitHub issue a link to the new Developer Community ticket.
Support for this project is limited to the resources listed above.







