示例#1
0
        public override void NETErrorEventRecordWritten(object sender, System.Diagnostics.Eventing.Reader.EventRecordWrittenEventArgs e)
        {
            EventRecord r = e.EventRecord;

            // parse the data from the log's properties
            List <string> data = new List <string>();

            foreach (EventProperty prop in r.Properties)
            {
                data.AddRange(prop.Value.ToString().Split('\n'));
            }

            // verify that it is related to the users app
            string appName = Path.GetFileNameWithoutExtension(Dte.Solution.FullName);

            if (data.Contains(appName + ".exe") && r.ProviderName == "Application Error")
            {
                // the user's app crashed while they ran it outside of debug mode.

                int code = int.Parse(data[6], System.Globalization.NumberStyles.HexNumber);

                // TODO: find name/type of exception from code

                EnvDTE.dbgExceptionAction action = dbgExceptionAction.dbgExceptionActionBreak;
                HandleException("Unknown Exception Type", "Unhandled exception", code, "The program encountered an unhandled run-time exception.", ref action);
            }
        }
示例#2
0
 public void OnExceptionThrown(string exceptionType, string name, int code, string description, ref EnvDTE.dbgExceptionAction exceptionAction)
 {
     exceptionAction = EnvDTE.dbgExceptionAction.dbgExceptionActionDefault;
     _outputWindowPane.OutputString("DebuggerEvents, OnExceptionThrown\n");
 }