Forum Discussion
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?
- Aditi_NarvekarMicrosoftTypically getting line numbers in exception stack traces requires the runtime to be able to find the symbols for the binaries. Release builds should produce symbols. You may also be interested in embedding the symbols. See the “DebugType” property in the MSBuild documentation: https://docs.microsoft.com/en-us/visualstudio/msbuild/common-msbuild-project-properties?view=vs-2022
- Nwagner2225Copper ContributorTo 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.- Aditi_NarvekarMicrosoft
Nwagner2225 basically this is by design. Store does not like packages with pdbs for policy.
per docs here https://docs.microsoft.com/en-us/windows/msix/package/packaging-uwp-apps
Symbols for appx package are compressed as .appxsym(as part of .appxupload) and will only be used in Partner center for crash analysis
- Aditi_NarvekarMicrosoft
Nwagner2225 I'm looking into this and will let you know