[Mono-bugs] [Bug 517855] Invoking methods via Reflection that have COM objects as parameters throws MissingMethodException in mono.
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Wed Nov 11 15:18:04 EST 2009
http://bugzilla.novell.com/show_bug.cgi?id=517855
User tom_hindle at sil.org added comment
http://bugzilla.novell.com/show_bug.cgi?id=517855#c4
--- Comment #4 from tom hindle <tom_hindle at sil.org> 2009-11-11 13:18:02 MST ---
Ok, attempted to do this in two different ways both seem to work equally well
and pass my tests.
#if true
if (objArgs != null &&(objArgs[j] is __ComObject))
{
IntPtr comInterface;
Guid g = Marshal.GenerateGuidForType(args [j].ParameterType);
if (g != Guid.Empty &&
Marshal.QueryInterface(Marshal.GetIUnknownForObject(objArgs[j]), ref g, out
comInterface) == 0 /* S_OK */)
{
Marshal.Release(comInterface);
continue; // Parameter is implemented by ComObject
}
}
#else
if (objArgs != null && (objArgs[j] is __ComObject))
{
IntPtr comInterface = Marshal.GetComInterfaceForObject(objArgs[j], args
[j].ParameterType);
if (comInterface != null)
{
Marshal.Release(comInterface);
continue; // ParameterType is implemented by ComObject
}
}
#endif
I think I am going to pick the first implementation with QueryInterface as I
guess its quicker.
Attaching patch shortly as soon as rebuilt and retested everything.
--
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