3

I have a .Net 4.7.1 framework program that I need to debug, but I can't put a breakpoint because debug symbols aren't loading. I've spent a day wasting time on this and it's getting extremely frustrating.

I've rebooted VSCode, tried generating new config files from scratch, made sure to set debug type to portalable, each time removing any stale build files, and none of these seem to have any effect.

launch.json:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "buildOptions": {
        "debugType": "portable"
    },
    "configurations": [
        {
            "name": "Launch (console)",
            "type": "coreclr",
            "request": "launch",
            "preLaunchTask": "build",
            "program": "${workspaceFolder}/bin/Debug/net471/<app>.exe",
            "args": [],
            "cwd": "${workspaceFolder}",
            "stopAtEntry": false,
            "console": "internalConsole"
        },
        {
            "name": "Test (Console)",
            "type": "coreclr",
            "request": "launch",
            "preLaunchTask": "build",
            "program": "dotnet",
            "args": [
                "test"
            ],
            "cwd": "${workspaceFolder}",
            "console": "internalConsole",
            "stopAtEntry": false
        },
        {
            "name": "Attach",
            "type": "coreclr",
            "request": "attach",
            "processId": "${command:pickProcess}"
        }
    ]
}

tasks.json:

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "label": "build",
            "type": "shell",
            "command": "dotnet", // I've also tried msbuild, but it rejects my csproj because of the "Version" attribute.
            "args": [
                "build",
                // Ask dotnet to generate full paths for file names.
                "/property:GenerateFullPaths=true",
                // Do not generate summary otherwise it leads to duplicate errors in Problems panel
                "/consoleloggerparameters:NoSummary"
            ],
            "group": "build",
            "presentation": {
                // Reveal the output only if unrecognized errors occur.
                "reveal": "silent"
            },
            // Use the standard MS compiler pattern to detect errors, warnings and infos
            "problemMatcher": "$msCompile"
        }
    ]
}

<app>.csproj:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net471</TargetFramework>
    <DebugType>portable</DebugType>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
    <PackageReference Include="NUnit" Version="3.12.0" />
    <PackageReference Include="Nunit3TestAdapter" Version="3.16.1">
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
      <PrivateAssets>all</PrivateAssets>
    </PackageReference>
    <Reference Include="System.Data.Linq" />
    <PackageReference Include="System.Net.Http" Version="4.3.4" />
    <PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
  </ItemGroup>
</Project>
Thomas
  • 871
  • 2
  • 8
  • 21
  • The community edition of visual studio is free and will just work out of the box, it would have saved you a day – TheGeneral Feb 03 '20 at 22:51
  • I've started down that road, but hit other roadblocks. I decided to focus on the problem that seems more easily solvable at the moment. Especially since I have no reason to believe that once I get VS set up that it won't have the exact same problem. – Thomas Feb 03 '20 at 22:55
  • Do you have all the pdb at the same path where the exe is. Without them debug symbols cannot be loaded. – Prateek Shrivastava Feb 03 '20 at 22:58
  • I checked, the pdb is there. The debugger just isn't loading them. – Thomas Feb 03 '20 at 23:00
  • 1
    Did u ever found a solution? – plainionist Aug 11 '21 at 05:09
  • @plainionist Unfortunately, no. I ended up having to switch to full Visual Studio anyway for other reasons and the debug symbols started working with that. – Thomas Aug 12 '21 at 14:58
  • Thx! I also tried a lot and I tend to do the same ... – plainionist Aug 12 '21 at 20:58

0 Answers0