Visual Studio 2008, debugging and objects private variable changes value
===

I'm debugging a class and have a peculiar problem, and not sure how to solve it. 

I instantiate the class like this:

    10: Dim myObj as Obj = new Obj()

Now if the class definition looks like this (more simplified in real life obviously)

    Public Class Obj
      Private Counter as integer = 2

      Public Sub SetCounter()
         Counter = 0 
      End Sub
      'More methods and properties in class 
    End Class

Now I call :

    10: Dim myObj as Obj = new Obj()
    20: myObj.SetCounter()

During debugging

If I run line 10 and check the value of the private variable Counter - the value is 2 as expected. 

If I run both lines then the value ends up as 1 if I check it in the debugger. 

I'm not even setting the value to 1, also in the real class I've set breakpoints everywhere the private variable is set, and no breakpoint is met. 

I really suspect it is a visual studio debugger issue. Any ideas how I can go about proving it is a debugger issue / confirm this / rule this out. 

Any ideas on the issue in general. I've involved 4 devs at our company and they're all stumped, I'm perplexed too. 

Thanks in advance. 


