本文整理汇总了C#中System.UnhandledExceptionEventArgs.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# UnhandledExceptionEventArgs.ToString方法的具体用法?C# UnhandledExceptionEventArgs.ToString怎么用?C# UnhandledExceptionEventArgs.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.UnhandledExceptionEventArgs
的用法示例。
在下文中一共展示了UnhandledExceptionEventArgs.ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CurrentDomain_UnhandledException
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
Console.WriteLine(e.ToString());
_Log.Fatal(e.ToString());
Console.ReadLine();
}
示例2: AppDomainUnhandledException
/// <summary>
/// </summary>
/// <param name="sender"> </param>
/// <param name="e"> </param>
protected virtual void AppDomainUnhandledException(object sender, UnhandledExceptionEventArgs e)
{
#if !DEBUG
Trace.WriteLine(e.ToString());
#else
Debug.WriteLine(e.ToString());
#endif
}
示例3: CurrentDomain_UnhandledException
public void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
if (e.IsTerminating)
{
Fatal("Application Fatal!", new Exception(string.Format("Exception Object:{0} UnhandledExceptionEventArgs:{1}",e.ExceptionObject.ToString(),e.ToString())));
}
else
{
Error("Application Error!", new Exception(string.Format("Exception Object:{0} UnhandledExceptionEventArgs:{1}", e.ExceptionObject.ToString(), e.ToString())));
}
}
示例4: CurrentDomain_UnhandledException
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
string str = GetExceptionMsg(e.ExceptionObject as Exception, e.ToString());
Loger.Error(str);
//MessageBox.Show(str, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
//LogManager.WriteLog(str);
}
示例5: CurrentDomainUnhandledException
private static void CurrentDomainUnhandledException(object sender, UnhandledExceptionEventArgs e)
{
if (!(e.ExceptionObject is ThreadAbortException))
{
System.Diagnostics.EventLog.WriteEntry("low-level-sendkeys", "Unhandled Exception at socket-server: " + e.ToString());
}
}
示例6: UnhandledException
static void UnhandledException(object sender, UnhandledExceptionEventArgs exception)
{
string logfile = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase) + "\\logfile.txt";
StreamWriter writer = new StreamWriter(logfile, true);
writer.WriteLine(DateTime.Now.ToString() + " Main Application Bombed - " + exception.ToString());
writer.Close();
}
示例7: CurrentDomain_UnhandledException
static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
string str = GetExceptionMsg(e.ExceptionObject as Exception, e.ToString());
//MessageBox.Show(str, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
if (_sendErrorEmail)
UserUtils.SendEmail("错误日志", str);
//LogManager.WriteLog(str);
log.Error(str);
}
示例8: UnhandledExceptionEventHandler
static void UnhandledExceptionEventHandler(object sender, UnhandledExceptionEventArgs e)
{
try
{
ComForm.InsertErrLog("ExceptionObject" + e.ExceptionObject + "," + e.ToString(), "ERROR");
}
catch
{
}
}
示例9: CurrentDomain_UnhandledException
static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
if (!Globals.IsSilentInstall) {
MessageBox.Show(((Exception)e.ExceptionObject).ToString());
} else {
Globals.SilentInstallCommunicationPipeStream.WriteString("[Error]" + e.ToString());
Globals.SilentInstallCommunicationPipe.WaitForPipeDrain();
Globals.SilentInstallCommunicationPipe.Close();
System.Environment.Exit(0);
}
}
示例10: CurrentDomain_UnhandledException
static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
string str = "";
Exception error = e.ExceptionObject as Exception;
if (error != null)
str = string.Format("UnhandledException:{0};\n\r堆栈信息:{1}", error.Message, error.StackTrace);
else
str = string.Format("Application UnhandledError:{0}", e);
Common.WriteLogFile("未知异常:" + str);
MessageBox.Show("未知异常,请联系作者:"+e.ToString());
}
示例11: CurrentDomain_UnhandledException
static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
Debugger.Instance.logMessage("APP DOMAIN CRASH ", e.ToString());
StackTrace trace = new StackTrace(true);
for (int i = 0; i < trace.FrameCount; i++)
{
StackFrame sf = trace.GetFrame(i);
Debugger.Instance.logMessage("High up the call stack, Method: ", sf.GetMethod().ToString());
Debugger.Instance.logMessage("High up the call stack, Method: ", sf.GetFileLineNumber().ToString());
}
}
示例12: CurrentDomain_UnhandledException
/// <summary>
/// This method is used to trap unhanded exceptions in the service and log them before the service closes.
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="e">The exception arguments.</param>
void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
if (e == null)
{
EventLog.WriteEntry(this.ServiceName, "SERVICE CRASH - no data was passed.", EventLogEntryType.Error);
return;
}
Exception ex = e.ExceptionObject as Exception;
if (ex == null)
{
EventLog.WriteEntry(this.ServiceName,
"SERVICE CRASH THE FOLLOWING ERROR CAUSED THE SERVICE TO FAIL: "
+ e.ToString(), EventLogEntryType.Error);
return;
}
EventLog.WriteEntry(this.ServiceName,
"SERVICE CRASH THE FOLLOWING ERROR CAUSED THE SERVICE TO FAIL: " + ex.Message
+ Environment.NewLine + Environment.NewLine + ex.ToString(), EventLogEntryType.Error);
}
示例13: UnhandledException
public static void UnhandledException(object sender, UnhandledExceptionEventArgs ex)
{
string logPath = Environment.GetCommandLineArgs()[0] + ".log";
if (!File.Exists(logPath))
{
File.AppendText(logPath);
}
StreamWriter logFile = new StreamWriter(logPath, true);
logFile.WriteLine();
logFile.WriteLine();
logFile.WriteLine();
logFile.WriteLine("-----------------------------------------");
logFile.WriteLine("System Environment is " + System.Environment.OSVersion.Platform + " With " + System.Environment.ProcessorCount + " Logical Cores");
logFile.WriteLine("Application Arguments were " + Environment.GetCommandLineArgs());
logFile.WriteLine("Exception occurred at {0}", DateTime.Now.ToString());
logFile.WriteLine("-----------------------------------------");
logFile.WriteLine(ex.ToString());
logFile.WriteLine("-----------------------------------------");
logFile.Flush();
logFile.Close();
}
示例14: CurrentDomain_UnhandledException
void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
logger.Trace(e.ToString());
}
示例15: LogUnhandledException
/// <summary>
/// A handler for all uncaught exceptions. We log, but we'll still die
/// </summary>
/// <param name="sender"></param>
/// <param name="args"></param>
void LogUnhandledException(object sender, UnhandledExceptionEventArgs args)
{
Exception e = (Exception)args.ExceptionObject;
logger.Log("Got unhandled exception from {0}: {1}\nException: {2}", sender.ToString(), args.ToString(), e.ToString());
}