本文介紹了當 finally 不在 .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?
推薦答案
兩種可能:
- StackOverflowException
- ExecutionEngineException
當存在 StackOverflowException
時,finally 塊將不會被執行,因為堆棧上沒有空間可以執行更多代碼.當存在 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()
.
這篇關于當 finally 不在 .net try..finally 塊中執行時的條件的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!