Console.WriteLine does not show up in Output window

后端 未结 9 1383
梦毁少年i
梦毁少年i 2020-12-07 19:49

I have put some Console.WriteLine calls in to test, but they aren\'t appearing in the output box?

public static ArrayList myDeliveries = new Arr         


        
相关标签:
9条回答
  • 2020-12-07 20:11

    Select view>>Output to open output window.

    In the output window, you can see the result

    0 讨论(0)
  • 2020-12-07 20:14

    When issue happening on Mac VS 2017 (Which I faced).

    1. Go to Project >> "Your Project name" options.
    2. An option window will pop up
    3. Go to RUN >> Default menu option
    4. Tick the "Run on external console" option TRUE and say OK

    Run your application code now.

    0 讨论(0)
  • 2020-12-07 20:16

    If you are developing a command line application, you can also use Console.ReadLine() at the end of your code to wait for the 'Enter' keypress before closing the console window so that you can read your output. However, both the Trace and Debug answers posted above are better options.

    0 讨论(0)
  • 2020-12-07 20:25

    If you want Console.WriteLine("example text") output to show up in the Debug Output window, temporarily change the Output type of your Application from Console Application to Windows Application.

    From menus choose Project + Properties, and navigate to Output type: drop down, change to Windows Application then run your application

    Of course you should change it back for building a console application intended to run outside of the IDE.

    (tested with Visual Studio 2008 and 2010, expect it should work in latter versions too)

    0 讨论(0)
  • 2020-12-07 20:25

    Old Thread, But in VS 2015 Console.WriteLine does not Write to Output Window If "Enable the Visual Studio Hosting Process" does not Checked or its Disabled in Project Properties -> Debug tab

    0 讨论(0)
  • 2020-12-07 20:26

    Console outputs to the console window and Winforms applications do not show the console window. You should be able to use System.Diagnostics.Debug.WriteLine to send output to the output window in your IDE.

    Edit: In regards to the problem, have you verified your mainForm_Load is actually being called? You could place a breakpoint at the beginning of mainForm_Load to see. If it is not being called, I suspect that mainForm_Load is not hooked up to the Load event.

    Also, it is more efficient and generally better to override On{EventName} instead of subscribing to {EventName} from within derived classes (in your case overriding OnLoad instead of Load).

    0 讨论(0)
提交回复
热议问题