如何处理 System.StackOverflowException

.Net 2.0 以后 StackOverflowException 异常会导致整个进程退出,无法catch该异常,即便用AppDomain隔离也一样。

唯一的办法是通过 ICLRPolicyManager,我没有深究,有兴趣的同学 参考:ICLRPolicyManager Interface

 

如果你碰到这种程序崩溃又无法记录日志的情况,可以先检查一下“Windows事件管理器”

看是否有 异常代码: 0xc00000fd 

如果有,很有可能是你代码里面包含无法终止的递归调用,睁大眼睛,仔细检查吧,我没辙了哈。

 

参考:

StackOverflowException Class

Troubleshooting Exceptions: System.StackOverflowException

C# catch a stack overflow exception

posted @ 2014-05-12 17:08  sweetjian  阅读(5497)  评论(0编辑  收藏  举报