[Mono-bugs] [Bug 431304] New: reverse invoke via COM when marshaling a BSTR by ref [ retval] fails to convert MonoString to native string.

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Oct 1 11:34:40 EDT 2008


https://bugzilla.novell.com/show_bug.cgi?id=431304


           Summary: reverse invoke via COM when marshaling a BSTR by ref
                    [retval] fails to convert MonoString to native string.
           Product: Mono: Runtime
           Version: SVN
          Platform: x86
        OS/Version: Ubuntu
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: interop
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: tom_hindle at sil.org
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


reverse invoke via COM when marshaling a BSTR by ref [retval] fails to convert
MonoString to native string.


Example of the IDL.

HRESULT GetNextStyle(
                        [in] BSTR bstrName,
                        [out, retval] BSTR * pbstrNext);

C# implementation of GetNextStyle 

public string GetNextStyle(string sName)
{
   ....
   return someString;
}

Interop defined like:

[return: MarshalAs(UnmanagedType.BStr)]
[MethodImpl(MethodImplOptions.InternalCall,
MethodCodeType=MethodCodeType.Runtime)]
string GetNextStyle([MarshalAs(UnmanagedType.BStr)] string bstrName);


When GetNextStyle is called from C++ 

..->GetNextStyle(bstr1, &bstr2)

bstr2 contains an invalid BSTR. (a MonoString*)



A patch with a suggested fix to follow.


-- 
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