Browse by Tags

Tagged Content List
  • Blog Post: ILVisualizer 2010 Solution

    The projects are set to be built against the .NET 4.0.
  • Blog Post: Late-bound Array SetValue

    The type " System.Array " provides us a set of API for the late-bound array operations, including array creation ( Array.CreateInstance ), read/write access to array element ( Array.SetValue / Array.GetValue ). They are convenient to use. Let me start with some code to create an one-dimensional integer...
  • Blog Post: Take Two: IL Visualizer

    I was glad to hear many positive feedbacks about the DebuggerVisualizer for DynamicMethod ; on the sad side, it shows our lack of good LCG debugging support (on which, Mike Stall is seeking your opinion ). Recently along with the ILReader update, I made a few changes on the visualizer: Add support...
  • Blog Post: Turn MethodInfo to DynamicMethod

    I do not know why anyone ever need this :) but few readers did ask me similar questions before. Solving this problem also demonstrates one more ILReader usage. To build a DynamicMethod, we can choose either DynamicILGenerator or DynamicILInfo . My first impression of using DynamicILGenerator to emit...
  • Blog Post: System.Reflection-based ILReader

    Compared to what I posted previously here (or what was used in the DynamicMethod visualizer ), this new version introduced the Visitor pattern . A do-nothing visitor ILInstructionVisitor is included; the users can focus on their domain-specific logic by simply inheriting from it and overriding...
  • Blog Post: Always Peverify IL Code of your Dynamic Method

    Current dynamic method implementation does not have built-in support to pre-check whether the dynamic method code is verifiable. With bad IL sequence, very often you will get "System. InvalidProgramException : Common Language Runtime detected an invalid program" when it gets executed. See the code example...
  • Blog Post: ILGenerator.EmitCall Mainly For vararg Methods

    Vararg (variable arguments) methods accept argument lists of unknown length and type. CLR supports this by the IL instruction (arglist) and other BCL types, such as System.ArgIterator . C# compiler has undocumented keyword "__arglist" to support defining vararg methods, accessing variable arguments and...
  • Blog Post: Hello World with DynamicILInfo

    The following "Hello World" program shows how to use APIs in the class DynamicILInfo . MSDN documentation will have more details on this class in the next release. using System; using System.Reflection; using System.Reflection.Emit; class Demo { static void Main...
  • Blog Post: Activator.CreateInstance and beyond

    Q : Assume we have 2000 unknown types; (however) we know each type has a constructor with integer as its' only parameter type. How to create objects 10000 times for each type (and make such late-new fast)? Activator.CreateInstance comes to my fingers first. It is just so convenient to use: calling...
  • Blog Post: DebuggerVisualizer for DynamicMethod (Show me the IL)

    Have you ever tried DynamicMethod, one of the coolest features in the .NET 2.0? Hope you have; otherwise, you can try it now with the examples 1 , 2 . Like emitting IL to MethodBuilder, we first get ILGenerator from a DynamicMethod, and make a series of ILGenerator.Emit calls to emit the IL instructions...
Page 1 of 1 (10 items)