protected override void WriteSpecializedPartOfTextReport(TextWriter reportFile)
 {
     base.WriteReportFileHeader(reportFile, "CLR is " + (base.IsFlagSet(ReportOptions.ReportTerminateAfterSend) ? string.Empty : "not ") + "terminating");
     reportFile.WriteLine("P1(flavor)={0}", base.BucketingParameter <WatsonExceptionReport.BucketParamId>(WatsonExceptionReport.BucketParamId.Flavor));
     reportFile.WriteLine("P2(appVersion)={0}", base.BucketingParameter <WatsonExceptionReport.BucketParamId>(WatsonExceptionReport.BucketParamId.AppVersion));
     reportFile.WriteLine("P3(appName)={0}", base.BucketingParameter <WatsonExceptionReport.BucketParamId>(WatsonExceptionReport.BucketParamId.AppName));
     reportFile.WriteLine("P4(assemblyName)={0}", base.BucketingParameter <WatsonExceptionReport.BucketParamId>(WatsonExceptionReport.BucketParamId.AssemblyName));
     reportFile.WriteLine("P5(exMethodName)={0}", base.BucketingParameter <WatsonExceptionReport.BucketParamId>(WatsonExceptionReport.BucketParamId.ExMethodName));
     reportFile.WriteLine("P6(exceptionType)={0}", base.BucketingParameter <WatsonExceptionReport.BucketParamId>(WatsonExceptionReport.BucketParamId.ExceptionType));
     reportFile.WriteLine("P7(callstackHash)={0}", base.BucketingParameter <WatsonExceptionReport.BucketParamId>(WatsonExceptionReport.BucketParamId.CallstackHash));
     reportFile.WriteLine("P8(assemblyVer)={0}", base.BucketingParameter <WatsonExceptionReport.BucketParamId>(WatsonExceptionReport.BucketParamId.AssemblyVer));
     reportFile.WriteLine();
     reportFile.WriteLine("Exchange Version={0}", WatsonReport.ExchangeFormattedVersion(ExWatson.ExchangeVersion));
     reportFile.WriteLine("Default Assembly Version={0}", WatsonReport.ExchangeFormattedVersion(ExWatson.DefaultAssemblyVersion));
     reportFile.WriteLine("Executable Name={0}", WatsonReport.GetValidString(ExWatson.RealAppName));
     reportFile.WriteLine("Executable Version={0}", WatsonReport.ExchangeFormattedVersion(ExWatson.RealApplicationVersion));
     reportFile.WriteLine("Base Exception Target Site={0}", this.baseExceptionTargetSite);
     reportFile.WriteLine("Base Exception Assembly name={0}", this.baseExceptionAssemblyName);
     reportFile.WriteLine("Base Exception Method Name={0}", this.baseExceptionMethodName);
     reportFile.WriteLine("Exception Message={0}", this.exception.Message);
     reportFile.WriteLine("EIP=0x{0}", (IntPtr.Size == 4) ? this.exceptionEIP.ToString("x8") : this.exceptionEIP.ToString("x16"));
     reportFile.WriteLine("Build bit-size={0}", IntPtr.Size * 8);
     WatsonExceptionReport.WriteReportFileLIDs(reportFile, this.lids);
     WatsonExceptionReport.WriteReportFileExceptionObjectInfo(reportFile, this.exception);
     WatsonExceptionReport.WriteReportFileInnerExceptionObjectsInfo(reportFile, this.exception);
     WatsonExceptionReport.WriteReportFileStackTrace(reportFile, this.exception);
     WatsonExceptionReport.WriteReportFileLIDs(reportFile, this.lids);
     WatsonExceptionReport.WriteReportFileInnerExceptionObjectsInfo(reportFile, this.exception);
 }
        public override string Evaluate(WatsonReport watsonReport)
        {
            string text = base.Expression + "=" + Environment.GetEnvironmentVariable(base.Expression);

            watsonReport.LogExtraData(text);
            return(text);
        }
 protected override void WriteReportTypeSpecificSection(XmlWriter reportFile)
 {
     using (new SafeXmlTag(reportFile, "exception-report").WithAttribute("is-clr-terminating", base.IsFlagSet(ReportOptions.ReportTerminateAfterSend) ? "1" : "0"))
     {
         using (new SafeXmlTag(reportFile, "application").WithAttribute("name", base.AppName).WithAttribute("version", WatsonReport.ExchangeFormattedVersion(base.AppVersion)))
         {
         }
         using (new SafeXmlTag(reportFile, "assembly").WithAttribute("name", base.BucketingParameter <WatsonExceptionReport.BucketParamId>(WatsonExceptionReport.BucketParamId.AssemblyName)).WithAttribute("version", base.BucketingParameter <WatsonExceptionReport.BucketParamId>(WatsonExceptionReport.BucketParamId.AssemblyVer)))
         {
         }
         using (SafeXmlTag safeXmlTag4 = new SafeXmlTag(reportFile, "exception"))
         {
             safeXmlTag4.SetContent(WatsonReport.SanitizeException(this.exception.ToString()));
         }
         using (new SafeXmlTag(reportFile, "base-exception").WithAttribute("target-site", this.baseExceptionTargetSite).WithAttribute("assembly-name", this.baseExceptionAssemblyName).WithAttribute("method-name", this.baseExceptionMethodName))
         {
         }
         using (SafeXmlTag safeXmlTag6 = new SafeXmlTag(reportFile, "process").WithAttribute("eip", "0x" + ((IntPtr.Size == 4) ? this.exceptionEIP.ToString("x8") : this.exceptionEIP.ToString("x16"))).WithAttribute("bitness", (IntPtr.Size * 8).ToString()).WithAttribute("pid", base.ProcessId.ToString()))
         {
             if (base.ProcessId == DiagnosticsNativeMethods.GetCurrentProcessId())
             {
                 safeXmlTag6.WithAttribute("managed-tid", Environment.CurrentManagedThreadId.ToString()).WithAttribute("native-tid", DiagnosticsNativeMethods.GetCurrentThreadId().ToString());
             }
         }
         if (this.lids != null)
         {
             using (SafeXmlTag safeXmlTag7 = new SafeXmlTag(reportFile, "location-ids"))
             {
                 safeXmlTag7.SetContent(this.lids);
             }
         }
     }
 }
