How to fix debug button on C#, when it displays "Start" instead of windows local debugger

2024-03-10T19:40:13.06+00:00

Hello everyone been coding for some time on Visual Studio, and recently started learning C#.
Starting yesterday, i created my first few projects to see if everything works ok, and it did until today. When I opened my projects from yesterday I noticed that the debug button stated "Start" on it instead of "Windows Local Debugger" which I was used to from other projects, and when i clicked on it the terminal would pop for just a split second and then disappear. I spent a lot of time today trying to find a solution to this problem but nothing led me to the answer of the problem. Would really appreciate it if I can get some help on the topic. Thank you in advance.

Note:
The debugger works fine on other languages like C++, the problem only exists in C#.

Here's a screenshot for reference:

2024-03-10 21_36_49-ConsoleApp4 - Microsoft Visual Studio

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,201 questions
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.
935 questions
{count} votes

Accepted answer
  1. Bruce (SqlWork.com) 55,036 Reputation points
    2024-03-11T17:43:36.32+00:00

    if it is .net 4.* console project, then Start is the caption for debug. Just add a breakpoint before clicking "Start". a .net core project will have the app name instead of Start.

    note: with .net projects, if debugging is not enabled, the caption will be "Attach"


1 additional answer

Sort by: Most helpful
  1. Tianyu Sun-MSFT 27,106 Reputation points Microsoft Vendor
    2024-03-11T02:41:58.3266667+00:00

    Hello @ΕΛΕΥΘΕΡΙΟΣ ΠΟΥΛΙΤΣΗΣ,

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

    I noticed that the debug button stated "Start" on it instead of "Windows Local Debugger".

    You created several projects for test, some might be based on .NET Framework, some might be based on .NET.

    User's image

    .NET and .NET Framework are different(detailed differences, see this document: What is the difference between .NET and .NET Framework?), so some behaviors or displays you see in Visual Studio, or when you are debugging, are a little different. But they are all correct.

    For example, sometimes when you are going to debug, you may see "Start", or "ConsoleApp4"(your project name), or "Local Windows Debugger". Sometimes more debuggers can be selected(Remote Windows Debugger/Web Browser Debugger/Web Service Debugger…).

    If you try another entry/option/button, the display should be always the same => Debug > Start Debugging/Start Without Debugging.

    and when I clicked on it the terminal would pop for just a split second and then disappear.

    I think this issue appeared when you were running a C# .NET Framework project(instead of a C# .NET project). The console closes automatically as the console application has completed executing.

    One workaround(from code side) is to add a following code line Console.ReadKey( ); or this code line Console.ReadLine( );.

    Another workaround is to press shortcut keys => Ctrl + F5, or click Debug > Start Without Debugging.

    More information:

    Some new features were added into Visual Studio 2022. As you can see, for .NET project, the console will not close automatically, there’s an option which controls this behavior => Tools > Options > Debugging > General > Automatically close the console when debugging stops.

    BTW, please set the project which you want to run/debug as the startup project if there are several projects in your solution(right-click your project > Set as Startup Project).

    Happy coding!

    Best Regards,

    Tianyu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    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