Debug.WriteLine不工作

编程入门 行业动态 更新时间:2024-10-21 06:47:27
本文介绍了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:21,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/320944.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:工作   Debug   WriteLine

发布评论

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

>www.elefans.com

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