[Mono-bugs] [Bug 520437] New: using == operator when comparing too difference refs to the same native COM object returns false .NET difference

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Jul 8 19:14:56 EDT 2009


http://bugzilla.novell.com/show_bug.cgi?id=520437


           Summary: using == operator when comparing too difference refs
                    to the same native COM object returns false .NET
                    difference
    Classification: Mono
           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: tom_hindle at sil.org
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


Created an attachment (id=303913)
 --> (http://bugzilla.novell.com/attachment.cgi?id=303913)
Sample Test Program showing bug with == operator and Com interop classes

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.11)
Gecko/2009060308 Ubuntu/9.04 (jaunty) Firefox/3.0.11

interop defined like:
[ComImport()]
[ClassInterface(ClassInterfaceType.None)]
[TypeLibType(TypeLibTypeFlags.FCanCreate)]
[Guid("D96B7867-EDE6-4c0d-80C2-B929300985A7")]
internal class _LgWritingSystemFactoryClass
{

}




var f = LgWritingSystemFactoryClass.Create(); // always returns same COM
instance
var f2 = LgWritingSystemFactoryClass.Create(); // always returns same COM
instance

Console.WriteLine(f);
Console.WriteLine(f.GetHashCode());

Console.WriteLine(f2);
Console.WriteLine(f2.GetHashCode());

if (f == f2) // false on mono true on .NET
{
  Console.WriteLine("Same by == operator");
}

if (f.Equals(f2)) // true on mono and .NET
{
  Console.WriteLine("Same by Equals");
}

Reproducible: Always

Steps to Reproduce:
1.
2.
3.
Actual Results:  
SIL.FieldWorks.Common.COMInterfaces._LgWritingSystemFactoryClass
170396480
SIL.FieldWorks.Common.COMInterfaces._LgWritingSystemFactoryClass
170396480
Same by Equals

Expected Results:  
SIL.FieldWorks.Common.COMInterfaces._LgWritingSystemFactoryClass
170396480
SIL.FieldWorks.Common.COMInterfaces._LgWritingSystemFactoryClass
170396480
Same by == operator
Same by Equals

-- 
Configure bugmail: http://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