[Mono-bugs] [Bug 655674] New: Got exception and program crashes when LayoutKind.Auto is used during P/Invoke

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Nov 24 02:52:40 EST 2010


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

https://bugzilla.novell.com/show_bug.cgi?id=655674#c0


           Summary: Got exception and program crashes when LayoutKind.Auto
                    is used during P/Invoke
    Classification: Mono
           Product: Mono: Runtime
           Version: 2.8.x
          Platform: x86
        OS/Version: RHEL 5
            Status: NEW
          Severity: Critical
          Priority: P5 - None
         Component: interop
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: liewang at cisco.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


User-Agent:       Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1;
Trident/4.0; InfoPath.2; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR
3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)

If I creat a class and mark it as [StructLayout(LayoutKind.Auto)], and pass its
instance from managed code to native code using P/Invoke, runtime will report
an exception saying classes being passed to native side must be marked with
StructLayout attribute.

LayoutKind.Auto works on Microsoft .NET platform. Is it by design MONO does not
support it?

Reproducible: Always

Steps to Reproduce:
1. Create a class A and mark it as [StructLayout(LayoutKind.Auto)]
2. Create a P/Invoke managed method like: static extern void Test(A a) in
managed code. 
3. Create a corresponding native function like void Test(void *a)
4. In managed code, call the method created in step 2
Actual Results:  
Exception is thrown out saying classes being passed to native side must be
marked with StructLayout attribute.

Expected Results:  
No exception.

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