maui: Default VS symbol loading mechanism does not work

Description

pdbs should be published in a way which is easily consumable with VS default Symbol server, respective with SourceLink.
Currently it’s not easy/obvious to comsune the pdbs.

image

Steps to Reproduce

  1. create a maui app via VS 17.4 Preview 3
  2. update target-framework to net7 in csproj
  3. enable default symbol servers
  4. uncheck “just my code”
  5. start maui app
  6. open modules window
  7. select microsoft.maui.controls.dll
  8. rightclick -> “load symbols”

Expected Result: symbols are loaded (from nuget or symbol server)

Actual Result: no symbols can be loaded, because none are found

Link to public reproduction project repository

n/a

Version with bug

assembly-version: 7.00.0.269

Last version that worked well

i think, it never worked in maui.

Affected platforms

iOS, Android, Windows, macOS

Affected platform versions

assembly-version: 7.00.0.269

Did you find any workaround?

manually select the pdb from C:\Program Files\dotnet\packs\Microsoft.Maui.Controls.Runtime.win\7.0.0-rc.1.6683\lib\net7.0-windows10.0.19041

Relevant log output

C:\Users\juwens\source\repos\MauiAppValueTypeConversionExample\MauiAppMassConversionExample\bin\Debug\net7.0-windows10.0.19041.0\win10-x64\AppX\Microsoft.Maui.Controls.pdb: Cannot find or open the PDB file.
C:\Users\juwens\source\repos\MauiAppValueTypeConversionExample\MauiAppMassConversionExample\bin\Debug\net7.0-windows10.0.19041.0\win10-x64\AppX\Microsoft.Maui.Controls.pdb: Cannot find or open the PDB file.
D:\a\_work\1\s\src\Controls\src\Core\obj\Release\net7.0-windows10.0.19041\Microsoft.Maui.Controls.pdb: Cannot find or open the PDB file.
C:\Users\juwens\AppData\Local\Temp\SymbolCache\Microsoft.Maui.Controls.pdb\c6f2c1b347ce4b3183e4848f501c9a2cffffffff\Microsoft.Maui.Controls.pdb: Cannot find or open the PDB file.
C:\Users\juwens\AppData\Local\Temp\SymbolCache\MicrosoftPublicSymbols\Microsoft.Maui.Controls.pdb\c6f2c1b347ce4b3183e4848f501c9a2cffffffff\Microsoft.Maui.Controls.pdb: Cannot find or open the PDB file.
C:\Users\juwens\AppData\Local\Temp\SymbolCache\Microsoft.Maui.Controls.pdb\c6f2c1b347ce4b3183e4848f501c9a2c1\Microsoft.Maui.Controls.pdb: Cannot find or open the PDB file.
C:\Users\juwens\AppData\Local\Temp\SymbolCache\MicrosoftPublicSymbols\Microsoft.Maui.Controls.pdb\c6f2c1b347ce4b3183e4848f501c9a2c1\Microsoft.Maui.Controls.pdb: Cannot find or open the PDB file.
SYMSRV:  BYINDEX: 0x29
         C:\Users\juwens\AppData\Local\Temp\SymbolCache*https://referencesource.microsoft.com/symbols
         Microsoft.Maui.Controls.pdb
         C6F2C1B347CE4B3183E4848F501C9A2Cffffffff


SYMSRV:  UNC: C:\Users\juwens\AppData\Local\Temp\SymbolCache\Microsoft.Maui.Controls.pdb\C6F2C1B347CE4B3183E4848F501C9A2Cffffffff\Microsoft.Maui.Controls.pdb - path not found
SYMSRV:  UNC: C:\Users\juwens\AppData\Local\Temp\SymbolCache\Microsoft.Maui.Controls.pdb\C6F2C1B347CE4B3183E4848F501C9A2Cffffffff\Microsoft.Maui.Controls.pd_ - path not found
SYMSRV:  UNC: C:\Users\juwens\AppData\Local\Temp\SymbolCache\Microsoft.Maui.Controls.pdb\C6F2C1B347CE4B3183E4848F501C9A2Cffffffff\file.ptr - path not found
SYMSRV:  HTTPGET: /symbols/Microsoft.Maui.Controls.pdb/C6F2C1B347CE4B3183E4848F501C9A2Cffffffff/Microsoft.Maui.Controls.pdb
SYMSRV:  HttpQueryInfo: 80190194 - HTTP_STATUS_NOT_FOUND
SYMSRV:  HTTPGET: /symbols/Microsoft.Maui.Controls.pdb/C6F2C1B347CE4B3183E4848F501C9A2Cffffffff/Microsoft.Maui.Controls.pd_
SYMSRV:  HttpQueryInfo: 80190194 - HTTP_STATUS_NOT_FOUND
SYMSRV:  HTTPGET: /symbols/Microsoft.Maui.Controls.pdb/C6F2C1B347CE4B3183E4848F501C9A2Cffffffff/file.ptr
SYMSRV:  HttpQueryInfo: 80190194 - HTTP_STATUS_NOT_FOUND
SYMSRV:  RESULT: 0x80190194
SYMSRV:  BYINDEX: 0x2A
         C:\Users\juwens\AppData\Local\Temp\SymbolCache*https://referencesource.microsoft.com/symbols
         Microsoft.Maui.Controls.pdb
         C6F2C1B347CE4B3183E4848F501C9A2C1
