is ModuleDefinition.Import on nullable bool correct?

View: New views
2 Messages — Rating Filter:   Alert me  

is ModuleDefinition.Import on nullable bool correct?

by Dirk Bonné :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi

I noticed a problem when trying importing a nullable bool:

   [Test]
    public void ImportNullable()
    {
      var assDef = AssemblyFactory.DefineAssembly("test", "test",
TargetRuntime.NET_2_0, AssemblyKind.Dll);
      var tr = assDef.MainModule.Import(typeof(bool?));
      Assert.IsTrue(tr.IsValueType);
    }

I would expect IsValueType to return true for "bool?".

Is this a bug?

I fell over that when generating properties/fields with nullable
types, and it may be the cause of a type loader exception.

Any ideas to get around this?

regards
Dirk




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


Re: is ModuleDefinition.Import on nullable bool correct?

by Dirk Bonné :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Ok forget it, I just tried the SVN version and there it works. Sorry to
bother you all :(

regards,
Dirk

Dirk Bonné wrote:

> Hi
>
> I noticed a problem when trying importing a nullable bool:
>
>    [Test]
>     public void ImportNullable()
>     {
>       var assDef = AssemblyFactory.DefineAssembly("test", "test",
> TargetRuntime.NET_2_0, AssemblyKind.Dll);
>       var tr = assDef.MainModule.Import(typeof(bool?));
>       Assert.IsTrue(tr.IsValueType);
>     }
>
> I would expect IsValueType to return true for "bool?".
>
> Is this a bug?
>
> I fell over that when generating properties/fields with nullable
> types, and it may be the cause of a type loader exception.
>
> Any ideas to get around this?
>
> regards
> Dirk
>
>
>
>  


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