Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

.NET Forum


You are currently viewing our .NET Forum as a guest. Please register to participate.
Login



Reply
Has anyone used IL directly?
Old 06-11-2007, 06:27 PM Has anyone used IL directly?
Learning Newbie's Avatar
Defies a Status

Latest Blog Post:
Astounding Republican Paranoia
Posts: 5,662
Name: John Alexander
Trades: 0
I've been given some code and permission to do with it as I like, but everything is done using the ILGenerator class - Reflection - and I don't understand any of it. There are many hundred lines like the example below.

And for anybody who doesn't know the answer but knows some .NET, IL = Intermediate Language, aka MSIL. When you compile a .NET assembly it's turned into IL, which is somewhat like portable assembly language. The JIT (Just In Time) compiler then translates this at runtime into instructions optimized for the local machine, taking into account CPU type and number, and things like that.

I can see it's loading three arguments and then calling a method, and setting a breakpoint this happens so often I just can't pull meaningful info by debugging it. Is there any way I can take this in memory only assembly that gets generated, and decompile it from memory to see what's really going on?

ilGen.Emit(OpCodes.Ldarg_0);
ilGen.Emit(OpCodes.Ldarg_1);
ilGen.Emit(OpCodes.Ldarg_2);
ilGen.Emit(OpCodes.Call,
typeof(InsaneGeneratedClass).GetMethod("DispatchEv ent",
BindingFlags.Instance | BindingFlags.NonPublic));
ilGen.Emit(OpCodes.Ret);
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Learning Newbie is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Reply     « Reply to Has anyone used IL directly?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.96758 seconds with 12 queries