开发者

Why does Trace.WriteLine("Test") not appear when targeting .net 4.0 but does when 3.5

I have just noticed that when i call the following code from a console app

for (int i = 0; i < 10; i++)
{
  Trace.WriteLine("Logging");
  Debug.WriteLine("Logging Debug");
}

if I am targeting .net 4.0 no messages appear in the debugview app although I am capturing all outputs.

If I change to target 3.5 it 开发者_开发问答appears fine.

What's changed and how can I fix it?


This is actually by design. From Microsoft Connect :

The CLR has a new debugging architecture where the CLR is native debugging the application even when managed only attached, and therefore MS-SysInternals DebugView will not work.


Are you doing this on the same machine?

It could be that the debug viewer (assumed DbgView from Sysinternals) is not connected. Check the title of the debug viewer for the name of the machine you're connected to.


This fixed the problem for me:

Trace.Autoflush = true;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