GithubHelp home page GithubHelp logo

gimelfarb / productionstacktrace Goto Github PK

View Code? Open in Web Editor NEW
78.0 78.0 8.0 83 KB

Without deploying PDBs, generate a .NET exception stack trace that can be processed to retrieve source file and line number info

License: Other

C# 95.01% PowerShell 1.17% Batchfile 3.81%

productionstacktrace's People

Contributors

filippobottega avatar gimelfarb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

productionstacktrace's Issues

FindPdbFile returns null

Hello,
I'm using dbghelp.dll version 6.2.9200.16384. The function FindPdbFile returns null because DbgHelp.SymFindFileInPath fails.
I noticed that when info.PdbGuid is passed to FindPdbFile it changes value like in the second picture.

productionstacktracedebug1

productionstacktracedebug2

I don't know if this is an issue but I need more help to understand if SymFindFileInPath fails or if there are some errors in passed parameters.

Thank you for your help,
Filippo.

PeHeaders FromUnmanagedPtr throws exception

I had an instance where modulePtr was -1 when entering FromUnmanagedPtr(), which threw an exception.
I added the following code to ReadAssemblyDebugInfo()

PeHeaders^ peHdrs = PeHeaders::FromUnmanagedPtr(modulePtr);
if( !peHdrs )
return nullptr;
....

and the following to FromUnmanagedPtr

static PeHeaders^ FromUnmanagedPtr(IntPtr memoryPtr)
{
if( (int)memoryPtr == -1 )
{
return nullptr;
}
....

This resolved the issue.

Incorrect symbols being loaded

Whilst testing the nuget package against symbols we had pushed via symstore to a local drive we noticed that when we called Convert-ProductionStackTrace on a trace for where there should be no symbols - it located a line for each offset - it seemed to be using the incorrect symbols (possibly latest?).

Reviewing the code we note that SymSetOptions was only being called with SYMOPT_DEBUG. We were thinking that SYMOPT_EXACT_SYMBOLS would also be useful to ensure that we don't get false positives.

What do you think?

Error in ExceptionReportInterpreter

Hello,
ExceptionReportInterpreter fails due to an error in s_regexStackTraceLine field.

        // Regex for the stack frame line, it looks like this:
        // <space> at AssemblyName!0x<hex method token>!Namespace.Class.Method(<arg types>) +0x<hex IL Offset>
        //         at MyAssembly!0x1234567!MyAssembly.Class1.A() +0xc

        private static readonly Regex s_regexStackTraceLine =
            new Regex(@"^\s*at\s+(?<Assembly>[^<>:\""/\\|?*\u0000-\u001f!]+)!0x(?<MDToken>[0-9a-f]+)!(?<Method>[^\(]+)\((?<Args>[^\)]*)\)\s+\+0x(?<ILOffset>[0-9a-f]+)", RegexOptions.Singleline | RegexOptions.CultureInvariant | RegexOptions.IgnoreCase);

but "at" word is wrong if the culture is not en-en because:

    /// <summary>
    /// Main reporting entry point.
    /// </summary>
    public static class ExceptionReporting
    {
...
        /// <summary>
        /// Internal logic - adapted from Environment.GetStackTrace from .NET BCL.
        /// </summary>
        /// <param name="ex"></param>
        /// <param name="ctx"></param>
        /// <param name="builder"></param>
        private static void GetStackTraceEx(Exception ex, ExceptionReportingContext ctx, ref StringBuilder builder)
        {
            var st = new StackTrace(ex);
            var strAt = GetRuntimeResourceString("Word_At") ?? "at";

Best regards,
Filippo.

Suggestion About Code Help

I don't know how to use the third method About 【Use with a logging framework】 .Can you provide more detailed information?

I Want Use log4net and your Exception Frame,but I don't understhand how to use,can you provide a example or detailed information about it?
Any help will appreciate!

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

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.

Error running build.cmd deploy

Hello,
running build.cmd deploy I get some errors.
I'm not able to create nuget packages because not all builds are completed before creating nuget packages.
I have attached my console output.
I'm using msbuild v.14.0. I suppose that something in the order of compilation was wrong.

Best regards,
Filippo.

BuildCmdLog.pdf

Not getting GUID and Age property of PDB in StackTrace

Hi,

First of all I want to thank you for your great work on this project. I'm having some issues with the production not displaying the GUID and Age in the stacktrace.

When I deploy the application with debug configuration, everything is fine and I'm getting the GUID + age field. But when I deploy the application for release (obfuscated), I can't seem to get the fields into the stacktrace, it's displaying the MODULE: line but without the "G:{GUID} A:{AGE} fields.

What am I doing wrong here?

Thanks.

Strong name key version required

Do you have (or intend) to strong name the assembly - it would really help its adoption as quite a few places have strong naming as a requirement?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.