Entries:
Comments:
Posts:

Loading User Information from Channel 9

Something went wrong getting user information from Channel 9

Latest Achievement:

Loading User Information from MSDN

Something went wrong getting user information from MSDN

Visual Studio Achievements

Latest Achievement:

Loading Visual Studio Achievements

Something went wrong getting the Visual Studio Achievements

Raja Krishnaswamy and Jesse Kaplan: CLR 4 - Inside No-PIA

Download

Right click “Save as…”

  • High Quality WMV (PC)
  • MP3 (Audio only)
  • MP4 (iPhone, Android)
  • Mid Quality WMV (Lo-band, Mobile)
  • WMV (WMV Video)
Principal Architect Raja Krishnaswamy, Program Manager Jesse Kaplan and team have created a new way to streamline and simplfiy PIA-based COM Interop: rather than including an entire PIA (Primary Interop Assembly) in your application to utilize the functionality of a few of its member classes, with CLR 4 you are able, via type embedding and type equivalence, to include only the objects you need which has the pleasant side effect of decreasing the size of your application and making it much easier for you to update without relying on a new PIA version from some third party (like Microsoft Office, for a canonical example). How does this work, exactly? Does this mean that PIAs are no longer required? How does versioning in this scenario work, exactly? Let's learn all about the thinking behind the thinking of this new CLR enabled feature, No-PIA.

You will learn, in great detail, about Type Equivalence in a soon to be released conversation with Raja and Vance Morrison. For now, wrap your head around No-PIA. Raja and Jesse are great at explaining complexity in simple to understand ways. 

No-PIA in CLR 4 is the beginning of something very, very useful (consider the non-interop scenario (managed to managed) for a moment. Fascinating, Captain.)

Enjoy!

Tags:

Follow the Discussion

  • Daniel Earwickerdanielearwi​cker I used to be language agnostic, now I'm language atheist

    So this Type Equivalence... are we talking about something that might be the basis of "static duck typing" as in C++ templates?

    e.g. public static void Foo<T>(T arg) where T : IBar

    Currently this means T must implement IBar... will type equivalence open up the possibility that T could be something that satisfies the method signatures of IBar, but doesn't necessarily have to implement it?

    That would be great. Suppose I have to work with several third party classes, they all have a method:

        void Log(string str)

    but they don't implement any common interface. I might write:

        interface ICanLog { void Log(string str); }

    Would I then (with some attribute magic?) be able to assign instances of those third party classes to variables/parameters of that interface type?

        ICanLog canLog = new ThirdPartyThing();

     

  • Daniel Earwickerdanielearwi​cker I used to be language agnostic, now I'm language atheist

    Bah... based on this, I'm guess the answer is no.

  • stevo_stevo_ Human after all

    If you think about it, type equivalence is about matching two essentially 'identical' types that are not actually the same clr type.. which is different to duck typing which is more of a.. these types are different (even outside of the clr type), but they look similar.

    The key difference tending to be that type equivalence is about allowing a boundary to be broken where two types are intending to be the same thing, but duck typing is less about the types intending to be the same, but just looking the same.

    Personally I don't see a lot of places where duck typing would be useful.. tends to be a simple proxy class fits most scenarios.

  • Daniel Earwickerdanielearwi​cker I used to be language agnostic, now I'm language atheist

    It becomes more of a problem as a project evolves over several years, especially with independently developed components going into it.

    Over time, the number of cases where proxy classes are needed grows until they blot out the intention of the "actual" code, which is when a language feature becomes valuable.

  • Does this embedding only work if you use a VSTO template in Visual Studio?

    For example, I'm working on project right now that's a WPF application which uses the PIAs to extract data from Excel for use by another application, and my app is basically a bridge for these programs, is this scenario supported?

  • Don't we have type embedding already, of sorts. Open up Reflector load say, the Word PIA and cut and paste the class interfaces you need into your project. This then gives you masive flexibility to modify the interfaces, leave member out and/or redefine members so they do not throw exceptions, but return hResults. Then you can use Compiler extensions to bolt on Word 12 interfaces and methods onto the Word 10/11 Object model. This is a very usefull trick Wink

  • Mohammed Farwanamferwana Na7oOoL

    Helpful

Remove this comment

Remove this thread

close

Comments Closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.