简体   繁体   中英

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?

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.

I have found that in visual studio 2015 go to Tools -> Options -> Debugging -> General ensure Enable .NET Framework source stepping is checked.

Rebuild after and you should be good to go.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM