条件时,终于在一个.NET try..finally块不执行 [英] Conditions when finally does not execute in a .net try..finally block
本文介绍了条件时,终于在一个.NET try..finally块不执行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
基本上,我听说某些情况下会导致.NET吹过去finally块。有谁知道那些条件?
Basically I've heard that certain conditions will cause .net to blow past the finally block. Does anyone know what those conditions are?
推荐答案
两种可能性:
- <一个href="http://msdn.microsoft.com/en-us/library/system.stackoverflowexception.aspx">StackOverflowException
- <一个href="http://msdn.microsoft.com/en-us/library/system.executionengineexception.aspx">ExecutionEngineException
- StackOverflowException
- ExecutionEngineException
当有finally块将不被执行 StackOverflowException
,因为没有空间在堆栈上,甚至执行更多的code。它还将时候有没有被称为 ExecutionEngineException
,可能出现通过调用 Environment.FailFast()
。
The finally block will not be executed when there's a StackOverflowException
since there's no room on the stack to even execute any more code. It will also not be called when there's an ExecutionEngineException
, which may arise from a call to Environment.FailFast()
.
这篇关于条件时,终于在一个.NET try..finally块不执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文