开发者

Find the source of a first chance exception raised in the Visual Studio 2010 Output window

I'm working on a asp.net web application with Visual Studio 2010. There are a bunch of output window messages during debugging regarding:

A first chance exception of type 'System.Threading.ThreadAbortException' occurred in mscorlib.dll

and

An exception of type 'System.Threading.ThreadAbortException' occurred in mscorlib.dll but was not handled in user code

I've read some great Q&A on the topic of how and why these might be raised and how to handle them (or not handle them). My first guess is that it is related to Response.Redirect()s that are in the code. However, I see th开发者_JAVA百科em in the output and I'm not sure of the source of those output messages.

Question: how do I determine where the first chance exception came from in Visual Studio 2010?

Once I determine the source, I can investigate, solve or simply ignore per the Q&A linked to this question. Thanks in advance!


From personal experience, unless there is specifically an error occurring as a result of these, these messages can generally be ignored.

I have read in the past that this can be solved by adding false to the second parameter of Response.Redirect to stop processing occurring after redirect.

E.g. Response.Redirect("path/to/page.aspx", false);

Response.Redirect on MSDN

When you use this method in a page handler to terminate a request for one page and start a new request for another page, set endResponse to false and then call the CompleteRequest() method. If you specify true for the endResponse parameter, this method calls the End method for the original request, which throws a ThreadAbortException exception when it completes. This exception has a detrimental effect on Web application performance, which is why passing false for the endResponse parameter is recommended. For more information, see the End method.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