Question

during debugging in Visual Studion 2013, for a C# project, the yellow arrow that appears next to the line number does not move to the next line. I have to press F10 twice on every line. When there is a method call and I press F11, it goes to that method and then jumps back to the calling part on pressing F10, I have to press F10 again a second time only then it goes back to the next line in the called method.

What is going on? Did I accidentally turn on/off some setting in VS?

Please help as this is causing a lot of frustration.

Regards.

Was it helpful?

Solution

It seems like you're debugging a MultiThreaded app, which is accessing the same method multiple times, as i said in the comments.

Check your Threads window and you will see that more then 1 Thread is accessing the called method, and that's why you're experiencing having to press F10 more then once, and why F11 is returning back to the called method.

Inside your Threads window, you can Freeze threads by right clicking them and pressing "Freeze".

OTHER TIPS

As suggest in Yuval's answer, It seems this issue happens due to multiple threads.
Lucky for you, It is very simple to test that. All you have to do is:

For each thread, assign a unique name when it is created. This could be done by something like the following after creation:

if(String.IsNullOrWhiteSpace(Thread.CurrentThread.Name))
{
   Thread.CurrentThread.Name = "MyThread_" + id++;
}

Don't forget to add:

using System.Threading

In your Watch window add a record for System.Threading.Thread.CurrentThread.Name.
Now all that is left, is to check if the value of that record changes every time you press F10

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top