[Mono-bugs] [Bug 467509] New: Marshalling arrays of COM interfaces doesn't work
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Tue Jan 20 04:25:23 EST 2009
https://bugzilla.novell.com/show_bug.cgi?id=467509
Summary: Marshalling arrays of COM interfaces doesn't work
Classification: Mono
Product: Mono: Runtime
Version: SVN
Platform: All
OS/Version: Ubuntu
Status: NEW
Severity: Normal
Priority: P5 - None
Component: interop
AssignedTo: mono-bugs at lists.ximian.com
ReportedBy: eb1 at sil.org
QAContact: mono-bugs at lists.ximian.com
Found By: ---
When passing an array of COM interfaces from managed code to unmanaged the
unmanaged code receives garbage.
Example of IDL:
HRESULT Something([in] int cTests, [in, size_is(cTests)] ITest** pTests);
Interop defined like:
[MethodImpl(MethodImplOptions.InternalCall,
MethodCodeType=MethodCodeType.Runtime)]
public virtual extern void Something(int cTests,
[MarshalAs(UnmanagedType.LPArray, SizeParamIndex=0)] ITest[] tests);
Called from C# like:
ITest[] tests = new ITest[2];
tests[0] = new TestClass();
tests[1] = new TestClass();
p.Something(2, tests);
C++ implementation of Something:
HRESULT __stdcall CoCOMServer::Something(int cTests, ITest** pTests)
{
for (int i = 0; i < cTests; i++)
pTests[i]->Test(i);
return S_OK;
}
This crashes in CoCOMServer::Something when it tries to access the pTests
array.
--
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