的Debug.WriteLine说明不了什么

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

在使用

using System.Diagnostics;

Debug.WriteLine("Test");

具有运行应用程序,没有测试可在输出中看到。但是,如果使用MsgBox函数相反,MSGBOX弹出,所以在达到行了。

having run the application, no "Test" can be seen in output. But if I use the msgbox function instead, the msgbox pops up, so the line is reached.

我是不是找错了窗口或者我有什么改变?

Am I looking in the wrong window or what do I have to change?

我是用VC#Express中。

I am using VC# Express.

推荐答案

有两种可能的原因这种行为

There are two likely causes for this behavior

  • 应用程序正在在Release模式和的Debug.WriteLine 调用不在最后方案
  • 有程序中没有跟踪侦听器,因此nothnig输出信息
  • The application is being compiled in Release mode and the Debug.WriteLine call is not in the final program
  • There is no trace listener in the program and hence nothnig to output the message

诊断最简单的方法是修改代码,

The easiest way to diagnose this is to change the code to

#if DEBUG Console.WriteLine("the message"); #endif

如果它打印,那么你必须与跟踪侦听器的问题,否则你在重新编译版

If it prints then you have an issue with the trace listeners, else you're compiling in Release

更多推荐

的Debug.WriteLine说明不了什么

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

发布评论

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

>www.elefans.com

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