dotnet / vscode-csharp

Official C# support for Visual Studio Code
MIT License
2.86k stars 671 forks source link

Add a way to filter/group threads in the debugger call stack view #5174

Open SeeminglyScience opened 2 years ago

SeeminglyScience commented 2 years ago

Debugging a process with a lot of idle, external only or otherwise not relevant threads can be really tedious. It would be nice if there was a launch config or workspace setting I could use to group, sort, or deemphasize certain threads.

Mock up:

{
    "name": ".NET Core Attach",
    "type": "coreclr",
    "request": "attach",
    "callStackGroups": {
        "NoCallStack": {
            "noVisibleCallStack": true,
        },
        "Tasks": {
            "name": [
                ".NET Long Running Task",
                ".NET ThreadPool Worker"
            ]
        },
        "Not Important": {
            "name": [
                "DefaultAggregationPeriodCycle",
                "CommandMessageProcessing",
                "*Logger*",
            ],
            "method": [
                "Start*Command"
            ],
            "file": [
                "**/StartEditorServicesCommand.cs"
            ]
        }
    }
}

I imagine these groups appearing under all of the unmatched thread similar to [More], Static members and Non-Public members in the variables view:

image

Unsure if the VSCode extension API allows for something like that though. If not, then flatten the above json to remove group names and use it to sort them to the bottom and de-emphasize.

Environment data

dotnet --info output:

.NET SDK (reflecting any global.json):
 Version:   7.0.100-preview.2.22153.17
 Commit:    9c52c56c13

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.19044
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\7.0.100-preview.2.22153.17\

Host (useful for support):
  Version: 7.0.0-preview.2.22152.2
  Commit:  e24f66dff0

.NET SDKs installed:
  6.0.201 [C:\Program Files\dotnet\sdk]
  6.0.202 [C:\Program Files\dotnet\sdk]
  7.0.100-preview.2.22153.17 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.0-preview.2.22153.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.24 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.16 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.0-preview.2.22152.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.1.24 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.14 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.16 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 7.0.0-preview.2.22153.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download

VS Code version:

1.66.2
dfd34e8260c270da74b5c2d86d61aee4b6d56977
x64

C# Extension version:

ms-dotnettools.csharp@1.24.4
WardenGnaw commented 2 years ago

We would need VS Code to support grouping threads at a higher level. At the moment, every Stack Trace Request is done on a single thread and each thread is shown as its own top level node in the callstack window.

Once there is support for that, it may be possible set specific threads to a thread group based on the configuration.