https://bugzilla.novell.com/show_bug.cgi?id=465875


           Summary: System.Core Lookup<TKey,TElement> does not use the
                    specified comparer
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.0.x
          Platform: x86
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Sys.Core
        AssignedTo: [email protected]
        ReportedBy: [email protected]
         QAContact: [email protected]
          Found By: ---


User-Agent:       Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1;
NET CLR 2.0.50727; Media Center PC 5.0; InfoPath.2; .NET CLR 3.5.20706; .NET
CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30618)

The IEqualityComparer passed to ToLookup is not honored. This result in the
wrong comparison. It looks like the comparer is not passed to the dictionary
that implements lookup.

We would greatly appreciate a fix for this in 2.2.

Reproducible: Always

Steps to Reproduce:
        private class Color
        {
            public string Name;
            public int Value;
        }

        [Test]
        public void LookupCase()
        {
            Color[] colors = new Color[] 
            { 
                new Color() { Name = "red", Value = 0xFF0000 },
                new Color() { Name = "green", Value = 0x00FF00 },
                new Color() { Name = "blue", Value = 0x0000FF },
            };

            Lookup<string, int> lookup = colors.ToLookup(c => c.Name, c =>
c.Value, StringComparer.OrdinalIgnoreCase) as Lookup<string, int>;

            Assert.AreEqual(lookup["Red"].First(), 0xFF0000);
        }

Actual Results:  
KeyNotFoundException thrown.

Expected Results:  
No exception thrown.

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
_______________________________________________
mono-bugs maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-bugs

Reply via email to