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 7947067
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T01:19:36+00:00 2026-06-04T01:19:36+00:00

I am running this test case using NUNIT and attaching the NUNIT to the

  • 0

I am running this test case using NUNIT and attaching the NUNIT to the Visual studio debugger (Debug —> Attach to Process —> Select nunit.exe).

I was expecting the statement “throw new Exception(“Exception 1 occured!”);”to move the control into the catch block but
the control does not jump to the “catch” but instead jumps to method2().

When I just run the nunit test case without attaching nunit.exe to the Visual Studio debugger the code behaves normally.

public void test()
{
try
            {
                method1();
                if (condition1)
                {
                    throw new Exception("Exception 1 occured!");
                }

                method2();  
                if (condition2)
                {
                    throw new Exception("Exception 2 occured!");
                }

                method3();
                if (condition3)
                {
                    throw new Exception("Exception 3 occured!");
                }

            }
            catch (Exception Ex)  <---- Exceptions thrown above are caught here
            {
                logMessage(E.Message);
                throw;                  
            }                   
}
  • 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-04T01:19:38+00:00Added an answer on June 4, 2026 at 1:19 am

    Visual Studio is probably set to break on all Exceptions instead of just uncaught Exceptions. So it stops when it detects that you threw the Exception. In certain cases, rather than appearing to break on the line that throws the exception, Visual Studio highlights the next line of code which was about to run.

    If you continue to step through the code, you should see it go to the catch block next.

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

Sidebar

Related Questions

I'm running this C# code in Visual Studio in debug mode: public class MyHandlerFactory
How can I debug a specific rowtest? I'm using Visual Studio and nUnit. TDD.NET
I've got this test case here that compiles with g++ theFile.cc -lboost_thread. When running
I'm running this small C# test program launched from a pre-commit batch file private
I am getting this weird error while running cucumber test: ERROR Mongo::OperationFailure: Database command
I'm running this SELECT statement: TIMEDIFF(NOW(), posts.date_modified) as time_ago And getting results in the
I am using JUnit 4.10 for running test suites, and I have implemented a
Using OCUnit & Xcode, is there a way of running just one test? Ideally,
I have a query that looks something like this: select xmlelement(rootNode, (case when XH.ID
I am running a Junit test case on my eclipse application that was built

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.