In this post, we will discuss another very basic and simple topic i.e. “Difference between Start Debugging & Start without Debugging in Visual Studio” but this is confusing to many beginners: “Start Debugging (F5)” and “Start Without Debugging (Ctrl + F5)“. )”.

This section explains. Visual Studio displays these two menu items in sequence on the Debug menu. There’s a lot of confusion about when to use what, or why there are two different options for debugging. Let’s understand it below.

Difference between Start Debugging & Start without Debugging in Visual Studio

Start Debugging:

When you run your application with this option selected (by pressing F5), Visual Studio loads all necessary symbols and “attachs the debugger” before starting the application. You should see the assembly loaded in the Debug –> Windows –> Output window.

Difference between Start Debugging & Start without Debugging in Visual Studio

With this option selected:

  • You can pause the execution of application by breakpoints.
  • You can step through the code.
  • You can Inspect elements.
  • You can take the advantages of all available debugging tools such as “Watch Window”, “Data Tips” and “Diagnostic Tools” etc.

Related Post:


11 Effective Debugging Tips for .NET Developer


This means you can do whatever you want while debugging your application. To do this, use the Start Debugging (F5) option.

Difference between Start Debugging & Start without Debugging in Visual Studio

In case, you want to check out the list of attached process during debugging, please navigate to Debug => Windows => Process.

Difference between Start Debugging & Start without Debugging in Visual Studio

Additionally, once your debugger is attached and breakpoints hit and you should be able to control the execution by pausing, stopping or by detaching the breakpoint.

Difference between Start Debugging & Start without Debugging in Visual Studio

Start without Debugging:

When you select this option (press Ctrl + F5) to run the application, Visual Studio will launch your application without loading the symbols and attaching the Debugger.

In this case

  • Your application won’t pause, even if you have any breakpoint within your code
  • You will not be able to step through the code.

So, this is just run your application in Debug mode OR without the debugger attached with it.


Use “Run To Cursor” and save time while debugging.


Quick Example with a Code Snippet:

The Debugger class provides several APIs that allow you to communicate with the debugger. Debugger.IsAttached indicates whether a debugger is attached to the process. Let’s see how this works in both cases.

class Program
{
static void Main(string[] args)
{
  Console.WriteLine("Debugger Attached :{0}", Debugger.IsAttached);
}
}

Run the app with both debugging option – F5 & Ctrl + F5.

Difference between Start Debugging & Start without Debugging in Visual Studio

As you can see in the screenshot above, the debugger is only connected if you select the Start Debugging (F5) option, so the example results will be different in both cases. Last but not least, in this context, do not confuse. Suppose we have the following statement:

#if DEBUG
Console.WriteLine("Sample Statement....");
#endif

In both cases, you are running the application in debug mode, so the above code will run and give you the same output. So, if you want to delve into the code, explore the code, find issues, and use all the debugging tools, you should choose the F5 / Start from Debug option.

If you don’t want to step through your code or need breakpoints, choose other options. In this case, you can use “Start without debugging (Ctrl+F5)”. Think about it, there’s no need to delete existing breakpoints. Please do a quick test. If you want to dig deeper, press F5 again.

You can check more article on our website under C# section HERE or you can also check more such stuff on Microsoft Docs too.

Leave a Reply

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

Explore More

Working With File Class In C#

In C#, ‘File’ class provides many static methods for moving, copying, and deleting files. These Static methods involve moving a file and copying and deleting a file also. Let’s check

How to Read a Text File in C#

In C# ‘File’ class provides static methods to read given text file data. The File.ReadAllText() method opens a text file, reads all the text present in the file into a

C# | How to use Interface references

In C#, you’re permitted to make a reference variable of an interface type or in other words, you’re permitted to form an interface reference variable. Such kind of variable can