[Mono-bugs] [Bug 372892] New: EqualityComparer<T>.Default causes NRE for null argument

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Mar 21 07:22:07 EDT 2008


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 at lists.ximian.com
        ReportedBy: atsushi at ximian.com
         QAContact: mono-bugs at 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.


More information about the mono-bugs mailing list