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

删除回忆录丶 提交于 2019-12-13 07:36:55

问题


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?


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/37551694/why-is-vs2015-skipping-lines-while-using-step-over-f10-in-debug-mode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!