Blog - About

About Jason He's WebLog

Jason He = ZifengH 

 

  • Jason He's WebLog

    CLR AddIn Model in Paint.Net – 2 (AddIn discovery)

    • 3 Comments
    Paint.Net can host multiple AddIns. We can let the user pick which AddIn to use. To discover all the AddIns on the machine, we provided a few really simple APIs to do that. First, host needs to know where to discover all the AddIns and Pipelines (pipelines...
  • Jason He's WebLog

    CLR AddIn Model in Paint.Net – 6 (AddInBase, AddIn and Deployment)

    • 2 Comments
    AddInView is an abstract class and AddIn should inherit from it. Here is the code for AddInView and AddIn. namespace PaintDotNetAddInViews { [ AddInBase ] public abstract class PDNAddInView { public abstract void Render(); ...
  • Jason He's WebLog

    MSIL Verification Notes - 5

    • 2 Comments
    This is a short one. The arglist operation can only work when the method's signature indicates that it accepts a variable number of arguments. The verification rule also requires a type check for System.RuntimeArgumentHandle. Below scenario is clear...
  • Jason He's WebLog

    MSIL Verification Notes - 6

    • 2 Comments
    Recently I am running some DynamicMethod scenario. It seems very easy to Emit incorrect IL using ILGenerator. If the IL is not correct, JIT will throw unverifiable code exception or invalid program exception. I tend to debug with WinDBG+SOS for...
  • Jason He's WebLog

    CLR AddIn Model in Paint.Net – 11 (AddIn side data type adapter)

    • 2 Comments
    From the last blog post, we understand that we need new contract at the isolation boundary to route AddIn calls to and from the Host. We defined 3 new contracts IAddInRenderArgsContract IAddInSurfaceContract and IAddInColorBgraContract. As we discussed...
  • Jason He's WebLog

    CLR AddIn Model in Paint.Net – 1 (Introduction)

    • 1 Comments
    I am recently working on the AddIn model for the .Net Framework. There are many Hosts, AddIns, and Pipelines written internally to test our current model. One day, this idea popped out. How about adding AddIn model to a real-life project and see how good...
  • Jason He's WebLog

    Coding Patterns to Avoid In AddIn Pipeline Development

    • 1 Comments
    Why we need a new lifetime management model Managed code relies on Garbage Collection (GC) to manage the lifetime of object. For Add-In, object reference can be cross-appdomain or cross-process. We cannot rely on GC solely to give us automatic lifetime...
  • Jason He's WebLog

    MSIL Verification Notes - 7

    • 1 Comments
    Box operation can operate on ValueType but not all of them. Below example is trying to box System.ArgIterator. ArgIterator can have pointer points to stack, therefor BOX it won't be verifiable. .method public hidebysig static vararg...
  • Jason He's WebLog

    MSIL Verification Notes - 8

    • 1 Comments
    One more verification rule for ArgIterator. We cannot put it in an array. To avoid stack corruption, the JIT will consider below code unverifiable. IL_0000: ldc.i4.1 IL_0001: newarr ArgIterator IL_0006: stloc.0 IL_0007: ret Here is the PEVerify...
  • Jason He's WebLog

    MSIL Verification Notes - 9

    • 1 Comments
    Tail call verification rules require that no managed pointers to be passed from caller to callee if it points to a stack frame that to be removed. ArgIterator does not satisfy the condition. Therefore below code will not be verifiable. .method public...
  • Jason He's WebLog

    MSIL Verification Notes - 10

    • 1 Comments
    Another one that taking ArgIterator is deemed unverifiable. This time is for making a Type Reference. .method public hidebysig static vararg void VarArg () cil managed { .maxstack 8 .locals init ( [ 0 ] valuetype [ mscorlib ] System...
  • Jason He's WebLog

    MSIL Verification Notes - 11

    • 1 Comments
    Tired of creating one sample for one unverifiable scenario. Here is a laundry list for the other scenarios I know of. Build the sample in your mind and be happy. calli by design unverifiable ldftn/ldvirtftn not allowedn on .ctor "This" parameter...
  • Jason He's WebLog

    CLR AddIn Model in Paint.Net – 7 (AddIn Activation)

    • 1 Comments
    In the AddIn discovery blog, we already knew that we could get a collection of AddInToken from discovery API. AddInToken stores the full pipeline information and can be used to activate an AddIn. Before host start to activate an AddIn, it has many decisions...
  • Jason He's WebLog

    CLR AddIn Model in Paint.Net – 8 (AddInController)

    • 1 Comments
    Managing the lifecycle of an AddIn is not trivial. AddIn may be in-process or out-of process, AddIns may share one AppDomain, AddIn my stay in its own AppDomain, AdddIn may stay in Host’s AppDomain, one AddIn may have multiple host views, AddIn may have...
  • Jason He's WebLog

    CLR AddIn Model in Paint.Net – 3 (Host Side View)

    • 1 Comments
    Host Side View (HSV) is exactly what the name indicates. It is the view of an AddIn from Host’s eyes. It is an abstract class usually defined by the Host. AddIn developers will implement all the functionalities and return result to the Host via HSV. ...
  • Jason He's WebLog

    CLR AddIn Model in Paint.Net – 4 (Contract and HostAdapter)

    • 1 Comments
    We did not talk about anything about versioning. Versioning is a big challenge for Host and AddIn developers. Whenever Host or AddIn has an upgrade, versioning and compatibility becomes a big problem. Our AddIn model is trying to solve the versioning...
  • Jason He's WebLog

    CLR AddIn Model in Paint.Net – 5 (IContract, ContractBase and AddInAdapter)

    • 1 Comments
    Once we load an AddIn in an AppDomain, we need to think about its lifetime management. There are questions like how to keep it alive in a remoting environment? What happens when we disconnect an AddIn with the host? When should we unload the AddIn appdomain...
  • Jason He's WebLog

    A localization sample

    • 1 Comments
    My first impression about software localization can go back to many years ago. A friend of mine had one comment like this: people from English speaking country had advantages over other language speakers, because all major programming languages used only...
  • Jason He's WebLog

    CLR AddIn Model in Paint.Net – 9 (LifetimeToken and LifetimeTokenHandle)

    • 1 Comments
    AddIn can be passed to multiple Hosts, or it can have multiple references for the same Host. How to manage the lifetime of an AddIn becomes a big challenge. In the old COM world, we would do reference counting; allowing each AddIn increment the reference...
  • Jason He's WebLog

    MSIL Verification Notes - 1

    • 1 Comments
    I am recently working on some IL verification related scenario. IL verification is critical for CLR security. As CLR support for Silverlight approaching, it is a critical to make sure that our JIT can verify IL code correctly. I figured it would be interesting...
  • Jason He's WebLog

    MSIL Verification Notes - 2

    • 1 Comments
    MSIL (or CIL) uses a stack based model. To make sure that Type-safe code to be secure, it can only access the meory locations it is authorized to acess. We verify the type on the stack. If the data type on the stack does not match the expection of an...
  • Jason He's WebLog

    MSIL Verification Notes - 3

    • 1 Comments
    Below code tries to return a ByRef object which points on a stack location. CLR rule considers this kind of ByRef object is not safe to return to the caller. .method public instance int32& modopt([Microsoft.VisualC]Microsoft.VisualC.IsCXXPointerModifier...
  • Jason He's WebLog

    MSIL Verification Notes - 4

    • 0 Comments
    I thought I knew what is box and unbox. After reading the ECMA spec, I know that what I believed was actually wrong. Maybe you had the same incorrect impression in your mind. Box a integer will create an object on the heap and copy the date from valuetype...
  • Jason He's WebLog

    CLR AddIn Model in Paint.Net – 10 (Data type contract)

    • 0 Comments
    If the reader is familiar with Paint.Net, you will notice that we cannot really write a functional AddIn without referencing Paint.Net’s library. There are data types that are only available in Paint.Net. Many CLR AddIn adopters will soon come up with...
  • Jason He's WebLog

    MUI and UICulture

    • 0 Comments
    My parents are going to stay with us this coming summer. Besides all the preparations for their visit, I need to reconfigure my PC. They cannot operate my English XP and I don’t like to format my hard disk and reinstall a Chinese XP for them. Essentially...
Page 1 of 2 (29 items) 12