vb.net 在 Visual Studio 2013 中调试无法正常工作

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/23325158/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-17 17:28:39  来源:igfitidea点击:

Debugging in Visual Studio 2013 not working properly

vb.netvisual-studio-2013visual-studio-debugging

提问by Taegost

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.

我正处于 VS 2013 中连接到 TFS 2013 应用程序层的新 VB.net Windows 窗体项目的开始阶段。我已使用 Microsoft Update 更新了 VS 客户端,以包含当前可用的所有修补程序。

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)
  1. 断点被忽略(最终)
  2. F10 (Step Over) & F11 (Step Into) 不能正常工作(他们可能工作一两次,然后完全退出所有运行的方法)

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)

随着时间的推移,问题会发生变化,但这基本上是发生了什么(注意:我已经在 Form Load 上调用的方法中设置了一个断点,因此预期的行为是在接口可用之前命中断点。另外,方法中断点后大概有十几行)

  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
  1. F5 以调试模式启动项目
  2. 表单加载并且不会在断点处停止
  3. 进行调用该方法的更改
  4. 应用程序在适当的点停止
  5. 按一次 F10,它会转到下一行
  6. 再次按F10,它完全跳出所有运行的方法,把我带回界面(我这里期望的是它转到下一行)
  7. 一致地重复步骤 3-6,直到它继续并且不再在断点处停止,也不允许我单步执行或单步执行任何方法

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.
  1. 我有另一个更大的 VB.Net 应用程序,它从未遇到过调试问题
  2. 我在设置VS2013时,选择了General Development,我对默认设置所做的唯一更改就是将配色方案更改为深色方案。

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.

在我的研究中,我真正发现的与 2013 年相关的唯一文章甚至都指向了这篇文章:VS/2013 Debugger Not Working (MFC/C++/CLI w/MFC library 的以前版本)
这篇文章听起来像有类似的行为,但它与包含 C# 和 C++ 代码的项目有关,而我的则没有。

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.

有没有人对可能导致这种情况的原因有任何见解,以及我可以做些什么来解决它?我在 VS2012 上没有这些问题,我想我可能会在这个项目中使用它,直到问题得到解决。

采纳答案by Taegost

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.

它源于这样一个事实,即我试图跨过或进入的每一行都有一个 InvalidCastException(我试图将一个 Integer 和 2 个字符串添加在一起,并将它们粘在另一个字符串中。当字符串为空时,它正在尝试将它们转换为 Double)。这些错误并没有导致应用程序中断,而是默默地忽略它们并将它们放在输出窗口中(我没有注意到)。
具有讽刺意味的是,我知道这些行上会有错误,我试图弄清楚它们是什么,以便我可以正确地进行转换。

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.

当我将生成错误的行之一设置为中断时,断点失败,并且 Step Over 函数将完全跳过它们。

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

一旦我修复了 InvalidCastExceptions,调试就又开始正常工作了。