[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
https://bugzilla.novell.com/show_bug.cgi?id=480734
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.
[DllImport("user32.dll")]
[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
exception.
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.Boolean
Test.Test::SetWindowPos(System.IntPtr,System.IntPtr,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32)
System.NullReferenceException: Object reference not set to an instance of an
object.
at Mono.Cecil.MethodReturnType.set_MarshalSpec(MarshalSpec value)
at Mono.Cecil.MethodDefinition.Clone(MethodDefinition meth, ImportContext
context)
at Mono.Cecil.MethodDefinition.Clone()
at Test.Test.Main(String[] args) in
[...]\Projects\Tests\CecilMarshalAsBugProgram.cs:line 23
Expected Results:
System.Boolean
Test.Test::SetWindowPos(System.IntPtr,System.IntPtr,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32)
System.Void Test.Test::Main(System.String[])
How often does this happen?
Always.
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