Debugging .NET standard libraries in UWP

Visual Studio Development WinUI

5 years ago

.NET Standard has ushered an era of effortless portability among different implementations of .NET and superseded Portable Class Libraries in every way. UWP supports .NET Standard 2.0 since the Fall Creators Update, but there is still one caveat that sometimes breaks debugging of Standard libraries in UWP.

The problem

When you debug a UWP app with a .NET Standard library, in some cases the debugger just steps over the library code and can't hit your breakpoints. This stems from the fact that the PDB debug symbol format for .NET Standard is a bit different from what UWP expects and is not able to handle it properly. And even though the issue has been reported as resolved, it seems that developers are still experiencing this issue here and there. Luckily, the workaround is simple.


By default .NET Standard uses the Portable debugging information mode. This improves performance but is usually the source of issues with UWP. If it does not work for you, you can switch to either PDB only or Full debugging modes which work as expected. You can do this in two ways: the code wizard way or the IDE wizard way, whichever you prefer.

Setting debug information in .csproj

Right-click your .NET Standard library project in Solution Explorer (Alt + W,S) and select Edit ProjectName.csproj… In the text editor add the following:

<PropertyGroup Condition="'$(Configuration)'=='Debug'">

In case there is analogous section already present, simply edit it to use either pdbonly or full debug type.

Setting debug information in project properties

Right-click your .NET Standard library project in Solution Explorer (Alt + W,S) and select Properties. Switch to the Build tab and click the Advanced... button. The dialog should offer you a Debug information drop down where you can switch from Portable to any value you prefer.


.NET Standard is a great solution for many problems cross-platform developers were facing when building libraries targeting multiple different versions of .NET. In case of UWP the debug information is a caveat which is good to be aware of, as it will save you a lot of unnecessary headscratching.