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


           Summary: EqualityComparer<T>.Default causes NRE for null argument
           Product: Mono: Class Libraries
           Version: SVN
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: CORLIB
        AssignedTo: mono-bugs@lists.ximian.com
        ReportedBy: [EMAIL PROTECTED]
         QAContact: mono-bugs@lists.ximian.com
          Found By: ---


It's easy to fix this bug but I'm not sure which way to fix it is the best, so
I'm rather posting the bug here:

using System;
using System.Collections.Generic;

public class Test
{
        public static void Main ()
        {
                Console.WriteLine (EqualityComparer<object>.Default.GetHashCode
(null));
                Console.WriteLine (EqualityComparer<string>.Default.GetHashCode
(null));
        }
}

Actual results:

$ mono ./test.exe

Unhandled Exception: System.NullReferenceException: Object reference not set to
an instance of an object
  at
System.Collections.Generic.EqualityComparer`1+DefaultComparer[System.Object].GetHashCode
(System.Object obj) [0x00000]
  at Test.Main () [0x00000]

Expected results:
no NRE (.NET outputs 0 and 0 for each).


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

Reply via email to