private void OnException(Exception ex) { System.Windows.Markup.XamlParseException xamlexc = ex as System.Windows.Markup.XamlParseException; System.IO.FileFormatException ffexc = ex as System.IO.FileFormatException; string message = "ERROR: EXCEPTION " + ex.Message; if (xamlexc != null) { message = string.Format("ERROR: Exiting because configuration file {0} is confusing at line {1}", xamlexc.BaseUri.AbsolutePath, xamlexc.LineNumber); } else if (ffexc != null) { message = "ERROR: Exiting because configuration file is confusing " + ffexc.SourceUri; if (ffexc.InnerException != null) { message += "\n" + ffexc.InnerException.Message; } } else { message += ex.StackTrace; } MessageBoxResult alert = MessageBox.Show(message); Application.Current.Shutdown(); }
public SourceCodeError GetSourceCodeError(System.Windows.Markup.XamlParseException exception) { return(new SourceCodeError( GetExceptionMessage(exception), TryGetSingleLineLocation(lineNumber: exception.LineNumber - 1, positionInLine: exception.LinePosition - 1, text: Document.Text))); }