[Mono-bugs] [Bug 425001] New: MarshalNativeToManaged and CleanUpManagedData Not Called When Using ICustomMarshaler

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Sep 9 18:54:33 EDT 2008


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


           Summary: MarshalNativeToManaged and CleanUpManagedData Not Called
                    When Using ICustomMarshaler
           Product: Mono: Class Libraries
           Version: 1.9
          Platform: x86-64
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: System
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: martin_costello at talk21.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: Customer


Created an attachment (id=238746)
 --> (https://bugzilla.novell.com/attachment.cgi?id=238746)
Test case

This bug is based on trying to code a work-around to Bug 422564.

To replicate, use the attached testcase to link to a C Shared Object that
returns ANSI strings.

When run, watching the Debug trace output shows that the MarshalNativeToManaged
and CleanUpManagedData functions of ICustomMarshaler are not being called when
using the CustomMarshaler with the delegate.

Example trace is:

// P/Invoke starts

MarshalManagedToNative
Pointer value: 0x144665600
Allocation size: 513 bytes
CleanUpNativeData

// P/Invoke done

Tracing this using MS .NET 2.0 shows that the StringBuilder is correctly
populated in the MarshalNativeToManaged method.  However, it seems that this
method is not being called at all in Mono, preventing use of the
CustomMarshaler to get any data back from the native code.

I would expect MarshalNativeToManaged to be called after
MarshalManagedToNative, and before CleanUpNativeData, and CleanUpManagedData
after CleanUpNativeData.


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