Exemplo n.º 4
0
        private void SetWatsonMethodNameFromStackTrace()
        {
            int        num  = 0;
            string     arg  = string.Empty;
            string     arg2 = string.Empty;
            StackFrame frame;
            MethodBase method;

            for (;;)
            {
                frame  = this.stackTrace.GetFrame(num);
                method = frame.GetMethod();
                string name = method.Name;
                if (name.IndexOf("log", StringComparison.OrdinalIgnoreCase) >= 0)
                {
                    break;
                }
                num++;
                if (num >= this.stackTrace.FrameCount)
                {
                    return;
                }
            }
            num   += 2;
            frame  = this.stackTrace.GetFrame(num);
            method = frame.GetMethod();
            arg    = method.Name;
            arg2   = WatsonReport.GetShortParameter(method.DeclaringType.FullName);
            this.watsonMethodName = arg2 + '.' + arg;
        }
Exemplo n.º 5
0
 protected override string GetShortParameter(uint bucketParamId, string longParameter)
 {
     if (bucketParamId == 4U && Uri.IsWellFormedUriString(longParameter, UriKind.RelativeOrAbsolute))
     {
         return(longParameter.Trim());
     }
     return(WatsonReport.GetShortParameter(longParameter.Trim()));
 }
 protected override void WriteSpecializedPartOfTextReport(TextWriter reportFile)
 {
     base.WriteReportFileHeader(reportFile, "Manifest Report");
     reportFile.WriteLine("P0(appVersion)={0}", WatsonReport.GetValidString(base.BucketingParameter <WatsonExceptionReport.BucketParamId>(WatsonExceptionReport.BucketParamId.AppVersion)));
     reportFile.WriteLine("P1(appName)={0}", WatsonReport.GetValidString(base.BucketingParameter <WatsonExceptionReport.BucketParamId>(WatsonExceptionReport.BucketParamId.AppName)));
     reportFile.WriteLine("P2(exMethodName)={0}", WatsonReport.GetValidString(base.BucketingParameter <WatsonExceptionReport.BucketParamId>(WatsonExceptionReport.BucketParamId.ExMethodName)));
     reportFile.WriteLine("P3(exceptionType)={0}", WatsonReport.GetValidString(base.BucketingParameter <WatsonExceptionReport.BucketParamId>(WatsonExceptionReport.BucketParamId.ExceptionType)));
     reportFile.WriteLine("P4(callstackHash)={0}", base.BucketingParameter <WatsonExceptionReport.BucketParamId>(WatsonExceptionReport.BucketParamId.CallstackHash));
     WatsonExternalProcessReport.WriteReportFileCallStack(reportFile, this.callstack);
     WatsonExternalProcessReport.WriteReportFileDetailedExceptionInformation(reportFile, this.detailedExceptionInformation);
 }
 protected static void WriteReportFileExceptionObjectInfo(TextWriter reportFile, Exception exceptionObject)
 {
     if (exceptionObject != null)
     {
         reportFile.WriteLine(reportFile.NewLine);
         reportFile.WriteLine("----------------------------------------------------");
         reportFile.WriteLine("------------ exceptionObject.ToString() ------------");
         reportFile.WriteLine("----------------------------------------------------");
         reportFile.WriteLine(WatsonReport.SanitizeException(exceptionObject.ToString()));
     }
 }
 protected static void WriteReportFileInnerExceptionObjectsInfo(TextWriter reportFile, Exception exception)
 {
     if (exception != null)
     {
         for (Exception innerException = exception.InnerException; innerException != null; innerException = innerException.InnerException)
         {
             reportFile.WriteLine(reportFile.NewLine);
             reportFile.WriteLine("-------- exception.InnerException.ToString() -------");
             reportFile.WriteLine(WatsonReport.SanitizeException(innerException.ToString()));
         }
     }
 }