SYMSRV:  UNC: C:\Users\juwens\AppData\Local\Temp\SymbolCache\Microsoft.Maui.Controls.pdb\C6F2C1B347CE4B3183E4848F501C9A2C1\Microsoft.Maui.Controls.pdb - file not found
SYMSRV:  UNC: C:\Users\juwens\AppData\Local\Temp\SymbolCache\Microsoft.Maui.Controls.pdb\C6F2C1B347CE4B3183E4848F501C9A2C1\Microsoft.Maui.Controls.pd_ - file not found
SYMSRV:  UNC: C:\Users\juwens\AppData\Local\Temp\SymbolCache\Microsoft.Maui.Controls.pdb\C6F2C1B347CE4B3183E4848F501C9A2C1\file.ptr - file not found
SYMSRV:  HTTPGET: /symbols/Microsoft.Maui.Controls.pdb/C6F2C1B347CE4B3183E4848F501C9A2C1/Microsoft.Maui.Controls.pdb
SYMSRV:  HttpQueryInfo: 80190194 - HTTP_STATUS_NOT_FOUND
SYMSRV:  HTTPGET: /symbols/Microsoft.Maui.Controls.pdb/C6F2C1B347CE4B3183E4848F501C9A2C1/Microsoft.Maui.Controls.pd_
SYMSRV:  HttpQueryInfo: 80190194 - HTTP_STATUS_NOT_FOUND
SYMSRV:  HTTPGET: /symbols/Microsoft.Maui.Controls.pdb/C6F2C1B347CE4B3183E4848F501C9A2C1/file.ptr
SYMSRV:  HttpQueryInfo: 80190194 - HTTP_STATUS_NOT_FOUND
SYMSRV:  RESULT: 0x80190194

https://referencesource.microsoft.com/symbols: Symbols not found on symbol server.
https://msdl.microsoft.com/download/symbols: Skipped checking location. A stripped symbol file was previously found in this location.
SYMSRV:  BYINDEX: 0x2B
         C:\Users\juwens\AppData\Local\Temp\SymbolCache*https://symbols.nuget.org/download/symbols
         Microsoft.Maui.Controls.pdb
         C6F2C1B347CE4B3183E4848F501C9A2Cffffffff


SYMSRV:  UNC: C:\Users\juwens\AppData\Local\Temp\SymbolCache\Microsoft.Maui.Controls.pdb\C6F2C1B347CE4B3183E4848F501C9A2Cffffffff\Microsoft.Maui.Controls.pdb - path not found
SYMSRV:  UNC: C:\Users\juwens\AppData\Local\Temp\SymbolCache\Microsoft.Maui.Controls.pdb\C6F2C1B347CE4B3183E4848F501C9A2Cffffffff\Microsoft.Maui.Controls.pd_ - path not found
SYMSRV:  UNC: C:\Users\juwens\AppData\Local\Temp\SymbolCache\Microsoft.Maui.Controls.pdb\C6F2C1B347CE4B3183E4848F501C9A2Cffffffff\file.ptr - path not found
SYMSRV:  HTTPGET: /download/symbols/Microsoft.Maui.Controls.pdb/C6F2C1B347CE4B3183E4848F501C9A2Cffffffff/Microsoft.Maui.Controls.pdb
SYMSRV:  HttpQueryInfo: 80190194 - HTTP_STATUS_NOT_FOUND
SYMSRV:  HTTPGET: /download/symbols/Microsoft.Maui.Controls.pdb/C6F2C1B347CE4B3183E4848F501C9A2Cffffffff/Microsoft.Maui.Controls.pd_
SYMSRV:  HttpQueryInfo: 80190194 - HTTP_STATUS_NOT_FOUND
SYMSRV:  HTTPGET: /download/symbols/Microsoft.Maui.Controls.pdb/C6F2C1B347CE4B3183E4848F501C9A2Cffffffff/file.ptr
SYMSRV:  HttpQueryInfo: 80190194 - HTTP_STATUS_NOT_FOUND
SYMSRV:  RESULT: 0x80190194


https://symbols.nuget.org/download/symbols: Symbols not found on symbol server.

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 6
  • Comments: 15 (4 by maintainers)

Most upvoted comments

@PureWeen This is not a VS issue, the MAUI symbols are not published to Nuget, making it very hard to debug when MAUI itself throws an error.

@juwens the PDBs are included within the nuget package itself. If you go to your nuget cache you should be able to find them for all the MAUI packages and can load them manually. I do agree that they should be published to nuget itself as well though, since that would be more accessible for everyone.

I tried loading MAUI symbols for my app and found it very frustrating. Out-of-the-box, VisualStudio cannot find any symbols. The “Modules” window fails to show which version of the DLL is actually in use:

2023-06-06_120711 devenv

I searched my “workloads” folder and found over 50 potential matches – none of them actually matched though, wasting my time.

