Visual Studio 2019 Output Window Not Redirecting to Immediate Window While Debugging

Nathan Sokalski 4,116 Reputation points
2020-12-05T19:50:16.933+00:00

I have the following statement in multiple places in my code:

System.Diagnostics.Debug.WriteLine("My Output Expression");

This outputs to the Output Window. However, I want to redirect it to the Immediate Window. I have the following selected in Options:

Tools -> Options -> Debugging -> General -> Redirect all Output Window text to the Immediate Window

However, I still do not see anything in the Immediate Window. In previous Projects & Solutions I did not have this problem (although the other Projects & Solutions were UWP & VB rather than Xamarin & C#, but I am still running them on the same machine with the same installation of Visual Studio 2019). Why is this happening, and how can I fix it? Thanks.

Visual Studio Debugging
Visual Studio Debugging
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Debugging: The act or process of detecting, locating, and correcting logical or syntactical errors in a program or malfunctions in hardware. In hardware contexts, the term troubleshoot is the term more frequently used, especially if the problem is major.
944 questions
Visual Studio Testing
Visual Studio Testing
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Testing: The act or process of applying tests as a means of analysis or diagnosis.
329 questions
0 comments No comments
{count} vote

2 answers

Sort by: Most helpful
  1. Tianyu Sun-MSFT 27,356 Reputation points Microsoft Vendor
    2020-12-07T10:06:42.407+00:00

    Hi @Nathan Sokalski ,

    Thank you for taking time to post this issue in Microsoft Q&A forum.

    I followed your steps and tested(C# console project and C# windows forms project) on my side by using Visual Studio 2019 version 16.8.2, but it worked well and I can see the output in Immediate Window.

    Please try these steps to troubleshoot:

    1). If you don’t use the latest version of VS 2019, please consider to update it to the latest version, from VS Installer.

    2). You can refer to this document: Reset settings and try to reset settings of VS 2019(remember to select “General” at step 4, if you have some customized environment settings, please also remember to export the environment settings before resetting).

    3). Please try to create a new project and check if this issue persists.(I think you may have tried this)

    4). Please try to disable any third-party extensions from Visual Studio > Extensions > Manage Extensions > Installed > select and click Disable, then re-launch VS and test again.

    Not sure if this issue appears on specified project or code snippets, I will try to test the other projects for example: Xamarin project which you mentioned above.

    Best Regards,
    Tianyu

    • If the answer is helpful, please click "Accept Answer" and upvote it.
      Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
    0 comments No comments

  2. Michael Bakker 1 Reputation point
    2021-11-11T10:31:37.07+00:00

    One easily overlooked possibility is that the project hasn't configured any trace listeners.
    Either configure one in the config file or add:

    Debug.Listeners.Add(New DefaultTraceListener) 
    

    in your code.
    This will cause debug output to be written to either the output window or the immediate window depending on your Debugging settings ("Redirect all output text to the immediate window").

    0 comments No comments