Posts
  • Haibo Luo's weblog

    ILVisualizer 2010 Solution

    • 0 Comments
    The projects are set to be built against the .NET 4.0.
  • Haibo Luo's weblog

    IronPython: System.Reflection.Assembly object

    • 1 Comments
    IronPython offers a little bit more love to the Assembly object instance: we can directly access the assembly's top-level members (namespace, public type) via the dot operation. System.Reflection provides many ways to let you hold the assembly object...
  • Haibo Luo's weblog

    IronPython: System.Array

    • 1 Comments
    When you start interop'ing with .NET in IronPython, sooner or later, you will find that you are in need of creating an array as argument. There are mainly 2 ways to create array objects: Array with type indexing (for one-dimensional array object only...
  • Haibo Luo's weblog

    IronPython: ipyw.exe

    • 1 Comments
    Each IronPython binary release ships two executable files: ipy.exe and ipyw.exe. Their (only) difference is, ipy.exe is a console application and ipyw.exe is a windows application. So given the following winform.py, ## winform.py import clr clr.AddReference...
  • Haibo Luo's weblog

    SignatureResolver (unfinished)

    • 1 Comments
    While writing the ILVisualizer for dynamic method late 2005, I'd like to show the local variable information as well; so I started working on the managed signature parser, at least to parse LocalVarSig (Ecma-335 23.2.6). It was 2+ years ago, and never...
  • Haibo Luo's weblog

    ILVisualizer VS2008 solution

    • 5 Comments
    I attached the ILVisualizer VS2008 solution in this post. There is no source code update; the only change is to upgrade the Microsoft.VisualStudio.DebuggerVisualizers.dll reference from version 8.0.0.0 to version 9.0.0.0. Just for your convenience...
  • Haibo Luo's weblog

    IronPython: Accessing the .NET Field

    • 0 Comments
    The .NET libraries normally do not expose the public field, but we can still find its' presence for certain scenarios. IronPython treats the .NET fields like python attribute. For python attribute, the typical operations are set, get and delete. In general...
  • Haibo Luo's weblog

    VisualStudio as my IronPython editor

    • 9 Comments
    The following steps are what I did to get Visual Studio ready as my IronPython (and IronRuby) editor. Install the latest internal dogfood build of Visual Studio 2008. you may use Visual Studio 2005 or download the VS 2008 public beta2 ; ...
  • Haibo Luo's weblog

    IronPython: explicitly choose one method

    • 0 Comments
    C# allows method overloading. Given an argument list, the compiler performs the overload resolution to select the best method to invoke. The chosen method token is baked into the assembly. IronPython does the method resolution at the IronPython run time...
  • Haibo Luo's weblog

    IronPython: Provide (or not) Argument for by-ref Parameter

    • 1 Comments
    Python function may return multiple objects as a tuple. The .NET method can only return one object as the result of a call; in order to return more than one objects, by-ref parameters are needed. They are decorated with the parameter modifier (ref, out...
  • Haibo Luo's weblog

    IronPython: Keyword Argument to Set .NET Property/Field

    • 0 Comments
    Use keyword arguments to set properties or fields… you likely ask the question: where can we do this? IronPython allows it in the constructor call, the call against the .NET type. Such keyword should be the name of public field, or property (which is...
  • Haibo Luo's weblog

    IronPython: Passing Arguments for a Call

    • 0 Comments
    After getting a CLR type, we can play it like a python type. We can get the class/static methods using the dot operator ("attribute reference") on the type, or create an instance of it and then get the instance methods. In Python’s word, these methods...
  • Haibo Luo's weblog

    IronPython: Grab the .NET Type

    • 0 Comments
    After loading the assembly by clr.AddReference and then import namespace, we are ready to take hold of types and down-level namespaces using " attribute references ". >>> import System >>> System.DateTime # type <type 'DateTime...
  • Haibo Luo's weblog

    IronPython: clr.AddReference

    • 5 Comments
    In order to interop with .NET libraries, we need first load in the assemblies we want to play with. The family of AddReference methods in the clr module serves the purpose. clr.AddReference clr.AddReferenceByName clr.AddReferenceByPartialName...
  • Haibo Luo's weblog

    IronPython: import clr

    • 0 Comments
    clr is an IronPython built-in module, which provides some functionalities in order to interop with .NET. When writing "import clr" in a python module, it means you intend to leverage the .NET libraries. One classical example is python string's methods...
  • Haibo Luo's weblog

    DebuggerTypeProxy for IronPython Old-style Class and Instance

    • 1 Comments
    First I want to make it clear that this post means nothing related to IronPython's plan about debugging python code in the future; it serves more as an interesting example to demonstrate DebuggerTypeProxyAttribute and how types can be created dynamically...
  • Haibo Luo's weblog

    Name of Array Type

    • 0 Comments
    Two things related to array type name came to my mind while writing the previous post. Given an one-dimensional non-zero based double array x, x.GetType().ToString() returns "System.Double [*] "; we can use Type.GetType("System.Double[*]") to get hold...
  • Haibo Luo's weblog

    Late-bound Array SetValue

    • 0 Comments
    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...
  • Haibo Luo's weblog

    Take Two: IL Visualizer

    • 6 Comments
    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...
  • Haibo Luo's weblog

    Turn MethodInfo to DynamicMethod

    • 2 Comments
    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...
  • Haibo Luo's weblog

    System.Reflection-based ILReader

    • 2 Comments
    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...
  • Haibo Luo's weblog

    Always Peverify IL Code of your Dynamic Method

    • 0 Comments
    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...
  • Haibo Luo's weblog

    Shift Away from CLR Reflection Area

    • 0 Comments
    After 2-year Reflection test ownership and 1-year babysitting for Reflection.Emit and DynamicMethod areas, I am gradually away from these CLR feature areas, and will be more focusing on IronPython (and maybe others later). Before completely leaving...
  • Haibo Luo's weblog

    ILGenerator.EmitCall Mainly For vararg Methods

    • 0 Comments
    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...
  • Haibo Luo's weblog

    Member Order Returned by GetFields, GetMethods ...

    • 9 Comments
    As John mentioned in his post , every Reflection user should keep this in mind: our code should not count on the member order returned by GetFields, GetMethods and other similar GetXXXs calls. Given two fields (F1, F2) in one type, I think...
Page 1 of 2 (38 items) 12