Int32.Parse calling Thread.Abort?

A

Alan Baljeu

My code calls int.Parse(text), which throws a System.Format exception. This is fine
because text is all letters, and I explicitly catch the exception. However, my program
never receives the System.Format exception. Instead, I get this in the output, and I
receive a ThreadAbortException:
A first chance exception of type 'System.FormatException' occurred in mscorlib.dll

Additional information: Input string was not in a correct format.

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

Additional information: Thread was being aborted.

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

Additional information: Thread was being aborted.



I don't want the Thread to abort. What can I do?
 
J

Jon Skeet [C# MVP]

Alan Baljeu said:
My code calls int.Parse(text), which throws a System.Format exception. This is fine
because text is all letters, and I explicitly catch the exception. However, my program
never receives the System.Format exception. Instead, I get this in the output, and I
receive a ThreadAbortException:
A first chance exception of type 'System.FormatException' occurred in mscorlib.dll

That sounds extremely odd. Are you sure the thread wasn't being aborted
for some other reason?

Could you post a short but complete program which demonstrates the
problem?

See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top