Home Dashboard Directory Help
Search

List.Sort() throws InvalidOperationException (instead of re-throw ThreadAbortException) while thread is being aborted by Andrzej P


Status: 

Closed
 as Won't Fix Help for as Won't Fix


2
0
Sign in
to vote
Type: Bug
ID: 605536
Opened: 9/27/2010 4:27:15 AM
Access Restriction: Public
0
Workaround(s)
view
1
User(s) can reproduce this bug

Description

List.Sort() throws InvalidOperationException (instead of re-throw ThreadAbortException) when thread is being aborted and ThreadAbortException occurs in Comparer while sorting.
Details
Sign in to post a comment.
Posted by Microsoft on 11/22/2010 at 3:28 PM
Thanks for reporting this issue. I wanted to let you know that we have looked into this and have decided not to change the current behavior. If a Comparer throws an unexpected exception when List<T>.Sort is used, it throws InvalidOperationException and set the inner exception to the unexpected error (in this case ThreadAbortException). This behavior is by design. Also note that it is generally a bad idea to rely on Thread.Abort. Some more info is available here: http://www.interact-sw.co.uk/iangblog/2004/11/12/cancellation

Therefore, I've gone ahead and resolved this as Won't Fix. Please let me know if you have any questions or concerns at justinv at microsoft dot com.

Regards,

Justin Van Patten
CLR Base Class Libraries
Posted by Microsoft on 9/27/2010 at 5:01 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.