0

我有一个在调试模式下运行的 VB.NET 应用程序。我有 3 行

    Dim sValue$
    sValue = "test"

    Debug.Print sValue

当我不运行时,我在 sValue = "test" 行和 Debug.Print sValue 行上设置了一个断点。

现在当我开始调试时,Debug.Print sValue 行上的断点消失了,并且没有执行 Debug.Print。但是,sValue = "test" 行上的断点仍然存在。

有人知道这里可能出了什么问题吗?

4

2 回答 2

1

从 x86 切换到 AnyCPU 有帮助。奇怪的。

于 2013-05-02T19:34:37.453 回答
1

社区,

这是使用 Visual Studio 2012 (Express) for Desktop 的另一个解决方案。基本上,您将需要导入系统诊断并包含特定的代码行。见下文:

Imports System.Diagnostics


'Write Your Code Here

Trace.Listeners.Add(New TextWriterTraceListener(Console.Out))

    Debug.Print(Today)     'This will print the date in "Short" form | Carriage Return
    Debug.Write(Today)     'This will print the date in "Long" form
    Trace.Write(Today)     'This will print the date in "Long" form

就是这样。第一行代码是必要的,这样 Visual Studio 才能识别 Debug & Trace 类。需要第二行代码,以便窗口实际显示您需要的内容。最后三行代码基本上做同样的事情。

还有一件事,确保您在输出窗口的“调试”页面中以查看打印输出!

最后一件事,如果您是新手 [像我一样],如果您希望 Visual Studio在输出窗口中显示“Debug.Print” ,请确保按F5而不是 CTRL+F5。


PS。有一种方法可以让输出出现在即时窗口中;但我改变了我的设置,现在它不会出现。所以,如果你喜欢它,你可以修改选项,最终你会得到它。

于 2013-08-12T22:44:38.210 回答