Forum Discussion

Nwagner2225's avatar
Nwagner2225
Copper Contributor
Apr 12, 2022

WinForms App C# Stack trace has no line numbers

I have a C# project built with Visual Studio 2019. In the Build options I have selected "PDB-only" for Debugging information (but tried also "Full").
When creating App Packages I check "Include public symbol files".
When the program is installed with this package and crashes, the stack trace does not include line numbers. When I copy the Release folder to the target machine and run it from there, the strack trace includes line numbers.
Looking in a forum I found
https://social.msdn.microsoft.com/Forums/en-US/5c0ab108-edf6-426c-b60b-4dc1017d9e2b/is-it-possible-to-obtain-line-numbers-in-the-stack-trace-of-an-exception?forum=winappswithcsharp
This thread ends with "Yes, it seems windows store does not support it.". It was posted in March 2015 and I hope since then something has changed, e.g. the option "Include public symbol files" was added. I mean: why adding public symbols, if not for the sake of a stack trace with line numbers?
I also tried to add the PDB-file by adding
<Content Include="....pdb" />
in the wapproj-file, but the PDB-file was not added, whereas a file with a different extension was added in the correct folder.
What else can I do to get line numbers in stack trace, when program is installed from MSIX-package?

    • Nwagner2225's avatar
      Nwagner2225
      Copper Contributor
      To avoid any misunderstanding: you are talking about the setting "Debugging information" in screen "Advanced Build Settings" of Project properties, right?
      I tried all the settings there. Using "Full" or "PDB only" a PDB-file is created and I get line numbers when I start the program from Release folder - but not when I start it from the installed MSIX-package. Using "Embedded" or "Portable" I even do not get line numbers when I start the program from Release folder.
      According to my understanding, it is not a problem of building the program. It is a problem, that the PDB file - allthough created - does not get installed with the MSIX-package.

Resources