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

Related Questions

Maybe this is a dumb question, but I have the following behavior in Visual
This code leads to undefined behavior: void some_func() { goto undefined; { T x
I have this line of JavaScript and the behavior I am seeing is that
I'm hoping someone can clarify this behavior for me, and explain how ASP.NET is
Starting with 2005, VS started this behavior of when starting debugging session it spawns
I use Visual Studio 2008. I haven't seen this behavior before and, as far
I've seen this weird behavior on several sites recently: I scroll down a page
Not sure if this is intended behavior or a bug or a wrong function
This is the day of weird behavior. We have a Win32 project made with
Let me describe the behavior I get: Load a user from the database: this

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.