[英]Debug.WriteLine is not writing output to OutputWindows in Visual Studio 2010
Tools|Options|Debugging Redirect all Output to Immediate is unchecked. 工具|选项|调试取消选中将所有输出重定向到立即。
Tools|Options|Debugging|Output Window General output settings are all ON. 工具|选项|调试|输出窗口常规输出设置均为ON。 Debug configuration is activated, define DEBUG constant is checked. 激活调试配置,检查定义DEBUG常量。
Still Debug.WriteLine("test") writes nothing to Output Window(Cant capture it in DebugView from sysinternals too). 仍然Debug.WriteLine(“test”)不向输出窗口写入任何内容(也不能在sysinternals的DebugView中捕获它)。 What can cause that? 是什么导致的?
Had this in config file, hope that can help someone else: 在配置文件中有这个,希望可以帮助别人:
<system.diagnostics>
<trace>
<listeners>
<clear/>
</listeners>
</trace>
</system.diagnostics>
removed clear, now everything works. 删除清楚,现在一切正常。 Thank you @Hans Passant. 谢谢@Hans Passant。
or use this: 或使用此:
System.Diagnostics.Debug.Listeners(0).WriteLine System.Diagnostics.Debug.Listeners(0).WriteLine
instead of just Debug.WriteLine 而不仅仅是Debug.WriteLine
I fixed that problem closing the project, delete 'bin' and 'obj' folders. 我修复了关闭项目的问题,删除'bin'和'obj'文件夹。 Reopen project and Debug.WriteLine works... 重新打开项目和Debug.WriteLine工作...
Just want to say for anyone coming to this question that the answer given and which received 0, System.Diagnostics.Debug.Listeners(0).WriteLine worked for me in VS2013. 只是想对任何来到这个问题的人说,给出的答案和收到的答案0,System.Diagnostics.Debug.Listeners(0).WriteLine在VS2013中为我工作。 Change console.writeLine and or debug.WriteLine to the above , open your immediate window and output is there. 将console.writeLine和/或debug.WriteLine更改为上面的内容,打开您的即时窗口并输出。 Good luck 祝好运
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.