Exemplo n.º 9
0
 internal static string[] BuildWatsonParameters(string flavor, string version, string traceComponent, string functionName, string exceptionType, string callstack, int callStackHash)
 {
     return(new string[]
     {
         WatsonReport.GetValidString(flavor),
         WatsonReport.GetValidString(version),
         "OWAClient",
         WatsonReport.GetValidString(traceComponent),
         WatsonReport.GetValidString(functionName),
         WatsonReport.GetValidString(exceptionType),
         WatsonClientReport.GetStringHashFromString(callStackHash)
     });
 }
Exemplo n.º 10
0
 protected static void WriteReportFileStackTrace(TextWriter reportFile, Exception exception)
 {
     if (exception != null)
     {
         reportFile.WriteLine(reportFile.NewLine);
         reportFile.WriteLine("----------------------------------------------------");
         reportFile.WriteLine("--------------- exception.StackTrace ---------------");
         reportFile.WriteLine("----------------------------------------------------");
         if (exception.StackTrace != null)
         {
             reportFile.WriteLine(WatsonReport.SanitizeException(exception.StackTrace));
         }
     }
 }
Exemplo n.º 11
0
        public override string Evaluate(WatsonReport watsonReport)
        {
            string text = string.Concat(new string[]
            {
                "--- ",
                base.Expression,
                " ---\r\n",
                WatsonWmiQueryReportAction.EvaluateWmiQuery(base.Expression),
                "--- END ---"
            });

            watsonReport.LogExtraData(text);
            return(text);
        }
Exemplo n.º 12
0
 protected override void WriteSpecializedPartOfTextReport(TextWriter reportFile)
 {
     base.WriteReportFileHeader(reportFile, "Manifest Report: Non Fatal Error for OWA");
     reportFile.WriteLine("P1(flavor)={0}", WatsonReport.GetValidString(base.BucketingParameter <WatsonClientReport.BucketParamId>(WatsonClientReport.BucketParamId.Flavor)));
     reportFile.WriteLine("P2(exVersion)={0}", WatsonReport.GetValidString(base.BucketingParameter <WatsonClientReport.BucketParamId>(WatsonClientReport.BucketParamId.ExVersion)));
     reportFile.WriteLine("P3(appName)={0}", "OWAClient");
     reportFile.WriteLine("P4(traceComponent)={0}", WatsonReport.GetValidString(base.BucketingParameter <WatsonClientReport.BucketParamId>(WatsonClientReport.BucketParamId.TraceComponent)));
     reportFile.WriteLine("P5(function)={0}", WatsonReport.GetValidString(base.BucketingParameter <WatsonClientReport.BucketParamId>(WatsonClientReport.BucketParamId.Function)));
     reportFile.WriteLine("P6(exceptionType)={0}", WatsonReport.GetValidString(base.BucketingParameter <WatsonClientReport.BucketParamId>(WatsonClientReport.BucketParamId.ExceptionType)));
     reportFile.WriteLine("P7(callstackHash)={0}", base.BucketingParameter <WatsonClientReport.BucketParamId>(WatsonClientReport.BucketParamId.CallstackHash));
     reportFile.WriteLine("filename={0}", WatsonReport.GetValidString(this.fileName));
     WatsonClientReport.WriteReportFileClientCallStack(reportFile, this.ReportCallStack);
     WatsonClientReport.WriteReportFileClientDetailedExceptionInformation(reportFile, this.DetailedExceptionInformation);
 }
