private void AddSpecialCaseDetails(InnerError error) { if (!error.Data.ContainsKey(Error.KnownDataKeys.ExtraProperties)) { return; } var extraProperties = error.Data.GetValue <Dictionary <string, object> >(Error.KnownDataKeys.ExtraProperties); if (extraProperties == null) { return; } object value; if (extraProperties.TryGetValue("Number", out value)) { SignatureInfo.Add("Number", value.ToString()); } if (extraProperties.TryGetValue("ErrorCode", out value)) { SignatureInfo.Add("ErrorCode", value.ToString()); } }
private void AddSpecialCaseDetails(ErrorInfo error) { if (!error.ExtendedData.ContainsKey(ExtendedDataDictionary.EXCEPTION_INFO_KEY)) { return; } var extraProperties = error.ExtendedData.GetValue <Dictionary <string, object> >(ExtendedDataDictionary.EXCEPTION_INFO_KEY); if (extraProperties == null) { return; } if (extraProperties.ContainsKey("Number")) { SignatureInfo.Add("Number", extraProperties["Number"].ToString()); } if (extraProperties.ContainsKey("ErrorCode")) { SignatureInfo.Add("ErrorCode", extraProperties["ErrorCode"].ToString()); } }
private void Parse() { SignatureInfo.Clear(); // start at the inner most exception and work our way out until we find a user method InnerError current = Error; var errorStack = new List <InnerError> { current }; while (current.Inner != null) { current = current.Inner; errorStack.Add(current); } errorStack.Reverse(); // reset all flags before we figure out which method to tag as the new target. if (ShouldFlagSignatureTarget) { errorStack.ForEach(es => es.StackTrace.ForEach(st => st.IsSignatureTarget = false)); } foreach (InnerError e in errorStack) { StackFrameCollection stackTrace = e.StackTrace; if (stackTrace == null) { continue; } foreach (StackFrame stackFrame in stackTrace.Where(IsUserFrame)) { SignatureInfo.AddItemIfNotEmpty("ExceptionType", e.Type); SignatureInfo.AddItemIfNotEmpty("Method", GetStackFrameSignature(stackFrame)); if (ShouldFlagSignatureTarget) { stackFrame.IsSignatureTarget = true; } AddSpecialCaseDetails(e); UpdateInfo(true); return; } } // We haven't found a user method yet, try some alternatives with the inner most error. InnerError innerMostError = errorStack[0]; if (innerMostError.TargetMethod != null) { // Use the target method if it exists. SignatureInfo.AddItemIfNotEmpty("ExceptionType", innerMostError.Type); SignatureInfo.AddItemIfNotEmpty("Method", GetStackFrameSignature(innerMostError.TargetMethod)); if (ShouldFlagSignatureTarget) { innerMostError.TargetMethod.IsSignatureTarget = true; } } else if (innerMostError.StackTrace != null && innerMostError.StackTrace.Count > 0) { // Use the topmost stack frame. SignatureInfo.AddItemIfNotEmpty("ExceptionType", innerMostError.Type); SignatureInfo.AddItemIfNotEmpty("Method", GetStackFrameSignature(innerMostError.StackTrace[0])); if (ShouldFlagSignatureTarget) { innerMostError.StackTrace[0].IsSignatureTarget = true; } } else { // All else failed, use the type. SignatureInfo.AddItemIfNotEmpty("ExceptionType", innerMostError.Type); } AddSpecialCaseDetails(innerMostError); if (SignatureInfo.Count == 0) { SignatureInfo.Add("NoStackingInformation", Guid.NewGuid().ToString()); } UpdateInfo(false); }