简体   繁体   English

Debug.WriteLine没有在Visual Studio 2010中将输出写入OutputWindows

[英]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.

相关问题 Visual Studio中的Debug.WriteLine故障。 如何解决? - Debug.WriteLine malfunctions in Visual Studio. How to fix it? vs2010 Debug.WriteLine停止工作 - vs2010 Debug.WriteLine stops working 调试和跟踪Write / WriteLine不输出到Visual Studio 2010 C#Express中的输出 - Debug and Trace Write/WriteLine not outputting to output in Visual Studio 2010 C# Express Debug.Writeline在输出窗口上偶尔出现丢失回车的情况 - Occasional Missing Carriage Return on Output Window from Debug.Writeline Visual Studio 2010 - 调试输出 - Visual Studio 2010 - Debug Output VB 2010 Express:Debug.WriteLine在调试版本中完全优化了吗? - VB 2010 Express: Debug.WriteLine optimized away completely in debug version? 为什么 System.Diagnostics.Debug.WriteLine 在 Visual Studio 2010 C# 中不起作用? - Why does System.Diagnostics.Debug.WriteLine not work in Visual Studio 2010 C#? 如何在Visual Studio 2010的“输出”窗口中读取Console.WriteLine()的结果 - How to read result from Console.WriteLine() in Output window in Visual Studio 2010 如何从Silverlight写入Visual Studio 2010调试输出窗口? - How to write to Visual Studio 2010 debug output window from Silverlight? Visual Studio 2010 在调试时保持输出窗口打开 - Visual Studio 2010 Keep Output Window Open on Debug
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM