登录.NET中StackOverflowException [英] log a StackOverflowException in .NET

查看:96
本文介绍了登录.NET中StackOverflowException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近,我在我的.net应用程序(asp.net网站),这我知道,因为它在我的EventLog出现了有一个堆栈溢出异常。我明白,一个计算器的异常不能被捕获或处理,但有一个它杀死你的应用程序之前,记录它的方式?我有10万线code的。如果我知道堆栈跟踪,或者只是堆栈跟踪的一部分,我可以跟踪无限循环/递归的来源。但是,如果没有任何有用的诊断信息,它看起来像它会采取很多猜测和测试的。

I recently had a stack overflow exception in my .NET app (asp.net website), which I know because it showed up in my EventLog. I understand that a StackOverflow exception cannot be caught or handled, but is there a way to log it before it kills your application? I have 100k lines of code. If I knew the stack trace, or just part of the stack trace, I could track down the source of the infinite loop/recursion. But without any helpful diagnostic information, it looks like it'll take a lot of guess-and-test.

我试过(在Global.asax中)我的应用程序域设置未处理的异常处理程序,但这似乎并没有执行,这是有道理的,如果一个堆栈溢出应该终止,不运行任何catch / finally块。

I tried setting up an unhandled exception handler on my app domain (in global.asax), but that didn't seem to execute, which makes sense if a stack overflow is supposed to terminate and not run any catch/finally blocks.

有什么办法来记录这些,或者是有一些秘密的设置,我可以启用将在栈帧保存到磁盘时,应用程序崩溃?

Is there any way to log these, or is there some secret setting that I can enable that will save the stack frames to disk when the app crashes?

推荐答案

您最好的选择是使用 ADPlus的

Windows NT内核调试队有一个很好的关于如何捕捉异常CLR用它的博客文章。有很多对有关于不同的配置选项的详细信息吧。

The Windows NT Kernel Debugging Team has a nice blog post on how to catch CLR exceptions with it. There are a lot of details on that there about different configuration options for it.

则ADPlus将监视应用程序。您可以指定它崩溃模式运行,所以你可以告诉ADPlus将采取内存转储权作为StackOverflowException发生。

ADPlus will monitor the application. You can specify that it run in crash mode so you can tell ADPlus to take a memory dump right as the StackOverflowException is happening.

一旦你有一个内存转储,您可以使用WinDbg和托管调试扩展如 Psscor 看到堆栈溢出过程中发生了什么事情。

Once you have a memory dump, you can use WinDbg and a managed debugging extension like Psscor to see what was going on during the stack overflow.

这篇关于登录.NET中StackOverflowException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