[Mono-bugs] [Bug 480734] New: NullReferenceException when cloning method with [return: MarshalAs(...)] attribute

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sat Feb 28 07:27:29 EST 2009


           Summary: NullReferenceException when cloning method with
                    [return: MarshalAs(...)] attribute
    Classification: Mono
           Product: Mono: Class Libraries
           Version: unspecified
          Platform: x86-64
        OS/Version: Windows Vista
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Cecil
        AssignedTo: jbevain at novell.com
        ReportedBy: stapostol at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---

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

Description of Problem: Calling MethodDefinition.Clone() on the following
method results in a NullReferenceException.

[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool SetWindowPos(IntPtr handle, IntPtr insertAfter, int
x, int y, int cx, int cy, int flags);

Removing the "[return: MarshalAs(UnmanagedType.Bool)]" line removes the

I have attached a small, self-contained test case.

Steps to reproduce the problem:
1. Compile the attached test case against Mono.Cecil 0.6 and run it.

Actual Results:
System.NullReferenceException: Object reference not set to an instance of an
   at Mono.Cecil.MethodReturnType.set_MarshalSpec(MarshalSpec value)
   at Mono.Cecil.MethodDefinition.Clone(MethodDefinition meth, ImportContext
   at Mono.Cecil.MethodDefinition.Clone()
   at Test.Test.Main(String[] args) in
[...]\Projects\Tests\CecilMarshalAsBugProgram.cs:line 23

Expected Results:
System.Void Test.Test::Main(System.String[])

How often does this happen? 

Additional Information:
The actual exception happens in MethodReturnType.cs:103 of Mono.Cecil.

Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

More information about the mono-bugs mailing list