Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
- Use `test/*/integrationTests/integrationHelpers.ts` for test setup utilities
- Tests use Jest with VS Code test environment and require workspace test assets
- Run with `npm run test:integration:*` commands (e.g., `npm run test:integration:csharp`)
- **Comments**: Prefer why comments over what comments. For complex logic, include references to related files or documentation. Do not remove existing comments unless they are clearly outdated or incorrect.

## Integration Points
- **GitHub Copilot**: Extension registers C# context and related files providers if Copilot/Copilot Chat extensions are present.
Expand Down
98 changes: 27 additions & 71 deletions SUPPORT.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,30 +18,44 @@ We highly recommend using the C# extension's built-in command, `CSharp: Report a

#### Capturing activity trace logging

When investigating issues, the C# extension provides a command to capture trace-level logs while you reproduce the issue. This is the recommended way to collect logs as it automatically captures all relevant log files in a single archive.
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.

1. **Invoke the Capture Logs Command**:
1. **Invoke the Collect Logs Command**:
- Open the Command Palette (`Ctrl+Shift+P` or `Cmd+Shift+P` on macOS).
- Search for and select `CSharp: Capture Logs` (`csharp.captureLogs`).
![alt text](docs/images/captureLogsCommand.png)
2. **Reproduce the Issue**:
- A notification will appear indicating that logs are being captured.
- Search for and select `CSharp: Collect C# Logs` (`csharp.collectLogs`).

![alt text](docs/images/collect_logs.png)
2. **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

![alt text](docs/images/choose_additional_logs.png)
3. **Customize Arguments**:
- For each selected tool (dotnet-trace, dotnet-dump, dotnet-gcdump), you will be prompted to review and customize the arguments.
4. **Choose Where to Save**:
- You will be prompted to choose a save location for the log archive. Choose a location to save the `.zip` file.
4. **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 `Trace` during capture to collect detailed information.

3. **Stop Capturing and Save**:
- Click the `Cancel` button on the notification to stop capturing.
- You will be prompted to save the log archive. Choose a location to save the `.zip` file.

