Hi Austin,

Yeah dealing with generics is not always a pleasant experience right now.

Here's code that works:

http://paste2.org/YeD09NEI

Always work with definitions until you need to create references in
your module, it's much easier. In this case, retrieve the definition
from get_Value, up until the point where you create a reference.

And then there's the MakeGeneric method that should be in
Mono.Cecil.Rocks but isn't.

Jb

On Sat, Nov 7, 2015 at 6:59 AM, Austin Brkich <[email protected]> wrote:
> I am having issues trying to create a instruction to call
> Nullable<Boolean>.Value
>
> The closest I have come is by using the following code as it will generate
> ILCode that appears to be almost identical to what it was originally. I have
> also included the Test.exe that I am modifying, In this example I am
> replacing a call to Nullable<Boolean>.Value that was generated from the
> compiler with one generated by Mono.Cecil, but I am getting the following
> error when trying to run the modified executable.
>
> https://gist.github.com/7H3LaughingMan/311662c07b8bf8f8d2c6
> https://dl.dropboxusercontent.com/u/7231478/Test.exe
>
> Unhandled Exception: System.TypeLoadException: Could not load type
> 'System.Nullable`1' from assembly 'Test, Version=1.0.0.0, Culture=neutral,
> PublicKeyToken=null' due to value type mismatch.
>    at Test.Program.Main(String[] args)
>
> --
> --
> --
> mono-cecil
> ---
> You received this message because you are subscribed to the Google Groups
> "mono-cecil" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.

-- 
-- 
--
mono-cecil
--- 
You received this message because you are subscribed to the Google Groups 
"mono-cecil" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to