Lost
Lost

Reputation: 13595

Visual Studio Code .NET Core project shows verbose debug console messages

I am new to Visual Studio Code. However, one thing thing that I noticed with one of the projects that I have is really bugging me. Whenever, I run the project in Visual Studio Code using its in-built debugger, it shows me a message which looks like following:

Loaded /usr/local/share/dotnet/shared/Microsoft.NETCore.App/2.0.0/System.Private.CoreLib.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enable

And it shows that message for each DLL file that I have referenced. This causes huge amount of unwarranted logs in my Debug Console.

Upvotes: 8

Views: 5178

Answers (2)

ps2goat
ps2goat

Reputation: 8475

Applies to dotnet core 2.2, reverified with .NET 7 [Core]; unverified anywhere else

I just found a way to get rid of most of this noise using the logging options. Unfortunately, I still see some program output like thread info because we currently have logging going to the console. I haven't completely set it up the way I like, but this works better for now.

In ./.vscode/launch.json, add the logging options to your config:

"configurations": [
        {
            "name": "Your config name",
            "type": "coreclr",
            "request": "launch",
            "logging": {
                "engineLogging": false,
                "moduleLoad": false,
                "exceptions": false,
                "browserStdOut": false
            },
// ... the rest of your existing config. surrounding code shown for placement purposes.

You may still want exceptions output to the console, but so far I've found that even handled exceptions are being logged. I want to ignore those, so I've set exceptions to false here.

Updated 2023-08-14 - Visual Studio configuration

User ditoslav asked about how to configure these for Visual Studio. Well, today I'm using VS 2022 and looked into it. I'm assuming it's the same for VS 2019.

  1. Use the app menu: Debug -> Options (at the bottom of my list). This takes you to the debug section of the regular settings window.
  2. Under the Debugging section, click Output Window
  3. Step 2 updates the right half of the window (assuming all regions are set up the same). Set these to Off as you see fit-- this fixed it for me.

Before Before

After After

ALT: I turned the following options to off under General Output Settings:

  • Module Load Messages
  • Module Symbol Search Messages
  • Module Unload Messages
  • Step Filtering Messages
  • Thread Exit Messages (This could be useful, though)

Upvotes: 16

hce
hce

Reputation: 1167

For Visual Studio Code:

Use omnisharp-vscode for .net core development which gives you the possibilty to customize
debugger launch with a json file.
For example, you could use the following options:

    "justMyCode":false*
    "symbolOptions": {
    "searchPaths": [
        "~/src/MyOtherProject/bin/debug",
        "https://my-companies-symbols-server"
    ],
    "searchMicrosoftSymbolServer": true,
    "cachePath": "/symcache",
    "moduleFilter": {
        "mode": "loadAllButExcluded",
        "excludedModules": [ "DoNotLookForThisOne*.dll" ]
       }
    }

For Visual Studio:

You could get rid of it, when you load the symbol files (pdb). When debugging, you could open the Module window (Debug -> Windows -> Module) and right click the module whose symbols is not loaded and then select Load Symbols...

If you want to disable "just my code", please open Tools -> options -> Debugging -> General and clear the checkbox "Enable Just my code (Managed only)"

Upvotes: 1

Related Questions