4. **Share the Logs**:
- The saved archive contains:
- Click the `Cancel` button on the notification to stop recording.
5. **Zip File is Saved**:
- You will be notified that the archive has been saved and a button is provided to open the containing folder.
6. **Share the Logs**:
- The saved archive may contain (depending on selections):
- `csharp.log` - The existing C# log file
- `csharp-lsp-trace.log` - The existing LSP trace log file
- `razor.log` - The existing Razor log file
- `csharp.activity.log` - Captured C# log activity during the recording session
- `csharp-lsp-trace.activity.log` - Captured LSP trace activity during the recording session
- `razor.activity.log` - Captured Razor log activity during the recording session
- `csharp-settings.json` - Current C# extension settings
- `.nettrace` file from dotnet-trace (if Performance Trace selected)
- `.dmp` memory dump files (if Memory Dump selected)
- `.gcdump` GC dump files (if GC Dump selected)
- Attach the archive to your GitHub issue or share it privately (see [Sharing information privately](#sharing-information-privately)).

> [!WARNING]
Expand Down Expand Up @@ -128,64 +142,6 @@ If the language server crashes, general logs are often helpful for diagnosing th
> [!WARNING]
> The dump will contain detailed information about the workspace. See [Sharing information privately](#sharing-information-privately)

### Recording a language server trace

When investigating performance issues, we may request a performance trace of the language server to diagnose what is causing the problem. These are typically taken via [dotnet-trace](https://learn.microsoft.com/en-us/dotnet/core/diagnostics/dotnet-trace) (a cross platform tool to collect performance traces of .NET processes)

The C# extension has a built in command, `csharp.recordLanguageServerTrace` to help with trace collection. This command will install `dotnet-trace` as a global tool, invoke it against the language server, and package the results along with logs into a `.zip` archive.

1. Invoke the record language server trace command.
![alt text](docs/images/recordTraceCommand.png)
2. Accept the default trace arguments, or change them if requested.
![alt text](docs/images/dotnetTraceArguments.png)
3. Optionally select dump(s) to capture before and after the trace (Memory Dump and/or GC Dump). This is useful for comparing memory state before and after the trace.
![alt text](docs/images/selectDumpsWithTrace.png)
4. If any dumps are selected, you will be prompted to customize the dump arguments.
![alt text](docs/images/dotnetDumpArguments.png)
![alt text](docs/images/dotnetGcDumpArguments.png)
5. Choose a location to save the trace archive (`.zip` file).
6. A new terminal window will open to run the trace collection. While the trace is running, reproduce the performance issue. When done, hit <Enter> or <Ctrl+C> in the trace window to stop the trace, or click `Cancel` on the progress notification.
![alt text](docs/images/recordTraceTerminal.png)
7. The extension will automatically package the trace, logs, and any dumps into an archive.
8. Attach the archive to your GitHub issue or share it privately (see [Sharing information privately](#sharing-information-privately)).

The saved archive contains:
- The `.nettrace` file from dotnet-trace
- `csharp.log` - The existing C# log file
- `csharp-lsp-trace.log` - The existing LSP trace log file
- `razor.log` - The existing Razor log file
- `csharp.activity.log` - Captured C# log activity during the trace session
- `csharp-lsp-trace.activity.log` - Captured LSP trace activity during the trace session
- `razor.activity.log` - Captured Razor log activity during the trace session
- `csharp-settings.json` - Current C# extension settings
- Any memory dumps (`.dmp`) or GC dumps (`.gcdump`) captured before/after the trace

> [!WARNING]
> The trace and logs will contain detailed information about the workspace. See [Sharing information privately](#sharing-information-privately)

### Collecting a dump

When investigating memory issues or hangs, we may request a dump of the language server. There are two types of dumps available:

- **Memory Dump**: A full process memory dump collected via [dotnet-dump](https://learn.microsoft.com/en-us/dotnet/core/diagnostics/dotnet-dump). Use this for investigating hangs or detailed memory analysis.
- **GC Dump**: A garbage collector heap dump collected via [dotnet-gcdump](https://learn.microsoft.com/en-us/dotnet/core/diagnostics/dotnet-gcdump). These are smaller than full memory dumps and focus on managed heap information. Use this for investigating memory leaks or object retention issues.

The C# extension has a built in command, `csharp.collectDump` to help with dump collection. This command will install the necessary dotnet tools, invoke them against the language server, and package the result into a `.zip` archive.

1. Invoke the collect dump command by opening the Command Palette (`Ctrl+Shift+P` or `Cmd+Shift+P` on macOS) and selecting `CSharp: Collect a dump of the C# Language Server`.
![alt text](docs/images/collectDumpCommand.png)
2. Select which dumps to collect (Memory Dump and/or GC Dump). The archive will also include current C# extension log files and settings.
![alt text](docs/images/selectDumpTypes.png)
3. You will be prompted to customize the dump arguments.
![alt text](docs/images/dotnetDumpArguments.png)
![alt text](docs/images/dotnetGcDumpArguments.png)
4. Choose a location to save the archive (`.zip` file).
5. The extension will collect the selected content and package it into an archive.
6. Attach the archive to your GitHub issue or share it privately (see [Sharing information privately](#sharing-information-privately)).

> [!WARNING]
> Dumps will contain detailed information about the workspace, including file contents loaded in memory. See [Sharing information privately](#sharing-information-privately)

### 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.

Expand Down
Binary file removed docs/images/captureLogsCommand.png
Binary file not shown.
Binary file added docs/images/choose_additional_logs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/images/collectDumpCommand.png
Binary file not shown.
Binary file added docs/images/collect_logs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/images/recordTraceCommand.png
Binary file not shown.
Binary file removed docs/images/selectDumpTypes.png
Binary file not shown.
Binary file removed docs/images/selectDumpsWithTrace.png
Binary file not shown.
87 changes: 22 additions & 65 deletions l10n/bundle.l10n.json
Original file line number Diff line number Diff line change
Expand Up @@ -171,33 +171,6 @@
"Failed to change context for {0}: {1}": "Failed to change context for {0}: {1}",
"Select project context": "Select project context",
"C# configuration has changed. Would you like to reload the window to apply your changes?": "C# configuration has changed. Would you like to reload the window to apply your changes?",
"Language server process not found, ensure the server is running.": "Language server process not found, ensure the server is running.",
"Capture Dumps With Trace": "Capture Dumps With Trace",
"Optionally select dump(s) to capture before and after the trace": "Optionally select dump(s) to capture before and after the trace",
"Save Trace and Logs": "Save Trace and Logs",
"Folder for trace file {0} does not exist/{0} is the folder path": {
"message": "Folder for trace file {0} does not exist",
"comment": [
"{0} is the folder path"
]
},
"Failed to execute dotnet-trace command: {0}/dotnet-trace is a command name and should not be localized": {
"message": "Failed to execute dotnet-trace command: {0}",
"comment": [
"dotnet-trace is a command name and should not be localized"
]
},
"Open Folder": "Open Folder",
"C# logs saved successfully.": "C# logs saved successfully.",
"Verifying dotnet-trace.../dotnet-trace is a command name and should not be localized": {
"message": "Verifying dotnet-trace...",
"comment": [
"dotnet-trace is a command name and should not be localized"
]
},
"Required dump tools could not be installed.": "Required dump tools could not be installed.",
"Recording logs... Click Cancel to stop and save.": "Recording logs... Click Cancel to stop and save.",
"Creating archive...": "Creating archive...",
"Collecting memory dump...": "Collecting memory dump...",
"Collecting GC dump...": "Collecting GC dump...",
"Memory Dump": "Memory Dump",
Expand All @@ -217,52 +190,36 @@
]
},
"You can modify the default arguments if needed": "You can modify the default arguments if needed",
"Install": "Install",
"{0} not found, run \"{1}\" to install it?/{0} is the tool name and should not be localized{1} is the install command": {
"message": "{0} not found, run \"{1}\" to install it?",
"comment": [
"{0} is the tool name and should not be localized",
"{1} is the install command"
]
},
"Installing {0}.../{0} is the tool name and should not be localized": {
"message": "Installing {0}...",
"comment": [
"{0} is the tool name and should not be localized"
]
},
"Failed to install {0}, it may need to be manually installed. See C# output for details./{0} is the tool name and should not be localized": {
"message": "Failed to install {0}, it may need to be manually installed. See C# output for details.",
"comment": [
"{0} is the tool name and should not be localized"
]
},
"Select Dump Type": "Select Dump Type",
"Choose dump type(s) to collect": "Choose dump type(s) to collect",
"Save Dump": "Save Dump",
"Folder for dump file {0} does not exist/{0} is the folder path": {
"message": "Folder for dump file {0} does not exist",
"comment": [
"{0} is the folder path"
]
},
"Collect Dump": "Collect Dump",
"Failed to collect dump: {0}/{0} is the error message": {
"message": "Failed to collect dump: {0}",
"Language server process not found, ensure the server is running.": "Language server process not found, ensure the server is running.",
"Failed to collect logs: {0}/{0} is the error message": {
"message": "Failed to collect logs: {0}",
"comment": [
"{0} is the error message"
]
},
"Dump saved successfully.": "Dump saved successfully.",
"Verifying tools...": "Verifying tools...",
"Capturing C# Logs": "Capturing C# Logs",
"Open Folder": "Open Folder",
"C# logs saved successfully.": "C# logs saved successfully.",
"Record Activity": "Record Activity",
"Capture live C#, LSP trace, and Razor log output": "Capture live C#, LSP trace, and Razor log output",
"Records verbose extension logging and stops when canceled.": "Records verbose extension logging and stops when canceled.",
"Performance Trace": "Performance Trace",
"Record a dotnet-trace of the language server": "Record a dotnet-trace of the language server",
"Captures runtime events from the language server process until canceled.": "Captures runtime events from the language server process until canceled.",
"Creates a full process dump for troubleshooting and analysis.": "Creates a full process dump for troubleshooting and analysis.",
"Captures managed heap information for investigating memory issues.": "Captures managed heap information for investigating memory issues.",
"Collect C# Logs": "Collect C# Logs",
"Select additional logging to collect": "Select additional logging to collect",
"Save Logs": "Save Logs",
"Failed to save C# logs: {0}/{0} is the error message": {
"message": "Failed to save C# logs: {0}",
"Output folder {0} does not exist/{0} is the folder path": {
"message": "Output folder {0} does not exist",
"comment": [
"{0} is the error message"
"{0} is the folder path"
]
},
"Creating archive...": "Creating archive...",
"Recording trace... Click Cancel to stop and save.": "Recording trace... Click Cancel to stop and save.",
"Recording logs... Click Cancel to stop and save.": "Recording logs... Click Cancel to stop and save.",
"Collecting C# Logs": "Collecting C# Logs",
"Generated document not found": "Generated document not found",
"Nested Code Action": "Nested Code Action",
"Fix All: ": "Fix All: ",
Expand Down
16 changes: 2 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1952,20 +1952,8 @@
"enablement": "isWorkspaceTrusted && dotnet.server.activationContext == 'OmniSharp'"
},
{
"command": "csharp.recordLanguageServerTrace",
"title": "%command.csharp.recordLanguageServerTrace%",
"category": "CSharp",
"enablement": "isWorkspaceTrusted && (dotnet.server.activationContext == 'Roslyn' || dotnet.server.activationContext == 'RoslynDevKit')"
},
{
"command": "csharp.captureLogs",
"title": "%command.csharp.captureLogs%",
"category": "CSharp",
"enablement": "isWorkspaceTrusted && (dotnet.server.activationContext == 'Roslyn' || dotnet.server.activationContext == 'RoslynDevKit')"
},
{
"command": "csharp.collectDump",
"title": "%command.csharp.collectDump%",
"command": "csharp.collectLogs",
"title": "%command.csharp.collectLogs%",
"category": "CSharp",
"enablement": "isWorkspaceTrusted && (dotnet.server.activationContext == 'Roslyn' || dotnet.server.activationContext == 'RoslynDevKit')"
},
Expand Down
6 changes: 2 additions & 4 deletions package.nls.cs.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
{
"command.csharp.attachToProcess": "Připojení k procesu .NET 5+ nebo .NET Core",
"command.csharp.captureLogs": "Zachytávat výstup protokolu",
"command.csharp.collectLogs": "Collect C# Logs",
"command.csharp.changeProjectContext": "Změna kontextu projektu aktivního dokumentu",
"command.csharp.changeProjectContextEditor": "Vybrat kontext projektu",
"command.csharp.changeProjectContextFileExplorer": "Vybrat kontext projektu",
"command.csharp.collectDump": "Shromáždit výpis paměti jazykového serveru C#",
"command.csharp.downloadDebugger": "Stáhnout ladicí program .NET Core",
"command.csharp.listProcess": "Vypsat proces pro připojení",
"command.csharp.listRemoteDockerProcess": "Výpis procesů v připojení Dockeru",
"command.csharp.listRemoteProcess": "Vypsat procesy pro připojení na vzdáleném připojení",
"command.csharp.recordLanguageServerTrace": "Záznam trasování výkonu jazykového serveru C#",
"command.csharp.reportIssue": "Nahlásit problém",
"command.csharp.rerunSourceGenerators": "Znovu spustit zdrojové generátory",
"command.csharp.showDecompilationTerms": "Zobrazit smlouvu o podmínkách dekompilátoru",
Expand Down Expand Up @@ -267,4 +265,4 @@
"generateOptionsSchema.targetOutputLogPath.description": "Při nastavení této možnosti se text, který cílová aplikace zapisuje do stdout a stderr (např. Console.WriteLine), uloží do zadaného souboru. Tato možnost se bude ignorovat, pokud je konzola nastavená na jinou hodnotu než internalConsole. Příklad: ${workspaceFolder}/out.txt",
"generateOptionsSchema.type.markdownDescription": "Typ kódu, který se má ladit. Může to být buď coreclr pro ladění .NET Core, nebo cclr pro Desktop .NET Framework. clr funguje pouze v systému Windows, protože Desktop Framework je určen pouze pro Windows.",
"viewsWelcome.debug.contents": "[Generování prostředků jazyka C# pro sestavení a ladění](command:dotnet.generateAssets)\r\n\r\nDalší informace o souboru launch.json najdete v tématu [Konfigurace souboru launch.json pro ladění v jazyce C#](https://aka.ms/VSCode-CS-LaunchJson)."
}
}
Loading
Loading