Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

.net

I am working on an asp.net application.. when I try to compile and run the application; it runs successfully.

But when I try to debug the application it gives me error at any point -

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

It doesnt give error at any specific code line.. it gives this error at any code of line (not sure).. and then web page display - "Server Application Unavailable" error.

Even when I try to parse/execute some statement in immediate window / quick watch - it gives me above error..

for example, I loaded an xml document (of more than 10000 lines) in XElement and when I try to check some attribute value thru xpath as XElementObj.XPathSelectElement("/asdf/asd/wqer/xyz").. it gives above error.. (not all the time but randomly).

anybody having any idea on this.. please help.

like image 397
kaushalparik27 Avatar asked Dec 29 '09 06:12

kaushalparik27


1 Answers

I had something similar and found this answer from another question:

If you want to pinpoint where the exceptions are occurring, you can select the Debug→Exceptions menu item, and in the dialog that appears, check the first checkbox for "Common Language Runtime Exceptions". This will make the debugger break as soon as an exception occurs instead of only breaking on unhandled exceptions.

This is also one reason why it is generally a bad idea to catch generic exceptions unless you are clearly logging the information caught.

like image 89
Christian Payne Avatar answered Oct 27 '22 02:10

Christian Payne