应用程序崩溃时没有致命异常的迹象 | NLog 版本 2 |紧凑框架3.5
我有一个 .Net Compact Framework 3.5 应用程序,它使用 Nlog 2.0 版来记录信息、错误和致命异常。大多数情况下,日志记录会按预期工作,并在崩溃之前记录致命异常。但有时我们会观察到应用程序崩溃时没有留下任何错误/异常的迹象。
让我详细说明一下场景:
- 应用程序创建了几个线程,所有线程都在其调用堆栈的开头添加了 try-catch 块。因此记录胎儿 崩溃前的异常。
- 主线程有“AppDomain.CurrentDomain.UnhandledException”来记录其调用堆栈上的任何胎儿异常。
- 应用程序确实加载了一些第三方托管的 dll,并对 Wnce dll 执行了一些 PInvoke。
但我相信,即使某些第三方 DLL 崩溃(或者假设它创建了一个崩溃的新线程),我至少应该在日志中看到一些 ThreadAbortExceptions,由我的应用程序线程在退出之前记录。
Nlog的关键配置参数有:
a. FileTarget.AutoFlush = true
b. FileTarget.KeepFileOpen= false
c. FileTarget 未包装在任何异步包装器或任何缓冲中 包装器。
如果我遗漏了什么,请告诉我。
I have a .Net Compact Framework 3.5 application that uses Nlog version 2.0 to log Info, Error and Fatal Exceptions. Most of the time the logging works as expected and logs fatal exceptions before crashing. But at times it is observed that application crashes without leaving any signs of an error/exception.
Let me elaborate the scenario:
- The Application creates few threads, all the threads have try-catch block added at the beginning of their call stacks. And hence log fetal
exceptions before crashing.- The main thread have 'AppDomain.CurrentDomain.UnhandledException' to log any fetal exceptions on its call stack.
- The application does load some third party managed dlls and performs some PInvokes on Wnce dlls.
But I believe even if some third party DLL crashes (or let’s say it creates a new thread which crashes), I should at least see some ThreadAbortExceptions
in the log, logged by my application's thread before exiting.
The key configuration parameters of Nlog are:
a. FileTarget.AutoFlush = true
b. FileTarget.KeepFileOpen= false
c. FileTarget is not wrapped in any async wrapper or in any buffered
wrapper.
Please let me know if I'm missing anything.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
崩溃的可能原因包括 OutOfMemory 异常或 StackOverflowException。来自后者的文档:
Possible reasons for the crash include OutOfMemory exception or StackOverflowException. From the documentation for the latter: