Debugged some complex business scenario in multiple applications, and found out the cause. In order to show the problem at that particular moment, I had to stop the Visual Studio debugger during the first repetition of a for loop. I examined the result. The result was not what I had expected. It was the result after all repetitions in the for loop were executed.
I did it the second time, and the result was still the same. It was after all repetitions in the for loop were executed. Strange!
Did research, and found nothing.
To speak the truth, I almost wanted to unplug the network cable at that moment.
Continued to search, and found this article, How to: Stop Debugging or Stop Execution, in MSDN. It solved my problem.
Normally, if the program is launched from Visual Studio, stop debugging terminates the process you are debugging.
However, if you use local IIS and attach to the process, instead of launching it from Visual Studio, the process continues running. This was the problem I met.
There are a few options to terminate all attaches processes:
- On the Debug menu, choose Terminate All.
- Kill all those processes in Task Manager
- Restart IIS
How to: Stop Debugging or Stop Execution