Visual Studio Code: Debugging C# code

One of my reader asked how to debug C# code using Visual Studio Code. This blog post provides simple step by step guide to C# debugging in Visua Studio Code. In short – C# extension for Visual Studio Code must be installed. Works on Windows, Linux and Apple.

  1. Open extensions by clicking on last icon of icons pane in left:
      Visual Studio Code: Install C# plug-in
  2. After installing C# extension Visual Studio Code asks if it can reload window to activate the extension.
      Visual Studio Code: Activate C# extension
  3. Check output window and wait until all packages are downloaded.
      Visual Studio Code: Downloading packages
  4. Set break-point somewhere in code and click green arrow on toolbar after DEBUG
      Visual Studio Code: Hit da breakpoint!

Screenshot above shows that there are some familiar things from Visual Studio available: Variables, watch, and callstack panes. Debug console shows debug messages by debugger and code.

Gunnar Peipman

Gunnar Peipman is ASP.NET, Azure and SharePoint fan, Estonian Microsoft user group leader, blogger, conference speaker, teacher, and tech maniac. Since 2008 he is Microsoft MVP specialized on ASP.NET.

    3 thoughts on “Visual Studio Code: Debugging C# code

    • December 8, 2016 at 2:26 pm

      Thanks for showing how to debug, I’m using Ubuntu 16.10 and I get an error when I try to debug. If I run the program with dotnet run it works fine.

      The error is Failed to initialize CoreCLR, HRESULT:0x80131500

      Also the message Debug adapter process has terminated unexpectedly.

      I’ve searched for the error and there are a couple of posts about it but I’m not sure what to do. Do you have tips?

    • Pingback:Compelling Sunday – 16 Posts on Programming and QA

    Leave a Reply

    Your email address will not be published. Required fields are marked *