Exemplo n.º 13
0
        public override string Evaluate(WatsonReport watsonReport)
        {
            string registryValue = WatsonRegKeyReportAction.GetRegistryValue(base.Expression);
            string text;

            if (registryValue == null)
            {
                text = base.Expression + " not found.";
            }
            else
            {
                text = base.Expression + "=" + registryValue;
            }
            watsonReport.LogExtraData(text);
            return(text);
        }
Exemplo n.º 14
0
 protected override void WriteSpecializedPartOfTextReport(TextWriter reportFile)
 {
     base.WriteReportFileHeader(reportFile, "Manifest Report");
     reportFile.WriteLine("P1(flavor)={0}", WatsonReport.GetValidString(base.BucketingParameter <WatsonReport.BucketParamId>(WatsonReport.BucketParamId.Flavor)));
     reportFile.WriteLine("P2(appVersion)={0}", WatsonReport.GetValidString(base.BucketingParameter <WatsonReport.BucketParamId>(WatsonReport.BucketParamId.AppVersion)));
     reportFile.WriteLine("P3(appName)={0}", WatsonReport.GetValidString(base.BucketingParameter <WatsonReport.BucketParamId>(WatsonReport.BucketParamId.AppName)));
     reportFile.WriteLine("P4(assemblyName)={0}", WatsonReport.GetValidString(base.BucketingParameter <WatsonReport.BucketParamId>(WatsonReport.BucketParamId.AssemblyName)));
     reportFile.WriteLine("P5(exMethodName)={0}", WatsonReport.GetValidString(base.BucketingParameter <WatsonReport.BucketParamId>(WatsonReport.BucketParamId.ExMethodName)));
     reportFile.WriteLine("P6(exceptionType)={0}", WatsonReport.GetValidString(base.BucketingParameter <WatsonReport.BucketParamId>(WatsonReport.BucketParamId.ExceptionType)));
     reportFile.WriteLine("P7(callstackHash)={0}", base.BucketingParameter <WatsonReport.BucketParamId>(WatsonReport.BucketParamId.CallstackHash));
     reportFile.WriteLine("P8(assemblyVer)={0}", WatsonReport.GetValidString(this.assemblyVersion));
     WatsonGenericReport.WriteReportFileCallStack(reportFile, this.callstack);
     if (!string.IsNullOrEmpty(this.detailedExceptionInformation))
     {
         WatsonGenericReport.WriteReportFileDetailedExceptionInformation(reportFile, this.detailedExceptionInformation);
     }
 }
Exemplo n.º 15
0
 protected override void PrepareBucketingParameters()
 {
     base.PrepareBucketingParameters();
     try
     {
         this.appVersion = WatsonReport.ExchangeFormattedVersion(new Version(this.appVersion));
     }
     catch
     {
         this.appVersion = WatsonReport.ExchangeFormattedVersion(ExWatson.ApplicationVersion);
     }
     base.SetBucketingParameter <WatsonReport.BucketParamId>(WatsonReport.BucketParamId.AppVersion, this.appVersion);
     base.SetBucketingParameter <WatsonReport.BucketParamId>(WatsonReport.BucketParamId.AppName, this.appName);
     base.SetBucketingParameter <WatsonReport.BucketParamId>(WatsonReport.BucketParamId.AssemblyName, this.assemblyName);
     base.SetBucketingParameter <WatsonReport.BucketParamId>(WatsonReport.BucketParamId.ExMethodName, this.methodName);
     base.SetBucketingParameter <WatsonReport.BucketParamId>(WatsonReport.BucketParamId.ExceptionType, this.exceptionType);
     base.SetBucketingParameter <WatsonReport.BucketParamId>(WatsonReport.BucketParamId.CallstackHash, this.callstackHash);
     base.SetBucketingParameter <WatsonReport.BucketParamId>(WatsonReport.BucketParamId.AssemblyVer, this.assemblyVersion);
 }
