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?
VS Code maintains a debug session while the program is running, and pressing the Stop button terminates the program.
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".
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.
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.
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}"
}
]
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:
In that case edit .vscode/settings.json
:
"csharp.unitTestDebuggingOptions": {
"logging": { "moduleLoad": false }
},
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With