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: [email protected]
ReportedBy: [email protected]
QAContact: [email protected]
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.
_______________________________________________
mono-bugs maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-bugs