Exemplo n.º 16
0
        internal static string StringHashFromStackTrace(string stackTrace)
        {
            int    num    = 0;
            string result = "0";

            try
            {
                int             num2            = 0;
                int             num3            = 0;
                MatchCollection matchCollection = WatsonGenericReport.RegexFunctions.Matches(stackTrace);
                foreach (object obj in matchCollection)
                {
                    Match match = (Match)obj;
                    if (match.Groups.Count == 2)
                    {
                        string value = match.Groups[1].Value;
                        if (num == 0)
                        {
                            num3 = WatsonReport.ComputeHash(value, num3);
                        }
                        if (!value.Contains("Microsoft"))
                        {
                            continue;
                        }
                        num++;
                        num2 = WatsonReport.ComputeHash(value, num2);
                    }
                    if (num >= 10)
                    {
                        break;
                    }
                }
                if (num == 0)
                {
                    num2 = num3;
                }
                result = Convert.ToString(num2 & 65535, 16);
            }
            catch
            {
            }
            return(result);
        }
Exemplo n.º 17
0
        public override string Evaluate(WatsonReport watsonReport)
        {
            string result;

            try
            {
                watsonReport.PerformWerOperation(delegate(WerSafeHandle reportHandle)
                {
                    DiagnosticsNativeMethods.WerReportAddFile(reportHandle, base.Expression, DiagnosticsNativeMethods.WER_FILE_TYPE.WerFileTypeOther, (DiagnosticsNativeMethods.WER_FILE_FLAGS) 0U);
                });
                watsonReport.LogExtraFile(base.Expression);
                result = "Attached file \"" + Path.GetFileName(base.Expression) + "\" to report.";
            }
            catch (Exception ex)
            {
                watsonReport.LogExtraFile(this.FormatError(base.Expression, ex));
                result = this.FormatError(base.Expression, ex);
            }
            return(result);
        }
Exemplo n.º 18
0
 internal void WriteResult(WatsonReport watsonReport, XmlWriter writer)
 {
     using (SafeXmlTag safeXmlTag = new SafeXmlTag(writer, "action").WithAttribute("type", this.ActionName))
     {
         try
         {
             safeXmlTag.SetContent(this.Evaluate(watsonReport));
         }
         catch (Exception ex)
         {
             watsonReport.RecordExceptionWhileCreatingReport(ex);
             safeXmlTag.SetContent(string.Concat(new string[]
             {
                 "Exception thrown while evaluating action \"",
                 this.ActionName,
                 "\" (expression: ",
                 this.Expression,
                 "):\r\n",
                 ex.ToString()
             }));
         }
     }
 }
Exemplo n.º 19
0
 public abstract string Evaluate(WatsonReport watsonReport);
Exemplo n.º 20
0
 public void UpdateHash(ref int hash)
 {
     hash = WatsonReport.ComputeHash(this.SanitizedFunctionName, hash);
     hash = WatsonReport.ComputeHash(this.FileName, hash);
 }
Exemplo n.º 21
0
 public WatsonLatencyReport(string eventType, string triggerVersion, string locationIdentity, string exceptionName, string callstack, string methodName, string detailedExceptionInformation) : base(eventType, WatsonReport.GetValidString(triggerVersion), ExWatson.AppName, WatsonReport.ExchangeFormattedVersion(ExWatson.ApplicationVersion), WatsonReport.GetValidString(locationIdentity), WatsonReport.GetValidString(exceptionName), WatsonReport.GetValidString(callstack), WatsonGenericReport.StringHashFromStackTrace(WatsonReport.GetValidString(callstack)), WatsonReport.GetValidString(methodName), detailedExceptionInformation)
 {
 }
