Bug with the Visual Basic IDE ???

Here is an odd behavior i'm experiencing with the new 2005 IDE in Visual Basic. I have screenshots to prove this but I just noticed we cannot add images to these posts, so I will try my best to explain the problem:

Recently, during debugging, as I step through code, the debugger seems to "catch" exceptions on the weirdest places, but when I look at the exception, nothing is declared. Let me explain with an example...

I have a line that goes like this:

Try
.
.
.
    If dvView.Count = 0 Then
        Exit Sub
    End If
.
.
.
Catch ex as Exception
    // Here I publish the exception
End Try

Now, I have a breakpoint set on the If dvView.Count = 0 Then. The weirdest thing happens, at this point, the dvView does have a count of 0, and I double check this in a watch window, BUT when I do a Step Over, it suddenly goes into my Catch block instead of the Exit Sub, and when I look at the exception, it says "ex is not declared". In my catch block, I usually call a function which handles errors, so I pass ex as an argument to this function, but in this case, ex is never declared. What the heck is going on   It's a perfectly valid line of code. Can anyone help me understand what is going on    Restarting or rebooting never solves the problem. As well, I discover such new cases about once or twice a week and it does affect our application.




Answer this question

Bug with the Visual Basic IDE ???

  • alex2323

    I would just like to add that this has become more of a problem than previously mentioned. I'm now experiencing this MANY more times.

  • Erik van Noorden

    Without the rest of your code, I can't tell for sure what is going on, but it sounds similar to a bug that we didn't get a chance to fix for VS2005.  You can file a bug at http://lab.msdn.microsoft.com/productfeedback/default.aspx and if you give specific code that repros this bug, we should be able to determine exactly what is going wrong and address the issue accordingly.  Thanks!
  • jonbon

    Odd. I do not know what could be going on since I have never seen this behavior but maybe you could go to Debug-->Exceptions and check the "Thrown" checkbox close to Common Language Runtime Exceptions: now you should get the exception dialog as soon as the exception is thrown and maybe it will contain useful information.

    Luca Dellamore

    Visual Basic Test Team


  • Bug with the Visual Basic IDE ???