[Mono-dev] Problem with List<T>.Sort(IComparer<T>)

Atsushi Eno atsushi at ximian.com
Tue Dec 6 20:16:36 EST 2005


No worry! it's nothing more than just a hint to find bugs. I couldn't
find that bug when I queried InvalidCastException ;-) Thanks for
(attempt for) filing couple of bugs.

Atsushi Eno

Grant Monroe wrote:
> Sorry about that. Looks like I checked something incorrectly when I
> did my bugzilla search. I figured someone would have already found it.
> that's why I posted to the list.
> 
> Grant Monroe
> 
> On 12/6/05, Atsushi Eno <atsushi at ximian.com> wrote:
>> I've already filed it as
>> http://bugzilla.ximian.com/show_bug.cgi?id=76361
>>
>> Basically you can query bugs before filing new one (and is highly
>> recommended). For class libraries, try the type name of the target
>> class (with the target assembly) if you know. In this case, you
>> will find this bug when you query "List" in CORLIB.
>>
>> (Feel free to add cc: to yourself on that bug if you'd like to
>> keep track of the bug.)
>>
>> Cheers,
>> Atsushi Eno
>>
>> Grant Monroe wrote:
>>> The following code results in an InvalidCastException rather than an
>>> InvalidOperationExcepation wrapping the ApplicationException. I didn't
>>> find any bug explicitly about this, but I just wanted make sure this
>>> wasn't covered by another bug in bugzilla. If not, I'll go ahead and
>>> post it.
>>>
>>> using System;
>>> using System.IO;
>>> using System.Collections.Generic;
>>>
>>> public class TestComparer: IComparer<string>
>>> {
>>>   public int Compare(string x, string y)
>>>   {
>>>       throw new ApplicationException("doesn't even get called");
>>>   }
>>> }
>>>
>>> class Test
>>> {
>>>   public static void Main(string[] args)
>>>   {
>>>       List<string> l = new List<string>();
>>>       l.Add("b");
>>>       l.Add("a");
>>>       l.Add("c");
>>>       TestComparer sc = new TestComparer();
>>>       l.Sort(sc);
>>>   }
>>> }
>>> _______________________________________________
>>> Mono-devel-list mailing list
>>> Mono-devel-list at lists.ximian.com
>>> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>>>
>>
>>
> 




More information about the Mono-devel-list mailing list