[Mono-dev] Re: emitting a MethodInfo instance
mono at evain.net
Sat Aug 13 15:21:53 EDT 2005
I've added a patch in bugzilla to fix this.
However, your test case unveils another bug: ildasm fails to load
assemblies references if they are .exe instead of .dll.
On Aug 12, 2005, at 5:37 PM, Valient Gough wrote:
> Adding a followup for list-archive completeness.
> On 5/31/05, Valient Gough <valient at gmail.com> wrote:
>> Forgot to add, my first guess was actually to use OpCode.Ldtoken to
>> directly load MethodInfo
>> However, when I try and emit (OpCode.Ldtoken, MethodInfo), that
>> the ILGenerator to halt in mid-opcode, and monodis shows that last
>> opcode as "ldtoken" with no args.. Perhaps ILGenerator.Emit(OpCode,
>> MethodInfo) only works in mono 1.1.7 where OpCode == OpCode.Call* ?
> Mono is able to emit the code, but monodis can't seem to decompile it.
> Ref bug #75544: http://bugzilla.ximian.com/show_bug.cgi?id=75544
> The following code will emit a MethodInfo reference into IL code, and
> the code will work fine, but it will render the resulting .dll
> undecodable by monodis:
> void Emit_MethodInfo(ILGenerator ig, MethodInfo method)
> ig.Emit( OpCodes.Ldtoken, method ); // this crashes monodis
> ig.Emit( OpCodes.Call,
> ig.Emit( OpCodes.Castclass, typeof(MethodInfo) );
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
More information about the Mono-devel-list