Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable verbose logging of symbol loading in vscode debug console

When running my webapp (in vscode), the debug console is filled with lines like these:

Loaded '/foo/bar/dotnet/shared/Microsoft.NETCore.App/2.2.4/System.Private.CoreLib.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

and

The thread 123 has exited with code 0 (0x0).

I thought this has something to do with log filtering in the appsettings.json file, but these don't belong to any category I can disable.

This is very annoying - how do I disable it?

like image 409
lonix Avatar asked Apr 15 '19 06:04

lonix


People also ask

How do I disable Debug console in vscode?

VS Code maintains a debug session while the program is running, and pressing the Stop button terminates the program.

How do I change Debug configuration in VS code?

Switch to the Run and Debug view (Ctrl+Shift+D) and select the create a launch. json file link. VS Code will let you select an "debugger" in order to create a default launch configuration. Pick "Mock Debug".

What is launch json in vscode?

A launch. json file is used to configure the debugger in Visual Studio Code. Visual Studio Code generates a launch. json (under a . vscode folder in your project) with almost all of the required information.


3 Answers

These logs are managed by VS Code. You can disable them in the launch.json file in the .vscode directory. You can add the following node under the configurations node to disable module load messages:

"logging": {
    "moduleLoad": false
}

There are more options available such as exceptions and programOutput, check out the Intellisense for all available options.

like image 104
Henk Mollema Avatar answered Oct 13 '22 16:10

Henk Mollema


I came to this answer looking for the same thing as the original question was. The answer provided here was correct but I did not understand where I needed to put it. So I decided to add my own answer in hopes of guiding others in the same situation...

All you need to add is the following code to your solution (or project file if you are not working with a solution).

"logging": {
    "moduleLoad": false
}

Because it was not clear to me where it needs to be added (there was two separate areas un my "configurations" node called "name": ".NET Core Launch (console)" and "name": ".NET Core Attach"), I wanted to post my entire config to make it much more clear.

"version": "0.2.0",
"configurations": [
    {
        "name": ".NET Core Launch (console)",
        "type": "coreclr",
        "request": "launch",
        "preLaunchTask": "build",
        "program": "${workspaceFolder}/bin/Debug/netcoreapp2.2/example.dll",
        "args": [],
        "cwd": "${workspaceFolder}",
        "console": "internalConsole",
        "stopAtEntry": false,
        "logging": {
            "moduleLoad": false
        }
    },
    {
        "name": ".NET Core Attach",
        "type": "coreclr",
        "request": "attach",
        "processId": "${command:pickProcess}"
    }
]
like image 22
Arvo Bowen Avatar answered Oct 13 '22 17:10

Arvo Bowen


The answer correctly explains how to disable logging in the general case (by editing .vscode/launch.json).

But that doesn't work for a debug session started from codelens:

Start debug session from codelens

In that case edit .vscode/settings.json:

"csharp.unitTestDebuggingOptions": {
  "logging": { "moduleLoad": false }
},
like image 2
lonix Avatar answered Oct 13 '22 17:10

lonix