如上图
我在program.cs里加入了记录无法处理异常的代码,但是没有记录任何日志 static Program()
{
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
} static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
string strException = string.Format("{0}发生系统异常。\r\n{1}\r\n\r\n\r\n", DateTime.Now, e.ExceptionObject.ToString());
File.AppendAllText(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "SystemException.log"), strException);
}
我在program.cs里加入了记录无法处理异常的代码,但是没有记录任何日志 static Program()
{
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
} static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
string strException = string.Format("{0}发生系统异常。\r\n{1}\r\n\r\n\r\n", DateTime.Now, e.ExceptionObject.ToString());
File.AppendAllText(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "SystemException.log"), strException);
}
那就是线程的原因http://www.bianceng.cn/Programming/csharp/201107/27675.htm
是不是只要线程访问的资源都最好lock一下呢?
请问 winform 也会有 缓存 的么??
加了很多错误日志,还在program.cs里加了对无法处理异常的记录日志。但都没有捕获到。