2023-06-06_120235 explorer

Next, I search my nuget cache – found a few candidates, debugger wouldn’t load any of them.

Next, I found more PDBs in my intermediate-output folder. Great, I thought, this must be it. Nope, VisualStudio again reports a mismatch.

2023-06-06_125432 explorer

So, having wasted 30 minutes of my time, I give up. I wanted to contribute to MAUI by debugging a problem and writing a helpful bug report but I can’t.

The pdb’s do ship inside the nugets, and if you look at symbol load information in VS you might see something like:

X:\tempcode\MauiApp8\MauiApp8\bin\Debug\net8.0-windows10.0.19041.0\win10-x64\AppX\Microsoft.Maui.Controls.pdb: Cannot find or open the PDB file.
X:\tempcode\MauiApp8\MauiApp8\bin\Debug\net8.0-windows10.0.19041.0\win10-x64\AppX\Microsoft.Maui.Controls.pdb: Cannot find or open the PDB file.
D:\a\_work\1\s\src\Controls\src\Core\obj\Release\net8.0-windows10.0.19041\Microsoft.Maui.Controls.pdb: Cannot find or open the PDB file.
C:\Users\user\AppData\Local\Temp\SymbolCache\Microsoft.Maui.Controls.pdb\3eae086deb4a43bc80f0a7375723c84bffffffff\Microsoft.Maui.Controls.pdb: Cannot find or open the PDB file.
C:\Users\user\AppData\Local\Temp\SymbolCache\MicrosoftPublicSymbols\Microsoft.Maui.Controls.pdb\3eae086deb4a43bc80f0a7375723c84bffffffff\Microsoft.Maui.Controls.pdb: Cannot find or open the PDB file.
C:\Users\user\AppData\Local\Temp\SymbolCache\Microsoft.Maui.Controls.pdb\3eae086deb4a43bc80f0a7375723c84b1\Microsoft.Maui.Controls.pdb: Cannot find or open the PDB file.
C:\Users\user\AppData\Local\Temp\SymbolCache\MicrosoftPublicSymbols\Microsoft.Maui.Controls.pdb\3eae086deb4a43bc80f0a7375723c84b1\Microsoft.Maui.Controls.pdb: Cannot find or open the PDB file.
X:\tempcode\MauiApp8\Microsoft.Maui.Controls.pdb: Cannot find or open the PDB file.

From what I can tell, the problem might be that the paths aren’t normalized and so it can’t find the pdb’s that sit alongside the exe.

There’s some docs on the ContinuousIntegrationBuild property which suggest that setting this property causes the paths to be normalized in the debug symbols. I tried setting some of these properties: https://github.com/dotnet/maui/pull/16127

However I’m still seeing nuget complain about determinstic not being set: image

I spent some time investigating this today, including creating a simple test nuget package. Here are my findings:

First, on the package being nondeterministic:

Some of the above may explain why MAUI packages aren’t being detected as deterministic (I need to investigate that more since we ideally should fix that too). However, it was sufficient for me to test if embedded symbols work once the package is deterministic. And they don’t. Here are details of that:

  • For my test package, I set <AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder> per doc, to include the PDBs in the nuget package. And that works - they are included after doing the dotnet pack.
  • I then tested consuming the package in VS and loading symbols (with WinUI). It can’t find them. The cause looks to be this: https://github.com/dotnet/sourcelink/issues/628, where this is broken. .NET7 added, via https://github.com/dotnet/sdk/pull/27580, the CopyDebugSymbolFilesFromPackages option to help address this. But there are two issues with relying on that: (1) it’s off by default, unless the consuming app opts in by setting CopyDebugSymbolFilesFromPackages and (2) even when enabled, it works for WPF apps but for WinUI the PDBs are copied to the output directory but not to the AppX directory so they still aren’t found.

Recommendation:

  • We should publish a separate symbol package, like most nuget packages do (it’s the recommended approach and the happy path that works).

Workaround:

  • Until we fix as above, one workaround is to set <CopyDebugSymbolFilesFromPackages>true</CopyDebugSymbolFilesFromPackages> in your csproj. With that, PDBs will be in the output directory. For WinUI you’ll need to then copy the PDBs the AppX directory (e.g. copy from bin\Debug\net8.0-windows10.0.19041.0\win10-x64 to bin\Debug\net8.0-windows10.0.19041.0\win10-x64\AppX. Then the debugger can find the PDBs.

@BretJohnson thanks a lot for the deep analysis. I will try the workaround next week, looks promising.

(My current workaround was to unpack all nugets into a specific location, and add this folder as a symbol source in VS). Your workaround looks better, cause I don’t need to change anything with a Maui update 😃

What the heck?

This issue is being closed due to inactivity. If this issue is still affecting you, please follow the steps above to use the VS Feedback Tool to report the issue.

Only MAUI is affected. other symbol loading from symbol-servers/sourcelink work fine. I don’t see, how this is a VS fault.
Did you try it out?
Did you look at the symbol loading output, and see a clue why it’s VS‘s fault?
Are you sure that MAUI publishes it’s symbol packages in the VS expected way, as many other projects do?