gimelfarb / ProductionStackTrace

Without deploying PDBs, generate a .NET exception stack trace that can be processed to retrieve source file and line number info
Other
79 stars 8 forks source link

Line numbers are not outputted, correct symbols generated and in path #1

Closed bolthar closed 10 years ago

bolthar commented 10 years ago

I've tried to use the Analyze.Library nuget package to extract line number infos from the exception report but couldn't - I get the instruction causing the exception but no line numbers.

Here's a sample of what I am doing - D:\symbols\ contains the latest symbols (which I copy-pasted from the debug/ folder)

catch (Exception ex)
            {
                var text = ExceptionReporting.GetExceptionReport(ex);
                var writer = new StringWriter();
                var pst = new ProductionStackTrace.Analyze.ExceptionReportInterpreter();
                pst.SymbolPaths.Add("D:\\symbols");
                pst.Translate(new StringReader(text), writer);
                MessageBox.Show(writer.GetStringBuilder().ToString());
            }

Here's the output:

System.NullReferenceException: Object reference not set to an instance of an object.
   at animationTest.TestObj..ctor(String test)

And here's the exception report:

System.NullReferenceException: Object reference not set to an instance of an object.
   at animationTest!0x06000009!animationTest.TestObj..ctor(String test) +0x9
==========
MODULE: animationTest => animationTest, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null; G:3b9e8688578a4f8e83f09c8f3f6a5d45; A:1

I'm most likely doing something stupid here :) but I've spent quite some time going through the examples and I really have no idea where to go next - sorry for disturbing you directly.

gimelfarb commented 10 years ago

Hi! Happy to help. First some questions to understand the environment:

Try this: compile your app, copy your PDBs to D:\symbols, then run EXE directly (not through VS).

If you can share your sample project, I can try and recreate the issue. Basically if the source info is not being printed it means it is not finding matching PDBs.

bolthar commented 10 years ago

Hi! Thanks a lot for the insta-reply! :)

I've tried to clean, rebuild, copy the animationTest.pdb symbols file to the D:\symbols dir, and then running the .exe outside VS - same result. Here (https://github.com/bolthar/animationtest) is the sample project - animations have nothing to do about it :)

Thanks a lot again!

gimelfarb commented 10 years ago

Hey, thanks a lot for the sample project. I think I see where the problem is, and it is not with your code. A COM GUID in ProductionStackTrace.Analyze.SymbolLoader.Load() method used to create DiaSource instance is wrong. This is eye-opening, because I wrote and tested this on VS 2013, which means the COM GUID changed between VS 2012 and VS 2013 release of DIA SDK.

Now I am in the office with VS 2012 on my machine, and I can replicate your issue. I need to fix this and make a new release, because this is clearly wrong.

I will do it in the evening (EST) if you can wait.

bolthar commented 10 years ago

I can absolutely wait :) thanks a lot, you've been incredibly helpful! Can I help you somehow?

gimelfarb commented 10 years ago

Fixed it and deployed new 1.0.16 version to NuGet. You can update the NuGet package through Visual Studio and get the fixed version. It should work for you and display the line number information.

Basically the issue was that DIA SDK has been changing its the COM class GUID with each VS release it seems. I never tested on lower VS versions after building it on a machine with VS 2013 on it. The fix is simple - try all the historical GUIDs in order until one works. That means supporting it from VS2008 till VS2013.

Enjoy! Let me know if you have any other questions.

gimelfarb commented 10 years ago

P.S. Please confirm that it works for you now.

bolthar commented 10 years ago

Updated and tested, works like a charm :+1: thanks a lot!

gimelfarb commented 10 years ago

Excellent! You are welcome :)

mliesmons commented 8 years ago

Same experience here with VS 2015, could it be we need an update for 2015 too?