Answer by Melvyn for Conditions when finally does not execute in a .NET...
Since async/await, there is another way a finally might get ignored that I haven't seen mentioned in other answers:static class Program{ [STAThread] static void Main() { async void...
View ArticleAnswer by Navneet for Conditions when finally does not execute in a .NET...
Finally block on background thread may not execute. However, It depends upon the completed execution of main foreground thread which terminates background thread operation even before the complete...
View ArticleAnswer by supercat for Conditions when finally does not execute in a .NET...
Neither code which follows a finally block, nor code in outer scopes, will execute without the finally block having been started first (an exception within the finally block may cause it to exit...
View ArticleAnswer by Nicu for Conditions when finally does not execute in a .NET...
There is also Application.Exit method.
View ArticleAnswer by Chris for Conditions when finally does not execute in a .NET...
You can get a situation where the code in the try block causes a SecurityException to be thrown before the try block entered (instead the exception is thrown when the containing method is called (see...
View ArticleAnswer by Haacked for Conditions when finally does not execute in a .NET...
Two possibilities:StackOverflowExceptionExecutionEngineExceptionThe finally block will not be executed when there's a StackOverflowException since there's no room on the stack to even execute any more...
View ArticleAnswer by Gishu for Conditions when finally does not execute in a .NET...
Unless the CLR blows up and goes down with an ExecutingEngineException (I've seen a few in the .net 1.1 days with just the right amount of COM Interop :) .. I think finally should always execute.
View ArticleConditions when finally does not execute in a .NET try-finally block
Basically I’ve heard that certain conditions will cause .NET to blow past the finally block. Does anyone know what those conditions are?
View Article
More Pages to Explore .....