Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to turn off the DLL loading messages when running C# in vscode via vsdbg?

I am an experienced C# developer but new to C# in VSCode and on Mac.

When I debug my C# console application, (which is not much more than a Hello World at this point), I am presented with with pages upon pages of useless output about the dozens of DLL's that are being loaded:

-------------------------------------------------------------------
You may only use the Microsoft .NET Core Debugger (vsdbg) with
Visual Studio Code, Visual Studio or Visual Studio for Mac software
to help you develop and test your applications.
-------------------------------------------------------------------
Loaded '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/2.2.5/System.Private.CoreLib.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/2.2.5/System.Runtime.dll'. Module was built without symbols.
Loaded '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/2.2.5/System.Threading.Tasks.dll'. Module was built without symbols.
Loaded '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/2.2.5/System.Console.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/2.2.5/System.Net.Requests.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/2.2.5/System.Runtime.Extensions.dll'. Module was built without symbols.
Loaded '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/2.2.5/System.Net.Http.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
... etc.

Somewhere buried after all of this is the actual interesting output of my program, and I find it annoying to have to keep scrolling through all of this garbage.

Is there a way to turn off the DLL loading messages, or filter them out? I searched the C# settings in VSCode, searched VSCode's github issues, and messed around with various settings within the output window itself, but could not find an answer to what should be something every developer would want to know, because I can't imagine anyone is too fond of reading this every time they run their program.

It does already colour these DLL messages differently, in a wonderful shade of orange-brown. Given that VSCode knows they are something different than the regular output it seems promising that there may be a way to filter them out, but how to do it is not obvious to me.

like image 495
uglycoyote Avatar asked May 28 '19 05:05

uglycoyote


People also ask

How do I turn off Debug mode in VS code?

To end a debugging session in Microsoft Visual Studio, from the Debug menu, choose Stop Debugging.

How do I disable debugging in Visual Studio 2010?

Select Stop debugging from Debug menu to end a debugging session. You also can stop debugging from the processes window. In that window, right-click the executing process and select the Detach Process or Terminate Process command.

How do I enable debugging in Visual Studio?

In the Visual Studio toolbar, make sure the configuration is set to Debug. To start debugging, select the profile name in the toolbar, such as <project profile name>, IIS Express, or <IIS profile name> in the toolbar, select Start Debugging from the Debug menu, or press F5.


1 Answers

You can disable these messages through launch.json options.

Simply add to your configuration a new object with the key "logging". Here you have different options available. The one you are looking for is "moduleLoad". Set it to false and the messages should disappear.

Example Configuration

{
    "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
    }
}

Documentation

You can find more information in the omnisharp repository about it -> LINK.

like image 52
insertcoin Avatar answered Oct 07 '22 15:10

insertcoin