Hey Ivan,

Sorry for the long time before taking care of that.

It's now fixed in svn.

Thanks again,

On 10/19/07, Ivan <[EMAIL PROTECTED]> wrote:
>
> > I'm all for checking it in, but I'd really like to have a unit test for it.
>
> Ok, I've filtered a massive assembly into the following code that
> demonstrates it.
> Turns out, I'm simply cloning an interface method with a marshalled
> return.
>
> I don't know the unit test infrastructure for Cecil very well, is the
> following code close enough to adapt?
>
> P.S. I've only tested this under MS-CLR. I am yet to compile this
> under Mono (but I'd assume the same result).
>
> Regards,
> Ivan
>
>
> using System;
> using System.Reflection;
> using System.Runtime.InteropServices;
> using Mono.Cecil;
>
> namespace CustomMarshalerNamespace
> {
>         public interface CustomMarshalerInterface
>         {
>                 [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalType 
> = "")]
>                 int CustomMarshalerMethod();
>         }
>
>         public class CustomMarshalerTest
>         {
>                 static void Main()
>                 {
>                         AssemblyDefinition asm =
> AssemblyFactory.GetAssembly( Assembly.GetExecutingAssembly().Location );
>                         TypeDefinition td =
> asm.MainModule.Types["CustomMarshalerNamespace.CustomMarshalerInterface"];
>                         MethodDefinition md = td.Methods[0];
>                         try{
>                                 MethodDefinition mdc = md.Clone();
>                                 Console.WriteLine("Pass: 
> MethodDefinition.Clone()");
>                         } catch (NullReferenceException e){
>                                 Console.WriteLine("Fail: 
> MethodDefinition.Clone()");
>                         }
>                 }
>         }
> }
>
>
> >
>


-- 
Jb Evain  <[EMAIL PROTECTED]>

--~--~---------~--~----~------------~-------~--~----~
--
mono-cecil
-~----------~----~----~----~------~----~------~--~---

Reply via email to