本文介绍了的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说明不了什么
发布评论