il

Static analysis of .net assembly

I have a C# project for which I need to find the all private methods which are not called from any other public method directly or indirectly. In addition, for each private method which is called from a public method, I need to know which public method it is. Then I will detemine if that method is really called from a client of the clas...

IL / CLR / DLR References?

I'm wanting to learn more about IL and CLR / DLR under the hood. A friend of mine recommended the book "Inside Microsoft .NET IL Assembler", but since it came out in 2002 I fear it's pretty out of date at this point. Does anyone have any more up-to-date books or websites that can be used by someone who understands .NET languages to lea...

alignment of sections and memory within an EXE file

What are the alignment of sections and memory within an EXE file I need to specify when creating using in the Mosa IL compiler? Thanks. ...

DynamicMethod for ConstructorInfo.Invoke, what do I need to consider?

My question is this: If I'm going to build a DynamicMethod object, corresponding to a ConstructorInfo.Invoke call, what types of IL do I need to implement in order to cope with all (or most) types of arguments, when I can guarantee that the right type and number of arguments is going to be passed in before I make the call? Backgr...

How to pass ctor args in Activator.CreateInstance or use IL?

I need a performance enhanced Activator.CreateInstance() and came across this article by Miron Abramson that uses a factory to create the instance in IL and then cache it. (I've included code below from Miron Abramson's site in case it somehow disappears). I'm new to IL Emit code and anything beyond Activator.CreateInstance() for instant...

Post sharp IL level interaction

So I'm looking at PostSharp and I noticed that this isn't using runtime generated proxies but it is actually giving hints to the compilation process to include the aspects within the IL. So my initial thought were wow, how the heck is this done. Any pointers where I should be looking? ...

IL Opcode Modification

Language: VB.NET 3.5 IL opcodes: 718 ldarg.0 719 callvirt System.Windows.Forms.Button RClient.RClient::get_cmd1() 724 ldarg.0 725 ldfld System.String[] RClient.RClient::ButtonStrings 730 ldc.i4.5 731 ldelem.ref 732 callvirt System.Void System.Windows.Forms.ButtonBase::set_Text(System.Stri...

Is an in depth knowledge of IL important for .net development

When I did mostly c++ I though it was critical to know assembly and wrote some non trial asm code just so that I could truly understand what was going on. I now do mostly .net and while I have some understanding of IL I am by no means proficient. Is IL a skill that one should have a knowledge of or will learning IL more completely go ...

.net Compiler Optimizations

I am writing an application that I need to run at incredibly low processor speeds. The application creates and destroys memory in creative ways throughout its run, and it works just fine. I am wondering what compiler optimizations occur so I can try to build to that. One trick off hand is that the CLR handles arrays much faster than list...

Visual Studio/RAD support for coding directly in IL?

For the longest time I've been curious to code in Intermediate Language just as an academic endeavour and to gain a better understanding of what's happening "under the hood". Does anybody provide Visual Studio support for *IL in the form of: project templates, IntelliSense integration, and those kind of RAD features? Edits: I don't mea...

'if' block in IL

I think I might be missing something important, but I can't seem to figure out how to construct a conditional statement in IL with dynamic method. I've only dabbled lightly in it before, but I need to extend some code now. Is there some documentation somewhere that I haven't found (apart from the CLI documentation), or does someone have...

Is it possible to inspect an assembly's IL instructions programmatically using managed code?

See title. Reflection.Emit seems to be more about creating a new dynamic assembly, not for loading an exisitng assembly and inspecting its IL. ...

Problems with generation of dynamic code

This code gif an exception: Invocation exception, please help, I don't know what happen, I think is some thing with the Add because he work when I push onto the stack intergers, and when i push lvalue It's didn't work, thanks static void Main(string[] args) { AppDomain dominioAplicacion = System.Threading.Thread.GetDomain();...

What do the IL Prefix OpCodes do?

I've been playing around with IL and I noticed OpCodes like Prefix1, with documentation basically telling me not to worry about it. Naturally, this makes me quite curious as to what these various Prefix OpCodes actually do. A quick Google search didn't turn up anything, so I thought I'd ask the experts here. Does anybody know what the...

IL short-form instructions aren't short?

Hi. I was looking at the IL code of a valid method with Reflector and I've run into this: L_00a5: leave.s L_0103 Instructions with the suffix .s are supposed to take an int8 operand, and sure enough this should be the case with Leave_S as well. However, 0x0103 is 259, which exceeds the capacity of an int8. The method somehow works, bu...

Determine whether .NET assemblies were built from the same source

Does anyone know of a way to compare two .NET assemblies to determine whether they were built from the "same" source files? I am aware that there are some differencing utilities available, such as the plugin for Reflector, but I am not interested in viewing differences in a GUI, I just want an automated way to compare a collection of bi...

How does short circuit evaluation work in MSIL

How does the short circuit evaluation work in the msil interpreter? Does the And instruction contain information about where to jump to if false, and same for the Or with true? ...

Traverse a c# method and anazlye the method body

Hi, Whats the easiest way to traverse a methodinfo in c#? I want to traverse the method body and find field-references and such and retrieves the types. In System.Reflection there is: mi.GetMethodBody().GetILAsByteArray() which is kinda low-level and would require "some" work before I would be able to traverse the body. I know Cec...

What OpCodes were introduced in CLR 4.0?

Are there any IL opcodes that are new in .NET 4.0 as compared to 3.5, and if so, where can I find a list of them? ...

Mechanism to extract specific IL (.NET Intermediate Language) signatures from an assembly

I have a list of about 25 types found in the Microsoft .NET assembly mscorlib.dll where I need to extract the IL signatures of the class and its members. I want one file per type, with each signature on one line. So, for example, take the type System.Collections.Generic.Comparer<T> I want to extract the following from the assembly for...