在Visual Studio调试器继续发生异常后, [英] Continuing in the Visual Studio debugger after an exception occurs

查看:163
本文介绍了在Visual Studio调试器继续发生异常后,的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我调试一个C#程序,我得到一个异常扔(通过代码引发或由框架抛出),IDE会停止,并让我在我的代码中的相应行。

When I debug a C# program and I get an exception throwed (either thrown by code OR thrown by the framework), the IDE stops and get me to the corresponding line in my code.

一切都很好,现在。

我再按F5键继续。从这一刻起,它接缝就像我在一个无限循环来的。该IDE总是让我回到例外线。我不得不<大骨节病>移 + <大骨节病> F5 (停止调试/终止程序),以摆脱他。

I then press "F5" to continue. From this moment, it seams like I'm in an infinite loop. The IDE always get me back to the exception line. I have to Shift + F5 (stop debugging/terminate the program) to get out of his.

我曾与一些同事在这里,他们告诉我,这也恰好某个时候给他们。

I talked with some co-workers here and they told me that this happens sometime to them too.

这是怎么回事?

推荐答案

这是因为异常是未经处理和Visual Studio不能搬过去该行没有它以某种方式被处理。简单地说,它是由设计。

This is because the exception is un-handled and Visual Studio can not move past that line without it being handled in some manner. Simply put, it is by design.

一件事,你可以做的是拖放的执行点(黄线/箭头)前一个点在你的代码,修改在存储器中的值(使用Visual Studio手表视窗),使得它们不会引起一个异常。然后开始逐句通过代码再次*。

One thing that you can do is drag and drop the execution point (yellow line/arrow) to a previous point in your code and modify the in memory values (using the Visual Studio watch windows) so that they do not cause an exception. Then start stepping through the code again*.

这是一个更好的主意,虽然停止执行并修复导致异常的问题,或者正确处理异常,如果罚球不希望。

It is a better idea though to stop execution and fix the problem that is causing the exception, or properly handle the exception if the throw is not desired.

*的这可能有意想不到的后果,因为你基本上是重新执行一些代码(不倒带执行)。

这篇关于在Visual Studio调试器继续发生异常后,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