il

IL level code debugger

Hi, Is there any IL level debugger in form of a VS plugin or standalone application? Visual studio’s debugger is great, but it allows you to debug on either HLL code level or asselbly language, you can’t debug IL. It seems that in some situations it would be useful to have an opportunity to debug at IL level. In particular it might b...

What CLR/.NET bytecode tools exist?

I'm well aware of Java tools for manipulating, generating, decompiling JVM bytecode (ASM, cglib, jad, etc). What similar tools exist for the CLR bytecode? Do people do bytecode manipulation for the CLR? ...

Should .NET developers *really* be spending time learning C for low-level exposure?

When Joel Spolsky and Jeff Atwood began the disagreement in their podcast over whether programmers should learn C, regardless of their industry and platform of delivery, it sparkled quite an explosive debate within the developer community that probably still rages amongst certain groups today. I have been reading a number of passages fro...

Is there a Java Descriptor like thing in .Net?

I'm working on a static analysis tool for .NET assembly. In Java, there is a Descriptor which can be used to represent method or field in a string with specified grammar. for field: double d[][][]; will be [[[D It's useful especially when doing bytecode analysis. Coz it's easy to describe. If there a similar thing in .NET CLR? Or ...

In .NET, is the call stack inextricably tied to a thread?

Is it at all possible in the middle of a function execution to set a pointer to the current stack (to be picked up later) and then release the current thread (without unwinding the call stack) and give it back to the thread pool? And then, have another thread pick up where that thread left off? I know it would mean that someone calling...

How can I view the local variables on the evaluation stack when debugging a .NET CLR application?

I'm using Windbg (with the sos extention) and trying to debug a crashed application. I was able to dump the IL of the call that threw the exception and by examining the code, it seems like I could obtain the information that I need if I could dump the contents of the evaluation stack. Is it possible to do what with WinDbg & sos ? Here...

How do I get the mdTypeRef for a System.Byte for use with IMetaDataEmit?

I just getting started using IMetaDataEmit to write some .NET IL. I'm having trouble getting the mdTypeRef for a System.Byte (which I would like to use to declare a byte array on the stack). Here is my attempt. metaDataEmit->DefineTypeRefByName(NULL, L"System.Byte", &byteToken); This throws an error message that says "Could not load...

Implementing an Interface on a dynamic type with events

I am taking in an interface, looping through the .GetEvents() return array and attempting to implement the event on my dynamic type. At the point when I try to call TypeBuilder.CreateType(), I am greeted with this lovely error: "Application method on type from assembly is overriding a method that has been overridden." If I comment ...

Why is the C# compiler emitting a callvirt instruction for a GetType() method call?

I am curious to know why this is happening. Please read the code example below and the corresponding IL that was emitted in comments below each section: using System; class Program { static void Main() { Object o = new Object(); o.GetType(); // L_0001: newobj instance void [mscorlib]System.Object::.ctor() ...

Find argument values of method call in IL.

Hi, I have several special methods, and I want analyze they calls in compiled assembly. Example: public static class SrcHelper { [MySpecialMethod] [Conditional( "DEBUG" )] public static void ToDo( params object[] info ) { /* do nothing */ /* this method is not called when code is compiled in RELEASE mode */...

Recommend a book on Reflection.Emit in C#

Can anyone recommend a good book which covers IL programming, specifically using Reflection.Emit in C#? Thanks! ...

Why do people disassemble .NET (CLR) binaries?

I'm somewhat new to .NET but not new to programming, and I'm somewhat puzzled at the trend and excitement about disassembling compiled .NET code. It seems pointless. The high-level ease of use of .NET is the reason I use it. I've written C and real (hardware processor) assembly in environments with limited resources. That was the rea...

Getting IL code from DLL binary file

Hi Fellows, I am studding IL. I like .Net Reflector tool from RedGate (Lutz initially). I already have Serge Lidin’s and Ecma-335 books. It looks like these things are all we have to work with IL (except ILAsm and ILDasm, of course). My task is to parse assembly binary file and get IL code. It is obvious that the assembly is a binar...

Converting a CFG to IL

I build a CFG out of an arbitrary IL and want to convert that CFG back to IL. The order of the vertices in the CFG is of course not equal to the order of the original IL instructions. This is fine but overcomplicates some stuff. Imagine: Jump 'B' 'C': Return 'B': Jump 'C' This would result in a flow graph like this: (Jump B) -> (Jump...

C# iterate over switch's cases

Hello, Is it possible to retrieve programmatically all the case of a switch ? I don't have any idea, maybe by IL but not sure how to do ... In fact my global issue is the following : I got a siwtch case with string as property name. The method is very important and a regression is not allowed. I don't want a refactoring breaking this, ...

Is it possible to Code in MSIL?

I am just curious to know if this can be done or not. I don't plan on doing it if it dosen't pack some significant performance benefits. I am a web and game developer but I usually don't develop games in c#. ...

C# / IL to Three Address Code

Is there a framework existing to compile C# source into a three address code representation, or at least a tool that is able to read IL files and produce TAC in a CFG? I am looking for a framework that behaves like Soot for Java. The language does not matter. I have looked at the CodePlex CCI project but it looks like they produce an A...

MSIL Question (Basic)

Well lets say we have this c# code: public override void Write(XDRDestination destination) { destination.WriteInt(intValue); destination.WriteBool(boolValue); destination.WriteFixedString(str1, 100); destination.WriteVariableString(str2, 100); } IL: .method public hidebysig virtual instance void Write(class [...

Casting Object to a specific class in IL?

I discovered the reason I was getting "Operation could destabilize the runtime" in a DynamicMethod I'm producing, and though I easily fixed it, it left me with a seemingly simple question: How do I cast an object reference of type "Object" into a specific type, so that I can call methods from that type on the object reference? Below ...

What is your recommendation for a good book on the .NET CLR and CIL?

Do you know any good book about the workings of the CLR, the .NET Framework and CIL as opposed to any specific .NET language? ...