testing testing - 1 year ago 106
C# Question

Why is VS2015 skipping lines while using Step Over (F10) in debug mode

When using Visual Studio Emulator for Android some lines are skipped when I try to go from line to line.

AppDomain.CurrentDomain.UnhandledException += ApplicationUnhandledExceptionHandler;
TaskScheduler.UnobservedTaskException += UnobservedTaskExceptionHandler;

The above lines are skipped on emulator, but not on device. I'm inspecting this, because a handler is not called on emulator. I tried to set the breakpoint directly without success.

What is the reason for line skipping in debug mode?

Answer Source

Sometimes Android deployment gets confused - breakpoints fail to trigger (they usually show as open circles in the editor gutter, which indicates source mismatch), the app doesn't run the way you expect, etc.

When the IDE shows code that disagrees with what your device or simulator is doing, then I have found that forcing an uninstall of the package and then redeploying from the IDE usually resolves it. This can be done most reliably by using the ADB command prompt and running "adb uninstall com.company.packagename". After that, just rebuild and deploy/run the app again from the IDE as you normally would.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download