简体   繁体   English

为什么在调试模式下使用Step Over(F10)时VS2015跳过行

[英]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. 当我使用Visual Studio Emulator for Android尝试逐行浏览时,某些行会被跳过。

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. 有时,Android部署会感到困惑-断点无法触发(它们通常在编辑器装订线中显示为空心圆圈,指示源不匹配),应用程序未按您预期的方式运行,等等。

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. 当IDE显示的代码与您的设备或模拟器的操作不一致时,我发现强制卸载软件包然后从IDE重新部署通常可以解决该问题。 This can be done most reliably by using the ADB command prompt and running "adb uninstall com.company.packagename" . 通过使用ADB命令提示符并运行"adb uninstall com.company.packagename"可以最可靠地完成此操作。 After that, just rebuild and deploy/run the app again from the IDE as you normally would. 之后,只需像往常一样从IDE重新构建和部署/运行应用程序即可。

I have found that in visual studio 2015 go to Tools -> Options -> Debugging -> General ensure Enable .NET Framework source stepping is checked. 我发现在Visual Studio 2015中,转到“ Tools -> Options -> Debugging -> General确保已选中“ Enable .NET Framework source stepping

Rebuild after and you should be good to go. 重建后,您应该会很好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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