Search code examples
c#winformsvisual-studio-2017

Console.Write(string) no longer works in a VS 2017 WinForms project?


Anyone have any ideas why Console.Write(string) no longer works in a Visual Studio 2017 C# Windows Forms application?

Here's some sample code to reproduce:

Console.WriteLine("Results: ");
const int count = 15;
for (int i = 0; i < count; i++)
{
    if (i == (count - 1))
        Console.Write(i);
    else
        Console.Write(i + ", ");
}

I've already submitted a bug to the VS team at Microsoft and they've been less than helpful. They don't seem to understand the issue for some reason? I don't know how to be any more clear than this right here.

Bug report: https://developercommunity2.visualstudio.com/t/consolewritestring-does-not-work-anymore/1241476


Solution

  • Microsoft has changed the functionality of their product, and they've done so without many people even noticing because it's such a niche case scenario... Just as @Jimi stated in his comment above.

    You mean Visual Studio's Output Panel, of course (?). Or Immediate Window, depending on your configuration. If that's the case, this happened a while ago and went on for some time. It has been solved (or, better, the default behavior has been restored) many versions before the current.