Debugging in Visual Studio - visual-studio

what is the difference between start Debugging and Start Without Debugging in Visual Studio while running a program ?

The first option starts the program under the control of Visual Studio's debugger. The second option starts the program stand-alone. Some of the practical differences while debugging a process are:
You can pause, resume, stop and restart the debugged process from Visual Studio.
Breakpoints defined in the code will be active for a debugged process, and the debugger will pause the process and show a stack trace whenever the process hits one of them.
You cannot exit Visual Studio without stopping the debugged process.
When a debugged console process exits, it will display a termination message until you press a key. This allows you to inspect the output of a just-ended process without having the console window immediately disappear on you.

The former attaches the debugger, the latter does not. You use the latter if you want to run in the same way an end user would.

the answer seems obvious, especially if you just try it :)
"Start without debugging" starts your app but doesn't attach visual studio as the debugger. "Start debugging" starts your app, with visual studio attached as the debugger.

Related

Visual Studio debugging - The process cannot access the file because it is being used by another process

I keep getting this error the first time I try to run my program (debug mode) from inside Visual Studio 2015.
So what happens is I'll hit the Start button to start debugging, and it gives this error. I close the dialog, then try it again and it works. It happens every time.
Any suggestions?

VS 2008 Attach to process disabled

I have used the attach to process feature of visual studio a number of times. However now when i try to attach to a process (dll) the Attach button is disabled. However if i select any other process except the managed one the Attach button is enabled! My problem is closely related to the problem described at the link below
VS attaching to process disabled
A picture of the dialog is attached.
This is almost certainly because there is already another debugger attached to the process - probably the currently running instance of Visual Studio but it may be another instance of Visual Studio, or another debugger entirely (such as WinDbg or a remote debugging session).
Check the "Processes" window (usually found under Debug -> Windows -> Processes) to see what processes Visual Studio is debugging.
Found the solution to the problem
How to step into C/C++ DLL from C# application while debugging
http://msdn.microsoft.com/en-us/library/605a12zt%28v=VS.90%29.aspx

detach one process from visual studio debugger

My question is somewhat similar to this
"How to stop debugging (or detach process) without stopping the process?"
but i want to detach from one process.
for instance, I have a windows form app which i also attach to a windows service. I want to detach from only service (detach all will remove debugging from all executions and hence i won't be able to debug other application).
P.S: If possible please mention for visual studio 2008 and 2010.
In the Processes window (Debug -> Windows -> Processes), right-click on the name of the process you want to detach, and on the shortcut menu, click Detach Process.
Just wanted to share that the shortcut key combo (in VS2013) is Ctrl+Alt+Z to bring up the Process window. The window will only pop up if there is at least one process attached.
If you have Visual Studio Express, there is no Processes window and I did not realized how to detach only one process.
If you are doing Mixed Mode debugging then neither the Debug > Detach All option nor detaching as mentioned in Centro's answer in this thread would work.
I see the Debug > Detach All option or Detach Process option in Debug > Windows > Processes dialog, when I am debugging in Native only or Managed only mode.
I have tested this on Visual Studio 2005 at least for now.
Reference: https://developercommunity.visualstudio.com/t/cannot-detach-from-process-the-debugdetach-all-opt/225642

What's the difference between "Stop Debugging" and "Terminate All" in Visual Studio?

As the title asks, what's the difference between "Stop Debugging" and "Terminate All" in Visual Studio (I know those options are available in 2008, but not sure if it's called the same or something different in 2005 or 2010) ?
I think Terminate All will kill all attached processes in Visual Studio while the former just stops debugging but leaves the processes running.
Update: A better answer from http://msdn.microsoft.com/en-us/library/406kfbs1.aspx
Stop Debugging terminates the process you are debugging if the
program was launched from Visual
Studio. If you attached to the
process, instead of launching it from
Visual Studio, the process continues
running. If you want to terminate
attached processes, you can terminate
a single process from the Processes
window or terminate all attached
process with the Terminate All
command.

Debugging Question - VS 2008 web services on Cassini

I'm testing a web service in Visual Studio, and stepping through using the debugger.
Then I click stop debugging. This stops the debugging session, but the program continues to run like a runaway train.
Is this a "bug" or a "feature" of Visual Studio 2008? If it's a feature, how can I tell Visual Studio to halt execution when I click on 'stop debugging'?
The web server that visual studio uses will keep running in the background. You should be able to stop it using the icon in the task bar.
Or if you have lots of instances running, my favourite little trick is to pop open the run command and type:
tskill webdev
When you run webservices, even when you stop them, they still run on the background, what you can do is look in the taskbar on the right hand side and close out the instances of the webservice that are running by right clicking on the icon and pressing stop.
While you've stopped debugging the application chances are that the asp.net developement server is running. you should be able to stop that from its tray icon

Resources