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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T12:36:35+00:00 2026-05-11T12:36:35+00:00

This behavior is so bizarre that I don’t even know how best to ask

  • 0

This behavior is so bizarre that I don’t even know how best to ask the question.

Given the following C# code snippet:

public class Foo {   private bool _value = true;    // ...    protected void Method()   {      _value = true;     if(!_value) {       throw new Exception('What the...?!?!');     }   } } 

Attaching the Visual Studio debugger to an application executing a version of this code and stepping through the execution of Method() (using step into or step over), the if block is evaluated and the exception is thrown. Setting a watch on the _value variable, I can see that the value of _value is false at the beginning of the method and does not change as I step over/into the assignment statement. More interestingly, the exception is not thrown if I Continue execution (F5), though things still aren’t working correctly.

I came across this when trying to figure out why NUnit test cases were working when run using ReSharper from within visual studio, but fail when run within the the NUnit GUI. I attached the debugger to the NUnit GUI, set some breakpoints on the tests that were unexpectedly failing, found places where variables weren’t being set properly which should be set based on the above-mentioned _value variable which is somewhat of a flag indicating whether stuff is dirty or not), and thus noticed the strange behavior where _value wasn’t changing (the exception throwing thing was added later and verifies I was using the right compiled assemblies!).

So, how about it? What could possibly explain the above-mentioned behavior?

  • 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. 2026-05-11T12:36:35+00:00Added an answer on May 11, 2026 at 12:36 pm

    Since the exception isn’t actually thrown in some scenario’s I think this is a case of the debugger looking at the wrong source or wrong version.

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

Sidebar

Ask A Question

Stats

  • Questions 92k
  • Answers 92k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Just do: include("http://www.mysite.com/script.php"); Or: echo file_get_contents("http://www.mysite.com/script.php"); Notes: This may slow… May 11, 2026 at 6:26 pm
  • Editorial Team
    Editorial Team added an answer I can say, in SQL Server and in Oracle, this… May 11, 2026 at 6:26 pm
  • Editorial Team
    Editorial Team added an answer In the case where you have both exe and the… May 11, 2026 at 6:26 pm

Related Questions

This behavior is so bizarre that I don't even know how best to ask
I know, I would have thought the answer was obviously no as well, but
I am using jQuery.autocomplete(1.02) on my search box and I want exact string and
I'm finding that hitting the Refresh button on my browser will temporarily screw up
I've looked for some other articles on this problem and even tried some of

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.