Search code examples
vb.netvisual-studio-2013visual-studio-debugging

Debugging in Visual Studio 2013 not working properly


I am in the beginning phase of a new VB.net Windows Forms project in VS 2013 that is connected to a TFS 2013 application tier. I have updated the VS client using Microsoft Update to include all hotfixes available for it at the current time.

There are 2 problems that I'm having:

  1. Breakpoints are ignored (eventually)
  2. F10 (Step Over) & F11 (Step Into) don't work properly (They work maybe once or twice, then totally step out of all running methods)

The problem morphs as time goes on, but here is essentially what happens (NOTE: I have a breakpoint already set in a method that is called on Form Load, so the expected behavior is that the breakpoint is hit before the interface is usable. Also, there are about a dozen lines after the breakpoint in the method)

  1. F5 to start the project in debugging mode
  2. The form loads and does not stop at the breakpoint
  3. Make a change that calls the method
  4. The application stops at the proper point
  5. Hit F10 once, it goes to the next line
  6. Hit F10 again, it completely steps out of all running methods, bringing me back to the interface (What I expect here is for it to go to the next line)
  7. Repeat steps 3-6 consistently until it just continues and does not stop at the breakpoint again, nor does it allow me to Step-Through or Step-Into any methods

Some additional information:

  1. I have another, larger in size VB.Net application that has never experienced issues with debugging
  2. When I set up VS2013, I chose General Development, and the only change I made from the default settings was to change the color scheme to the dark scheme.

In my research, the only articles I have really found pertaining to 2013 that were even remotely relevant all pointed to this article: VS/2013 Debugger Not Working (MFC/C++/CLI w/ previous version of MFC library)
This article sounds like it has similar behavior, but it's pertaining to projects that contain both C# and C++ code, which mine does not.

Does anyone have any insight as to what could be causing this, and what I can do to work around it? I didn't have these issues with VS2012 and I think I will probably use that for this project until I can get the issue resolved.


Solution

  • Ok, I found the problem.

    It stemmed from the fact that each of the lines I was trying to step over or into had an InvalidCastException (I was trying to add an Integer and 2 Strings together, and stick them in another string. When the strings were blank, it was trying to convert them to Double). These errors were NOT causing the application to break, it was silently ignoring them and putting them in the Output window (Which I wasn't paying attention to).
    The irony is that I knew there were going to be errors on those lines, and I was trying to figure out what they were so I could do the conversions properly.

    The breakpoints failed when I had one of the lines set to break that was generating the error, and the Step Over functions would completely skip past them.

    Once I fixed the InvalidCastExceptions, debugging started working properly again.