Cannot load native DLL symbols when running as a WinUI3 nonpackaged desktop app

Cohn, Robert 21 Reputation points
2022-03-03T18:24:58.07+00:00

Hi -

Using Visual Studio 2022, we're developing a WinUI3 desktop unpackaged app in C# that loads a Native C++ DLL. When we were building as a packaged (deployable) app, I was able to set breakpoints in the DLL and debug that code.

Then we decided to build the WinUI3 app unpackaged. The built app runs fine, and I can debug in the C# code. But now, none of the DLL symbols are being loaded. I've checked to make sure that I am producing those symbols in the DLL's pdb file, and that the DLL is referenced properly.

I've tried setting VS2022 Debugging properties (including the path to the pdb file, and the "Load debug symbols in external process (Native only)" option). The native project is built with the /Zi flag to generate full path to the symbols.

What am I missing to get the native symbols to be loaded?

Thanks very much for your feedback.

Windows App SDK
Windows App SDK
A set of Microsoft open-source libraries, frameworks, components, and tools to be used in apps to access Windows platform functionality on many versions of Windows. Previously known as Project Reunion.
750 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Cohn, Robert 21 Reputation points
    2022-03-04T00:34:02.377+00:00

    I found the problem. VS wasn't in mixed-mode debugging.
    Select: Debug | projname Debug Properties
    Opens a dialog: Launch Profiles

    Make sure the profile: projname (Unpackaged) is listed
    Scroll down to Enable native code debugging
    Check the box next to Enable debugging for managed and native code together, also known as mixed-mode debugging.
    The project file that supports this is called: launchSettings.json

    0 comments No comments