【发布时间】:2014-01-30 02:35:25
【问题描述】:
我几天来一直在尝试记录此异常,但无法弄清楚。所以我想我把它贴在这里,希望有人能提供帮助。我还发布了一些我目前用来捕获未处理异常的代码,但异常从未出现在日志文件中。
如果有人可以帮助我,我将不胜感激。
问题事件名称:APPCRASH
应用程序名称:Myapp.exe
应用程序版本:1.0.0.0
申请时间戳:52e9aab8
故障模块名称:clr.dll
故障模块版本:4.0.30319.18052
故障模块时间戳:5173c26b
异常代码:c00000fd
异常偏移量:00372b52
操作系统版本:6.1.7601.2.1.0.272.7
区域设置 ID:1033
附加信息 1:5cff
附加信息 2:5cfff2c5825852a6f100872ec6f038a2
附加信息 3:a2a3
附加信息4:a2a3734c473189c5efabc88b5081d05a
public MainWindow()
{
Application.Current.DispatcherUnhandledException += CurrentOnDispatcherUnhandledException;
AppDomain.CurrentDomain.UnhandledException += CurrentDomainOnUnhandledException;
Dispatcher.UnhandledException += DispatcherOnUnhandledException;
InitializeComponent();
}
private void DispatcherOnUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs args)
{
Exception e = (Exception)args.Exception;
using (StreamWriter writer = File.AppendText("ExceptionsLog.txt"))
{
DateTime time = DateTime.Now;
writer.WriteLine("Time {0} Exception: {1}", time, e);
writer.Flush();
}
args.Handled = true;
MessageBox.Show(e.ToString());
}
private void CurrentDomainOnUnhandledException(object sender, UnhandledExceptionEventArgs args)
{
Exception e = (Exception)args.ExceptionObject;
using (StreamWriter writer = File.AppendText("ExceptionsLog.txt"))
{
DateTime time = DateTime.Now;
writer.WriteLine("Time {0} Exception: {1} Runtime termination: {2}", time, e.Message, args.IsTerminating);
writer.Flush();
}
MessageBox.Show(e.ToString());
}
private void CurrentOnDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs args)
{
Exception e = (Exception)args.Exception;
using (StreamWriter writer = File.AppendText("ExceptionsLog.txt"))
{
DateTime time = DateTime.Now;
writer.WriteLine("Time {0} Exception: {1}", time, e);
writer.Flush();
}
args.Handled = true;
MessageBox.Show(e.ToString());
}
【问题讨论】:
-
c00000fd是一个堆栈溢出。据推测,堆栈空间不足是导致它无法被记录的原因。