Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8081789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T16:50:53+00:00 2026-06-05T16:50:53+00:00

Why isn’t the line Console.WriteLine(asdf); executed? All the others are. Shouldn’t it also be

  • 0

Why isn’t the line “Console.WriteLine(“asdf”);” executed? All the others are. Shouldn’t it also be as we can’t jump out from the finally scope?

static bool Func()
{
    try
    {
        try
        {
        }
        finally
        {
            try
            {
                throw new ApplicationException();
            }
            finally
            {
                Console.WriteLine("asd");
            }

            Console.WriteLine("asdf");
        }
    }
    finally
    {
        Console.WriteLine("asd");
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T16:50:55+00:00Added an answer on June 5, 2026 at 4:50 pm

    Finally blocks only guarantee (at least mostly guarantee, see excerpt from MSDN below) that they will be entered in the event that the try block throws an exception. If you throw an exception within the finally block, the exception will cause control to leave the finally block and the rest of the code within that finally block will not execute.

    In your case, the line that isn’t being executed is occurring after an exception in the same finally block, so it gets skipped.

    From MSDN – try-finally:

    The finally block is useful for cleaning up any resources that are
    allocated in the try block, and for running any code that must execute
    even if an exception occurs in the try block. Typically, the
    statements of a finally block are executed when control leaves a try
    statement, whether the transfer of control occurs as a result of
    normal execution, of execution of a break, continue, goto, or return
    statement, or of propagation of an exception out of the try statement.

    Within a handled exception, the associated finally block is guaranteed
    to be run. However, if the exception is unhandled, execution of the
    finally block is dependent on how the exception unwind operation is
    triggered. That, in turn, is dependent on how your computer is set up.
    For more information, see Unhandled Exception Processing in the CLR.

    Note: Unhandled Exception Processing in the CLR is a reference to an article in the September 2008 issue of the MSDN Magazine. All 2008 and older issues of MSDN Magazine are only available as .chm files, and will need to be downloaded before viewing.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Isn't every language compiled into low-level computer language? If so, shouldn't all languages have
Isn't there a better looking statement (or way) to keep the console from disappearing
Isn't this sort of a thumb-rule? Shouldn't this be served from a cookie-less domain?
Isn't possible facebook allow us from my apps post or share image to user
1) Isn't it a bad practice to use these attributes on all of my
Isn't it true that every assert statement can be translated to an Assert.IsTrue, since
This isn't homework for me , it's a task given to students from some
Isn't having all of the files in public view a bad thing? Surely things
Isn't JavaScript enabled in all webbrowsers by default? if yes, does this mean that
Isn't var a keyword in C#? But why can I do this: public class

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.