异常没有被提出在C#。刚踢出来的套路。这是一个错误?这是一个、套路、踢出、异常

2023-09-04 04:14:40 作者:尤人

我有一个体验,一个异常应该已经在我的code提出的其他日子,而是它只是踢出了常规,并继续运行(即它是一个WinForms项目,因此通过持续我的意思是控制只是回到那里等待进一步的用户输入的形式)。

I had an experience the other day where an exception should have been raised in my code, but instead it just kicked out of the routine and continued running (i.e. it's a WinForms project, so by "continued" I mean control just went back to the form where it waits for further user input).

我觉得很奇怪,但固定的问题,也不用担心。今天,我有同样的事情发生在不同的项目中,我有一个XmlDocument对象加载()'荷兰国际集团是不存在的文件。它应该引发一个异常,而是它只是踢出了例行的,给控制返回到窗体。

I thought it was odd, but fixed the problem and didn't worry about it. Today, I had the same thing happen in a different project where I had an XmlDocument object Load()'ing a file that didn't exist. It should have raised an exception, but instead it just kicked out of the routine and gave control back to the form.

有没有其他人经历过这样的行为,或知道任何有关什么可能导致它,或者这听起来像一个错误,在VS 2010?

Has anyone else experienced this behaviour or know anything about what might be causing it, or does this sound like a bug in VS 2010?

推荐答案

我得到了同样的问题上会支持。就我而言,这个问题只发生在发展,而不是发布之后。为了得到错误,我发现你需要改变在VS的设置在调试菜单上,单击例外项。这告诉VS时,应与错误中断。你需要检查通用语言运行时异常投掷选项。它应该纠正你的问题。您需要做的每一个项目。

I got the same issue a will back. In my case, the problem only occur in development and not after the release. To get the errors, I found the you need to change a setting in VS. In the Debug menu, click on the Exception item. This tell when VS should break with error. You need to check the Common Language Runtime Exception Throw option. It should correct your problem. You will need to do this for each project.