2

I have a ASP.NET 4.0 WEB API application running that modifies some database records.

My code iterates through Orders and Updates:

<[PUT]("ProcessOrders")> Public Sub PutValue() Dim Orders as List(of OrderInfo) = DAL.GetOrders() For Each Order As OrderRequest In Orders Dim Status As OrderProcessingStatus = Order.Process() If (Status.isSuccessfullyProcessed) Then DAL.UpdateOrderStatus(Order.OrderNumber, "SUCCESS") Else DAL.UpdateOrderStatus(Order.OrderNumber, "FAIL", Status.ErrorMessage) End If Next End Sub 

While debugging in VS2010, I have a break point on the first line where I get the orders. In VS2010, I click on "Stop Debugging" - expecting that my code will immidietly stop and not execute.

To my surprise, even after I clicked Stop Debugging, the code keeps running and updates my database.

Please help.

Note: I start debugging, and then I use Fiddler to call this method

Thanks,

Simcha

2 Answers 2

5

Figured it out. Like Adrian McCarthy said:

If the process is started outside the debugger, and then you attach the debugger, the "Stop Debugging" command simply detaches the debugger from the process, and the process continues to run.

In the end, I used the "Terminate All" under the Debug menu. This actually stops all requests/processes.

Sign up to request clarification or add additional context in comments.

1 Comment

This behavior of Visual Studio drove me crazy. Inside of a transaction I paused the debugger and after inspecting the code I hit the "stop debugging" button thinking the code had stopped. I ended up with some transactions completed that shouldn't have been there. Lost a whole day analyzing what had caused the transactions to complete before realizing this behavior of the Visual Studio debugger.
2

If the process is started outside the debugger, and then you attach the debugger, the "Stop Debugging" command simply detaches the debugger from the process, and the process continues to run.

If you want to stop the process, then start it from the debugger. If that's inconvenient (e.g., if the process is started by another process on some event), then you'll have to kill the process in Task Manager and then stop the debugger.

1 Comment

I AM starting the process inside the debugger, but my PUT requests come from Fiddler.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.