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

Error in ExceptionReportInterpreter #7

Open filippobottega opened 7 years ago

filippobottega commented 7 years ago

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.

icnocop commented 6 years ago

@erlinghaugstad created pull https://github.com/gimelfarb/ProductionStackTrace/pull/12 to fix this issue.