WinForms App C# Stack trace has no line numbers

%3CLINGO-SUB%20id%3D%22lingo-sub-3282804%22%20slang%3D%22en-US%22%3EWinForms%20App%20C%23%20Stack%20trace%20has%20no%20line%20numbers%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3282804%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSPAN%3EI%20have%20a%20C%23%20project%20built%20with%20Visual%20Studio%202019.%20In%20the%20Build%20options%20I%20have%20selected%20%22PDB-only%22%20for%20Debugging%20information%20(but%20tried%20also%20%22Full%22).%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3EWhen%20creating%20App%20Packages%20I%20check%20%22Include%20public%20symbol%20files%22.%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3EWhen%20the%20program%20is%20installed%20with%20this%20package%20and%20crashes%2C%20the%20stack%20trace%20does%20not%20include%20line%20numbers.%20When%20I%20copy%20the%20Release%20folder%20to%20the%20target%20machine%20and%20run%20it%20from%20there%2C%20the%20strack%20trace%20includes%20line%20numbers.%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3ELooking%20in%20a%20forum%20I%20found%3C%2FSPAN%3E%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Fsocial.msdn.microsoft.com%2FForums%2Fen-US%2F5c0ab108-edf6-426c-b60b-4dc1017d9e2b%2Fis-it-possible-to-obtain-line-numbers-in-the-stack-trace-of-an-exception%3Fforum%3Dwinappswithcsharp%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fsocial.msdn.microsoft.com%2FForums%2Fen-US%2F5c0ab108-edf6-426c-b60b-4dc1017d9e2b%2Fis-it-possible-to-obtain-line-numbers-in-the-stack-trace-of-an-exception%3Fforum%3Dwinappswithcsharp%3C%2FA%3E%3CBR%20%2F%3E%3CSPAN%3EThis%20thread%20ends%20with%20%22Yes%2C%20it%20seems%20windows%20store%20does%20not%20support%20it.%22.%20It%20was%20posted%20in%20March%202015%20and%20I%20hope%20since%20then%20something%20has%20changed%2C%20e.g.%20the%20option%20%22Include%20public%20symbol%20files%22%20was%20added.%20I%20mean%3A%20why%20adding%20public%20symbols%2C%20if%20not%20for%20the%20sake%20of%20a%20stack%20trace%20with%20line%20numbers%3F%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3EI%20also%20tried%20to%20add%20the%20PDB-file%20by%20adding%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3E%3CCONTENT%20include%3D%22%26quot%3B....pdb%26quot%3B%22%3E%3C%2FCONTENT%3E%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3Ein%20the%20wapproj-file%2C%20but%20the%20PDB-file%20was%20not%20added%2C%20whereas%20a%20file%20with%20a%20different%20extension%20was%20added%20in%20the%20correct%20folder.%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3EWhat%20else%20can%20I%20do%20to%20get%20line%20numbers%20in%20stack%20trace%2C%20when%20program%20is%20installed%20from%20MSIX-package%3F%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3296337%22%20slang%3D%22en-US%22%3ERe%3A%20WinForms%20App%20C%23%20Stack%20trace%20has%20no%20line%20numbers%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3296337%22%20slang%3D%22en-US%22%3ETo%20avoid%20any%20misunderstanding%3A%20you%20are%20talking%20about%20the%20setting%20%22Debugging%20information%22%20in%20screen%20%22Advanced%20Build%20Settings%22%20of%20Project%20properties%2C%20right%3F%3CBR%20%2F%3EI%20tried%20all%20the%20settings%20there.%20Using%20%22Full%22%20or%20%22PDB%20only%22%20a%20PDB-file%20is%20created%20and%20I%20get%20line%20numbers%20when%20I%20start%20the%20program%20from%20Release%20folder%20-%20but%20not%20when%20I%20start%20it%20from%20the%20installed%20MSIX-package.%20Using%20%22Embedded%22%20or%20%22Portable%22%20I%20even%20do%20not%20get%20line%20numbers%20when%20I%20start%20the%20program%20from%20Release%20folder.%3CBR%20%2F%3EAccording%20to%20my%20understanding%2C%20it%20is%20not%20a%20problem%20of%20building%20the%20program.%20It%20is%20a%20problem%2C%20that%20the%20PDB%20file%20-%20allthough%20created%20-%20does%20not%20get%20installed%20with%20the%20MSIX-package.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3295834%22%20slang%3D%22en-US%22%3ERe%3A%20WinForms%20App%20C%23%20Stack%20trace%20has%20no%20line%20numbers%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3295834%22%20slang%3D%22en-US%22%3ETypically%20getting%20line%20numbers%20in%20exception%20stack%20traces%20requires%20the%20runtime%20to%20be%20able%20to%20find%20the%20symbols%20for%20the%20binaries.%20Release%20builds%20should%20produce%20symbols.%20You%20may%20also%20be%20interested%20in%20embedding%20the%20symbols.%20See%20the%20%E2%80%9CDebugType%E2%80%9D%20property%20in%20the%20MSBuild%20documentation%3A%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fvisualstudio%2Fmsbuild%2Fcommon-msbuild-project-properties%3Fview%3Dvs-2022%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fvisualstudio%2Fmsbuild%2Fcommon-msbuild-project-properties%3Fview%3Dvs-2022%3C%2FA%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3292704%22%20slang%3D%22en-US%22%3ERe%3A%20WinForms%20App%20C%23%20Stack%20trace%20has%20no%20line%20numbers%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3292704%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1360676%22%20target%3D%22_blank%22%3E%40Nwagner2225%3C%2FA%3E%26nbsp%3BI'm%20looking%20into%20this%20and%20will%20let%20you%20know%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3354735%22%20slang%3D%22en-US%22%3ERe%3A%20WinForms%20App%20C%23%20Stack%20trace%20has%20no%20line%20numbers%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3354735%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1360676%22%20target%3D%22_blank%22%3E%40Nwagner2225%3C%2FA%3E%26nbsp%3Bbasically%20this%20is%20by%20design.%20%3CSPAN%3EStore%20does%20not%20like%20packages%20with%20pdbs%20for%20policy.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3Eper%20docs%20here%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20tabindex%3D%22-1%22%20title%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fwindows%2Fmsix%2Fpackage%2Fpackaging-uwp-apps%22%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fwindows%2Fmsix%2Fpackage%2Fpackaging-uwp-apps%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%20aria-label%3D%22Link%20https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fwindows%2Fmsix%2Fpackage%2Fpackaging-uwp-apps%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fwindows%2Fmsix%2Fpackage%2Fpackaging-uwp-apps%3C%2FA%3E%3C%2FP%3E%0A%3CP%3ESymbols%20for%20appx%20package%20are%20compressed%20as%20.appxsym(as%20part%20of%20.appxupload)%20and%20will%20only%20be%20used%20in%20Partner%20center%20for%20crash%20analysis%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3359076%22%20slang%3D%22en-US%22%3ERe%3A%20WinForms%20App%20C%23%20Stack%20trace%20has%20no%20line%20numbers%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3359076%22%20slang%3D%22en-US%22%3E%40%20Aditi_Narvekar%20thanks%20for%20this%20information.%3CBR%20%2F%3ECurrently%20I%20am%20using%20Microsoft%20AppCenter%20for%20crash%20reporting%20-%20and%20there%20I%20do%20not%20get%20the%20line%20numbers.%20In%20Partner%20center%20I%20see%20that%20there%20was%20a%20crash%2C%20but%20without%20any%20details%2C%20just%20%22Unknown%22.%20If%20I%20remove%20AppCenter%2C%20will%20I%20get%20more%20details%20in%20Partner%20center%3F%20In%20general%20I%20like%20AppCenter%2C%20because%20it%20helps%20tracking%20the%20errors.%20But%20if%20I%20can%20get%20line%20numbers%20in%20Partner%20center%20...%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3402011%22%20slang%3D%22en-US%22%3ERe%3A%20WinForms%20App%20C%23%20Stack%20trace%20has%20no%20line%20numbers%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3402011%22%20slang%3D%22en-US%22%3EI%20don't%20believe%20that%20will%20help.%20But%20maybe%20you%20can%20try%20it%3C%2FLINGO-BODY%3E
New Contributor

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-t...
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?

6 Replies

@Nwagner2225 I'm looking into this and will let you know 

Typically 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
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.

@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_Narvekar thanks for this information.
Currently I am using Microsoft AppCenter for crash reporting - and there I do not get the line numbers. In Partner center I see that there was a crash, but without any details, just "Unknown". If I remove AppCenter, will I get more details in Partner center? In general I like AppCenter, because it helps tracking the errors. But if I can get line numbers in Partner center ...
I don't believe that will help. But maybe you can try it