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

I just noticed that when I call the following code from a console application

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

if I am targeting .net 4.0 there are no messages in the debugview application, although I do all the output.

If I switch to target 3.5, it looks fine.

What has changed and how can I fix it?

+3
source share
3 answers

It is actually by design. From Microsoft Connect :

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

+4
source

?

, ( DbgView Sysinternals) . , .

0

This fixed the problem for me:

Trace.Autoflush = true;
0
source

Source: https://habr.com/ru/post/1747311/


All Articles