Exemplo n.º 22
0
        public void PostEvent(TelemetryEvent telemetryEvent)
        {
            CodeContract.RequiresArgumentNotNull <TelemetryEvent>(telemetryEvent, "telemetryEvent");
            if (!TelemetrySession.IsOptedIn)
            {
                return;
            }
            FaultEvent faultEvent = telemetryEvent as FaultEvent;

            if (faultEvent == null)
            {
                throw new InvalidOperationException("WatsonSession channel must have FaultEvent posted");
            }
            int num = FaultEventWatsonSamplePercent;

            faultEvent.ReservedProperties["DataModel.Fault.WatsonSamplePercentDefault"] = FaultEventWatsonSamplePercent;
            if (FaultEvent.WatsonSamplePercent.HasValue)
            {
                num = FaultEvent.WatsonSamplePercent.Value;
                faultEvent.ReservedProperties["DataModel.Fault.WatsonSamplePercentOverride"] = FaultEvent.WatsonSamplePercent.Value;
            }
            if (!faultEvent.IsIncludedInWatsonSample.HasValue)
            {
                faultEvent.UserOptInToWatson = FaultEvent.FaultEventWatsonOptIn.Unspecified;
                if (num > 0)
                {
                    faultEvent.IsIncludedInWatsonSample = (Random.Next(100) < num);
                }
                else
                {
                    faultEvent.IsIncludedInWatsonSample = false;
                }
            }
            else
            {
                if (faultEvent.IsIncludedInWatsonSample == true)
                {
                    faultEvent.UserOptInToWatson = FaultEvent.FaultEventWatsonOptIn.PropertyOptIn;
                }
                else
                {
                    faultEvent.UserOptInToWatson = FaultEvent.FaultEventWatsonOptIn.PropertyOptOut;
                }
                faultEvent.Properties["VS.Fault.WatsonOptIn"] = faultEvent.UserOptInToWatson.ToString();
            }
            WatsonReport watsonReport = new WatsonReport(faultEvent, TelemetrySession);
            int          num2         = FaultEventMaximumWatsonReportsPerSession;

            faultEvent.ReservedProperties["DataModel.Fault.MaxReportsPerSessionDefault"] = FaultEventMaximumWatsonReportsPerSession;
            if (FaultEvent.MaximumWatsonReportsPerSession.HasValue)
            {
                num2 = FaultEvent.MaximumWatsonReportsPerSession.Value;
                faultEvent.ReservedProperties["DataModel.Fault.MaxReportsPerSessionOverride"] = FaultEventMaximumWatsonReportsPerSession;
            }
            if (num == 0 && num2 == 0)
            {
                faultEvent.IsIncludedInWatsonSample = false;
            }
            int minSecondsBetweenReports = FaultEventMinimumSecondsBetweenWatsonReports;

            faultEvent.ReservedProperties["DataModel.Fault.MinSecondsBetweenReportsDefault"] = FaultEventMinimumSecondsBetweenWatsonReports;
            if (FaultEvent.MinimumSecondsBetweenWatsonReports.HasValue)
            {
                minSecondsBetweenReports = FaultEvent.MinimumSecondsBetweenWatsonReports.Value;
                faultEvent.ReservedProperties["DataModel.Fault.MinSecondsBetweenReportsOverride"] = FaultEvent.MinimumSecondsBetweenWatsonReports;
            }
            watsonReport.PostWatsonReport(num2, minSecondsBetweenReports);
        }
 public override string Evaluate(WatsonReport watsonReport)
 {
     watsonReport.LogExtraData(base.Expression);
     return(base.Expression);
 }
Exemplo n.º 24
0
 internal WatsonTroubleshootingReport(string eventType, string triggerVersion, string locationIdentity, string exceptionName, string callstack, string methodName, string detailedExceptionInformation, string traceFileName) : base(eventType, WatsonReport.GetValidString(triggerVersion), ExWatson.AppName, WatsonReport.ExchangeFormattedVersion(ExWatson.ApplicationVersion), WatsonReport.GetValidString(locationIdentity), WatsonReport.GetValidString(exceptionName), WatsonReport.GetValidString(callstack), WatsonGenericReport.StringHashFromStackTrace(WatsonReport.GetValidString(callstack)), WatsonReport.GetValidString(methodName), detailedExceptionInformation)
 {
     this.traceFileName = traceFileName;
 }
Exemplo n.º 25
0
        internal static bool TryStringHashFromStackTrace(Exception exception, bool deep, out string stringHash)
        {
            bool result = false;
            int  num    = deep ? 50 : 10;

            stringHash = "0";
            try
            {
                int num2 = 0;
                int num3 = 0;
                int num4 = 0;
                while (exception != null)
                {
                    string stackTrace = exception.StackTrace;
                    if (!string.IsNullOrEmpty(exception.StackTrace))
                    {
                        MatchCollection matchCollection = WatsonExceptionReport.regexFunctions.Matches(stackTrace);
                        foreach (object obj in matchCollection)
                        {
                            Match match = (Match)obj;
                            if (match.Groups.Count == 2)
                            {
                                string value = match.Groups[1].Value;
                                if (num3 == 0)
                                {
                                    num4 = WatsonReport.ComputeHash(value, num4);
                                }
                                if (!value.Contains("Microsoft"))
                                {
                                    continue;
                                }
                                num3++;
                                num2 = WatsonReport.ComputeHash(value, num2);
                            }
                            if (num3 >= num)
                            {
                                break;
                            }
                        }
                        if (exception is SerializationException)
                        {
                            Match match2 = WatsonExceptionReport.regexSerialization.Match(exception.Message);
                            while (match2.Success)
                            {
                                string value2 = match2.Groups[1].Value;
                                num2   = WatsonReport.ComputeHash(value2, num2);
                                match2 = match2.NextMatch();
                            }
                        }
                    }
                    exception = exception.InnerException;
                }
                if (num3 == 0)
                {
                    num2 = num4;
                }
                stringHash = Convert.ToString(num2 & 65535, 16);
                result     = true;
            }
            catch
            {
            }
            return(result);
        }
