microsoft / vscode-dotnettools

This is a feedback repository to capture issues logged for the C# Dev Kit and related extensions from Visual Studio Code
Other
210 stars 7 forks source link

[BUG] Debugger not loading symbols #733

Open marcoburato opened 8 months ago

marcoburato commented 8 months ago

Describe the Issue

When debugging a certain project in .NET 8, the symbols of a referenced project are not getting loaded, so breakpoints will not hit. The debug console shows:

Loaded 'MyApp.Mac'. ... Loaded 'MyApp'. Caricamento dei simboli disabilitato dall'impostazione Include/Exclude.

Translated: "Symbols loading disabled by Include/Exclude setting." (is there a way to avoid localisation of error messages?)

I don't recall experiencing this problem when I tried debugging the project built with .NET 7. The issue also doesn't happen if I try to debug a .NET 8 console app.

Steps To Reproduce

  1. Run the following code:
    dotnet new -i Eto.Forms.Templates
    mkdir MyApp
    cd MyApp
    dotnet new etoapp
    code .
  2. Add the following using directives (they're missing in the template):
    
    // Program.cs
    using System;
    using Eto.Forms;

// MainForm.cs using Eto.Forms; using Eto.Drawing;

3. Edit MyApp.Mac.csproj to target .NET 8:
<TargetFramework>net8.0</TargetFramework>

4. Add a breakpoint to MainForm.cs
5. Start debugging the MyApp.Mac project
6. Notice message on debugging console and observe how the breakpoint is greyed out

### Expected Behavior

Symbols for the referenced project assembly should get loaded and breakpoints should work.

### Environment Information

macOS 13.6.1
VScode 1.84.2
C# DevKit 1.0.14
matherm-aboehm commented 4 months ago

I get the same error message when using /p:PublishSingleFile=true option on a Windows machine. See devblog for more info about this feature. One workaround is to use <DebugType>embedded</DebugType> in main project and all projects referenced, whether directly or transitive. So that every assembly, that is inside the single file app bundle, has its debug symbols embedded into the assembly instead of information about linkage to a PDB file. Unfortunately this workaround isn't possible for NuGet package references, as most packages contain only assemblies without embedded debug symbols.