6
Reply

As we all know that if there is try-catch-finally or try-finally block then finally block is always executed. But this is not the case every time. There are scenarios when even finally block dos not execute. What are those scenarios?

Brij Mishra

Brij Mishra

Jun 12, 2013
2.8k
0

    System.exit();

    Ramu Yadav
    May 03, 2016
    0

    try Environment.exit(0) inside a try block...

    kalaivanan sakthivel
    October 16, 2015
    0

    when page state is changed inside try block.

    Deepak Kumar Jena
    December 15, 2014
    0

    when page state is changed inside try block.

    Deepak Kumar Jena
    December 15, 2014
    0

    The finally block will not be executed when there's a StackOverflowException for similar kind of c# interview questions refer this link c# interview questions

    Krishna Mohan
    July 16, 2014
    0

    As mentioned in the question, there are few scenarios when even finally block does not get executed. Finally block does not execute when the following type of exception occurs
    •ExecutionEngineException
    •StackOverflowException
    ExecutionEngineException occurs when there is some error in Common Language Runtime. A case could be if there is some exception while executing garbage collection. This exception also occurs if Environment.FailFast() fired.
    StackOverflowException occurs when there is no space available in stack to execute further.

    Brij Mishra
    June 12, 2013
    0