Exemplo n.º 26
0
        protected override void PrepareBucketingParameters()
        {
            Exception baseException = null;
            string    s             = null;
            string    text          = null;
            string    text2         = null;
            string    text3         = null;
            Version   v             = null;
            int       num           = 0;
            int       num2          = 0;
            string    text4         = null;

            if (this.exception != null)
            {
                text2 = this.exception.GetType().ToString();
                WatsonExceptionReport.TryStringHashFromStackTrace(this.exception, base.IsFlagSet(ReportOptions.DeepStackTraceHash), out text3);
                baseException = this.exception.GetBaseException();
                try
                {
                    string text5 = (baseException == null) ? null : baseException.StackTrace;
                    if (!string.IsNullOrEmpty(text5))
                    {
                        MatchCollection matchCollection = WatsonExceptionReport.regexFunctions.Matches(text5);
                        foreach (object obj in matchCollection)
                        {
                            Match match = (Match)obj;
                            if (match.Groups.Count == 2)
                            {
                                if (text == null)
                                {
                                    text = match.Groups[1].Value;
                                }
                                if (match.Groups[1].Value.Contains("Microsoft."))
                                {
                                    text = match.Groups[1].Value;
                                    if (text.IndexOf("throw", StringComparison.OrdinalIgnoreCase) <= 0 && text.IndexOf("failfast", StringComparison.OrdinalIgnoreCase) <= 0 && text.IndexOf("assert", StringComparison.OrdinalIgnoreCase) <= 0 && text.IndexOf("error", StringComparison.OrdinalIgnoreCase) <= 0)
                                    {
                                        break;
                                    }
                                }
                            }
                        }
                    }
                    if (text != null)
                    {
                        string text6 = text;
                        try
                        {
                            int num3 = text.LastIndexOf(Type.Delimiter + ".");
                            if (num3 < 0)
                            {
                                num3 = text.LastIndexOf(Type.Delimiter);
                            }
                            text6 = text.Substring(0, num3);
                        }
                        catch
                        {
                        }
                        Type type = Type.GetType(text6);
                        if (type == null)
                        {
                            foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies())
                            {
                                type = assembly.GetType(text6);
                                if (type != null)
                                {
                                    break;
                                }
                            }
                        }
                        if (type != null)
                        {
                            if (WatsonReport.IsAssemblyDynamic(type.Assembly))
                            {
                                s = "[Dynamic Assembly]";
                                v = new Version(0, 0, 0, 0);
                            }
                            else
                            {
                                try
                                {
                                    s = Path.GetFileName(type.Assembly.Location);
                                }
                                catch
                                {
                                }
                                try
                                {
                                    object[] customAttributes = type.Assembly.GetCustomAttributes(typeof(AssemblyFileVersionAttribute), false);
                                    if (customAttributes.Length == 1)
                                    {
                                        AssemblyFileVersionAttribute assemblyFileVersionAttribute = customAttributes[0] as AssemblyFileVersionAttribute;
                                        if (assemblyFileVersionAttribute != null)
                                        {
                                            v = new Version(assemblyFileVersionAttribute.Version);
                                        }
                                    }
                                }
                                catch
                                {
                                }
                            }
                        }
                    }
                    PropertyInfo propertyInfo = (baseException == null) ? null : baseException.GetType().GetProperty("DiagCtx");
                    if (propertyInfo != null)
                    {
                        MethodInfo getMethod = propertyInfo.GetGetMethod();
                        object     obj2      = getMethod.Invoke(baseException, null);
                        this.lids = obj2.ToString();
                        MatchCollection matchCollection2 = WatsonExceptionReport.regexLids.Matches(this.lids);
                        foreach (object obj3 in matchCollection2)
                        {
                            Match match2 = (Match)obj3;
                            if (match2.Groups.Count >= 2)
                            {
                                string value = match2.Groups[0].Value;
                                num  = WatsonReport.ComputeHash(value, num);
                                num2 = Convert.ToInt32(match2.Groups[1].Value);
                                if (match2.Groups.Count == 4)
                                {
                                    text4 = match2.Groups[3].Value;
                                }
                            }
                        }
                        num &= 65535;
                    }
                    if (ExWatson.MsInternal)
                    {
                        base.CrashDetails = WatsonReport.GetValidString(this.GetExWatsonCrashDetailsString());
                    }
                }
                catch
                {
                }
            }
            if (baseException != null && baseException.TargetSite != null)
            {
                this.baseExceptionTargetSite = base.EvaluateOrDefault <string>(delegate
                {
                    RuntimeMethodHandle methodHandle = baseException.TargetSite.MethodHandle;
                    IntPtr value2 = baseException.TargetSite.MethodHandle.Value;
                    return(baseException.TargetSite.MethodHandle.Value.ToString());
                }, "unknown");
                this.baseExceptionAssemblyName = base.EvaluateOrDefault <string>(delegate
                {
                    if (baseException.TargetSite.Module == null)
                    {
                        return("unknown");
                    }
                    return(baseException.TargetSite.Module.Name ?? "unknown");
                }, "unknown");
                this.baseExceptionMethodName = base.EvaluateOrDefault <string>(delegate
                {
                    string text7 = null;
                    if (baseException.TargetSite.ReflectedType != null)
                    {
                        text7 = baseException.TargetSite.ReflectedType.FullName;
                    }
                    string name = baseException.TargetSite.Name;
                    if (text7 == null || name == null)
                    {
                        return("unknown");
                    }
                    return(text7 + "." + name);
                }, "unknown");
            }
            else
            {
                this.baseExceptionTargetSite   = "unknown";
                this.baseExceptionAssemblyName = "unknown";
                this.baseExceptionMethodName   = "unknown";
            }
            try
            {
                if (this.lids != null)
                {
                    text3 = text3 + "-" + Convert.ToString(num, 16);
                    this.baseExceptionAssemblyName = this.baseExceptionAssemblyName + "-" + num2;
                    if (text4 != null)
                    {
                        text2 = text2 + "-" + text4;
                    }
                }
            }
            catch
            {
            }
            base.SetBucketingParameter <WatsonExceptionReport.BucketParamId>(WatsonExceptionReport.BucketParamId.ExceptionType, WatsonReport.GetValidString(text2));
            base.SetBucketingParameter <WatsonExceptionReport.BucketParamId>(WatsonExceptionReport.BucketParamId.AssemblyName, WatsonReport.GetValidString(s));
            base.SetBucketingParameter <WatsonExceptionReport.BucketParamId>(WatsonExceptionReport.BucketParamId.AssemblyVer, WatsonReport.ExchangeFormattedVersion(v));
            base.SetBucketingParameter <WatsonExceptionReport.BucketParamId>(WatsonExceptionReport.BucketParamId.ExMethodName, WatsonReport.GetValidString(text));
            base.SetBucketingParameter <WatsonExceptionReport.BucketParamId>(WatsonExceptionReport.BucketParamId.CallstackHash, WatsonReport.GetValidString(text3));
        }
Exemplo n.º 27
0
        protected override void PrepareBucketingParameters()
        {
            string s = "unknown";

            if (base.Exception != null)
            {
                s = base.Exception.GetType().ToString();
            }
            base.SetBucketingParameter <WatsonExceptionReport.BucketParamId>(WatsonExceptionReport.BucketParamId.ExceptionType, WatsonReport.GetValidString(s));
            base.SetBucketingParameter <WatsonExceptionReport.BucketParamId>(WatsonExceptionReport.BucketParamId.AssemblyName, "unknown");
            base.SetBucketingParameter <WatsonExceptionReport.BucketParamId>(WatsonExceptionReport.BucketParamId.AssemblyVer, "unknown");
            base.SetBucketingParameter <WatsonExceptionReport.BucketParamId>(WatsonExceptionReport.BucketParamId.ExMethodName, "unknown");
            base.SetBucketingParameter <WatsonExceptionReport.BucketParamId>(WatsonExceptionReport.BucketParamId.CallstackHash, "0");
        }