Quantcast
Channel: Conditions when finally does not execute in a .NET try-finally block - Stack Overflow
Browsing all 8 articles
Browse latest View live

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 Article



Answer 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 Article

Answer 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 Article

Answer by Nicu for Conditions when finally does not execute in a .NET...

There is also Application.Exit method.

View Article

Answer 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 Article


Answer 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 Article

Answer 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 Article

Conditions 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

Browsing all 8 articles
Browse latest View live




Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>
<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596344.js" async> </script>