// Token: 0x06002329 RID: 9001 RVA: 0x000ACAF4 File Offset: 0x000AACF4 internal static void ThrowException(string message, Exception innerException, int lineNumber, int linePosition, Uri baseUri, XamlObjectIds currentXamlObjectIds, XamlObjectIds contextXamlObjectIds, Type objectType) { if (innerException != null && innerException.Message != null) { StringBuilder stringBuilder = new StringBuilder(message); if (innerException.Message != string.Empty) { stringBuilder.Append(" "); } stringBuilder.Append(innerException.Message); message = stringBuilder.ToString(); } string str = XamlParseException.GenerateErrorMessageContext(lineNumber, linePosition, baseUri, currentXamlObjectIds, objectType); message = message + " " + str; XamlParseException ex; if (innerException is TargetInvocationException && innerException.InnerException is XamlParseException) { ex = (XamlParseException)innerException.InnerException; } else if (lineNumber > 0) { ex = new XamlParseException(message, lineNumber, linePosition, innerException); } else { ex = new XamlParseException(message, innerException); } if (contextXamlObjectIds != null) { ex.NameContext = contextXamlObjectIds.Name; ex.UidContext = contextXamlObjectIds.Uid; ex.KeyContext = contextXamlObjectIds.Key; } ex.BaseUri = baseUri; if (TraceMarkup.IsEnabled) { TraceMarkup.TraceActivityItem(TraceMarkup.ThrowException, ex); } throw ex; }
// Token: 0x06002328 RID: 9000 RVA: 0x000AC940 File Offset: 0x000AAB40 internal static string GenerateErrorMessageContext(int lineNumber, int linePosition, Uri baseUri, XamlObjectIds xamlObjectIds, Type objectType) { string result = " "; string markupFilePath = XamlParseException.GetMarkupFilePath(baseUri); string text = null; if (xamlObjectIds != null) { if (xamlObjectIds.Name != null) { text = xamlObjectIds.Name; } else if (xamlObjectIds.Key != null) { text = xamlObjectIds.Key.ToString(); } else if (xamlObjectIds.Uid != null) { text = xamlObjectIds.Uid; } } if (text == null && objectType != null) { text = objectType.ToString(); } XamlParseException.ContextBits contextBits = (XamlParseException.ContextBits) 0; if (text != null) { contextBits |= XamlParseException.ContextBits.Type; } if (!string.IsNullOrEmpty(markupFilePath)) { contextBits |= XamlParseException.ContextBits.File; } if (lineNumber > 0) { contextBits |= XamlParseException.ContextBits.Line; } switch (contextBits) { case (XamlParseException.ContextBits) 0: result = string.Empty; break; case XamlParseException.ContextBits.Type: result = SR.Get("ParserErrorContext_Type", new object[] { text }); break; case XamlParseException.ContextBits.File: result = SR.Get("ParserErrorContext_File", new object[] { markupFilePath }); break; case XamlParseException.ContextBits.Type | XamlParseException.ContextBits.File: result = SR.Get("ParserErrorContext_Type_File", new object[] { text, markupFilePath }); break; case XamlParseException.ContextBits.Line: result = SR.Get("ParserErrorContext_Line", new object[] { lineNumber, linePosition }); break; case XamlParseException.ContextBits.Type | XamlParseException.ContextBits.Line: result = SR.Get("ParserErrorContext_Type_Line", new object[] { text, lineNumber, linePosition }); break; case XamlParseException.ContextBits.File | XamlParseException.ContextBits.Line: result = SR.Get("ParserErrorContext_File_Line", new object[] { markupFilePath, lineNumber, linePosition }); break; case XamlParseException.ContextBits.Type | XamlParseException.ContextBits.File | XamlParseException.ContextBits.Line: result = SR.Get("ParserErrorContext_Type_File_Line", new object[] { text, markupFilePath, lineNumber, linePosition }); break; } return(result); }