How do I follow .Net Native cryptic stack-trace?
Asked Answered
A

1

10

Since UWP requires .Net Native (which is very welcome), I'm getting cryptic stack-traces now. This is the exception reported by people using my app:

System.InvalidCastException: InvalidCast_Com 
at SharedLibrary!<BaseAddress>+0x429e9d 
at SharedLibrary!<BaseAddress>+0x47d878 
at SharedLibrary!<BaseAddress>+0x48455a 
at SharedLibrary!<BaseAddress>+0x499043 
at SharedLibrary!<BaseAddress>+0x498fb7 
at SharedLibrary!<BaseAddress>+0x5ea468 
at SharedLibrary!<BaseAddress>+0x5ea418 
// this goes on...

I understand there's an invalid cast somewhere... but I need to know what SharedLibrary!<BaseAddress>+0x429e9d is pointing to.

Is there a way to find where these links point to?

Aldenalder answered 4/2, 2016 at 23:54 Comment(8)
You need the .pdb file of the library in question. I haven't used .NET native, but I would assume it generates pdb files just like other compilers.Tarton
Thanks Bryce, I did find a few .pdb files in the bin/release directory. How do I query the files with the addresses above?Aldenalder
It's critical that your pdb file be the same one that was compiled with that exact executable. I think there's a way to attach Visual Studio to a dump file from a crash if you have one, but if all you have is a text error report, I have no clue how to correspond that text to the binary pdb format. You'll probably have to do some Googling on the topic.Tarton
have you found a good answer to that yet?Skillern
Not yet. I doubt this is gonna be easy. Maybe the .Net Native team will create a tool in the future to help us map these addresses.Aldenalder
Have you tried turning all exceptions on in the debug menu, just to see if it will show you exception directly?Ventail
@Netferret, these exceptions are thrown in the wild, not on my local development machine. The exception stacktrace comes from our logging/reporting that occurs when an UnhandledException is raised in the app.Aldenalder
I would write out any values sent to any 3rd party libraries via method parameters to a log then try and recreate the problem with a unit test for each one and run it on the target machine as well. So for a random example var mytest = Convert.ToDateTime("value from log - this will throw as exception"); then you can see where the exception is actually triggered and investigate from there. Good Luck.Ventail
B
1

There is a tool in GitHub that can decipher .Net Native stack traces into human readable format.

https://github.com/dotnet/corefx-tools/tree/master/src/StackParser

Bascinet answered 13/3, 2018 at 2:34 Comment(2)
StackParser has transformed at Signal-Windows!<BaseAddress>+0xfd2403 to at Signal-Windows!RuntimeFunctionSection+0x28403. Am I missing .pdbs, or is this the desired output?Insurgence
Sounds like a PDB problem ... are you sure you are feeding the tool with the matching PDB?Bascinet

© 2022 - 2024 — McMap. All rights reserved.