Debug.WriteLine 不工作

编程入门 行业动态 更新时间:2024-10-20 16:06:30
本文介绍了Debug.WriteLine 不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

过去,也许是我现在使用的 2008 之前的 Visual Studio 版本,我会在我的 VB.NET 代码中执行以下操作:

In the past, perhaps versions of Visual Studio prior to the 2008 that I am using now, I would do something like this in my VB.NET code:

System.Diagnostics.Debug.WriteLine("Message")

..并且输出将进入输出窗口.

..and the output would go to the output window.

现在不行了.显然必须首先启用某些东西.

Now it doesn't. Something must first apparently be enabled.

如果这涉及附加调试器",请说明如何操作.在我看来,它应该可以正常工作而不必大惊小怪.

If this involves "attaching a debugger", please explain how to do it. It seems to me that it should just work without too much of a fuss.

这是一个实时解释问题并向您展示我的所有设置的视频:

Here's a video explaining the issue in real time and showing you all my settings:

screencast/t/YQnPb0mJcs

我使用的是 Visual Studio 2008.

I'm using VisualStudio2008.

推荐答案

所有好的建议.我注意到我没有看到提到这个提示,所以我会说:在你的 app.config 文件中,确保你没有 <clear/>元素在您的跟踪侦听器中.

All good suggestions. I noticed that I don't see this tip mentioned, so I'll say it: In your app.config file, make sure you don't have a <clear/> element in your trace listeners.

您将有效地清除跟踪侦听器列表,包括用于调试语句的默认跟踪侦听器.

You will effectively be clearing the list of trace listeners, including the default trace listener used for Debug statements.

以下是您的 app.config 文件中的内容:

Here's what this would look like in your app.config file:

<system.diagnostics> <trace> <listeners> <!-- This next line is the troublemaker. It looks so innocent --> <clear/> </listeners> </trace> </system.diagnostics>

如果您想在 app.config 文件中为跟踪侦听器设置占位符,则应改为使用以下内容:

If you want to have a placeholder for trace listeners in your app.config file, you should instead use something like this:

<system.diagnostics> <trace> <listeners> </listeners> </trace> </system.diagnostics>

更多推荐

Debug.WriteLine 不工作

本文发布于:2023-05-28 12:31:37,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/320947.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:工作   Debug   WriteLine

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!