Search code examples
visual-studiovisual-studio-2015stderr

How to view stderr in Visual Studio 2015 (C#, WinForms)


Console.Out.WriteLine(111); //<-- '111' is shown in 'Output' window
Console.Error.WriteLine(222); //<-- where I can see '222' within IDE?

'111' successfully shows itself in the Output window (View | Output, Ctrl+Alt+O):
Screen-shot of the Output window with '111' visible
Where I can see '222' (within the IDE)?

P.S.: The code above works. I can ensure it by doing WindowsFormsApplication1.exe >output.txt 2>error.txt ('output.txt' will contain '111' and 'error.txt' will contain '222'). But the question is about viewing directly from IDE. (If Visual Studio 2015 doesn't allow it at all — does Visual Studio 2017 fix that?)


Solution

  • Hmm, I've found.

    The Visual Studio hosting process is the thing that blocks stderr from being displayed in the Output window together with stdout.

    If you disable hosting process, it will be displayed in the Output window as well:
    Screen-shot of the Output window with both '111' and '222' visible