"PDB format is not supported" with .NET portable debugging information
Asked Answered
J

1

17

The last couple of days I've been hunting down a problem - with the conclusion:

My Visual Studio 2017 debugger can't work with PDBs in "portable" format in .NET Framework projects.

With portable format I mean going to a project's settings, then to Build -> Advanced and then selecting portable under Debugging information.

When I start debugging a .NET Framework project built like this, breakpoints don't get hit.

The breakpoint will not currently be hit. No symbols have been loaded for this document.

When I pause the debugger and look for the reason why it didn't load the symbols, it says (under Symbol load information):

PDB format is not supported

I can reproduce this with any .NET Framework project. The target framework doesn't seem to matter. I tried .NET 4.5.2 and 4.6.2.

It works fine, though, for .NET Core projects.

Now, the strange thing is that the exact same project works fine on another computer.

So, it seems that my computer is missing something or has something misconfigured. But my Google search didn't turn up anything. Any ideas how to fix this problem?

Jefferson answered 31/5, 2017 at 11:56 Comment(4)
Crystal ball says that you are using the wrong debugging engine. Tools > Options > Debugging > General > ensure that the "Use Managed Compatibility Mode" is not ticked. Do consider that using the "portable" format is not yet the best selection, and should never be used when you also have C++/CLI code in the project, right now it is really only necessary for .NETCore projects that need to be debuggable on Linux or MacOS.Mangrove
@HansPassant Your crystal ball was right. I've never (consciously) seen this option. Not sure why it was enabled. By disabling it, it now works. Maybe you should convert you comment into an answer :)Jefferson
Note that the .NET "desktop" framework itself (before version 4.7.1 at least) cannot read portable pdb files. You can create them as part of the build, and debugging might work, but when creating tracebacks for exceptions, the runtime will not be able to include source file names and line numbers. So for the best debugging/runtime experience, use the "full" pdb type for the normal framework, and portable for net core/standard.Tippler
@HansPassant has the answer, or at least it worked for me. He should definitely turn this into an answer :) Thanks Hans!Bereave
T
20

You are probably using the wrong debugging engine.

Navigate: Tools > Options > Debugging > General

Ensure that the "Use Managed Compatibility Mode" is not ticked.

Trujillo answered 31/5, 2017 at 11:56 Comment(1)
@HansPassant never converted his wonderful comment to an answer, so I made it a community wiki answer. Read his comment for more insights.Trujillo

© 2022 - 2024 — McMap. All rights reserved.