[Mono-bugs] [Bug 502554] New: Crash (null-reference) in Mono.Cecil.MethodReturnType.set_MarshalSpec() when cloning extern method with MarshalAs()

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sat May 9 15:21:44 EDT 2009


http://bugzilla.novell.com/show_bug.cgi?id=502554


           Summary: Crash (null-reference) in
                    Mono.Cecil.MethodReturnType.set_MarshalSpec() when
                    cloning extern method with MarshalAs()
    Classification: Mono
           Product: Mono: Class Libraries
           Version: unspecified
          Platform: x86
        OS/Version: Windows Vista
            Status: NEW
          Severity: Major
          Priority: P5 - None
         Component: Cecil
        AssignedTo: jbevain at novell.com
        ReportedBy: novell at timwi.de
         QAContact: mono-bugs at lists.ximian.com
          Found By: Other


The following code reproduces this problem:

using System;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using Mono.Cecil;

namespace CecilBug
{
    class CecilBug
    {
        [DllImport("kernel32.dll", SetLastError = true)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool CloseHandle(IntPtr hObject);
    }

    class Program
    {
        static void Main(string[] args)
        {
            AssemblyDefinition ad =
AssemblyFactory.GetAssembly(Application.ExecutablePath);
            foreach (TypeDefinition td in ad.MainModule.Types)
            {
                Console.WriteLine(td.FullName);
                var td2 = td.Clone();
            }
            Console.ReadLine();
        }
    }
}

The call to td.Clone() will attempt a clone on the extern method, which in turn
generates the exception.

-- 
Configure bugmail: http://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