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?

Laith
  • 6,071
  • 1
  • 33
  • 60
  • 3
    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. – Bryce Wagner Feb 05 '16 at 00:08
  • Thanks Bryce, I did find a few .pdb files in the bin/release directory. How do I query the files with the addresses above? – Laith Feb 05 '16 at 00:46
  • 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. – Bryce Wagner Feb 05 '16 at 14:14
  • have you found a good answer to that yet? – Eric Liprandi Feb 11 '16 at 22:53
  • 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. – Laith Feb 12 '16 at 02:08
  • Have you tried turning all exceptions on in the debug menu, just to see if it will show you exception directly? – Netferret Mar 16 '17 at 12:41
  • @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. – Laith Mar 17 '17 at 22:06
  • 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. – Netferret Mar 20 '17 at 08:23

1 Answers1

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

Andrew Au
  • 812
  • 7
  • 18
  • StackParser has transformed `at Signal-Windows!+0xfd2403` to `at Signal-Windows!RuntimeFunctionSection+0x28403`. Am I missing .pdbs, or is this the desired output? – Benni May 04 '18 at 07:45
  • 1
    Sounds like a PDB problem ... are you sure you are feeding the tool with the matching PDB? – Andrew Au May 04 '18 at 13:47