Module Initializer (a.k.a Module Constructor)

Module Initializer (a.k.a Module Constructor)   CLR v1.0/v1.1 supports Type Initializer. Here is a quote from ECMA-335: CLR Partition II Metadata and File Format:   1.1.1         Type initializer A type (class, interface, or value type) can contain a special method called a type initializer, which is used to initialize the type itself. This method shall…


Don’t do Shell Extension Handlers in .NET

If you are thinking about writing Shell extension handles in .Net, please think again. (From Jesse Kaplan, one of the CLR Program Manager.) ” Unfortunately unmanaged C++ is really the only way to go here. Writing in-process shell extensions in managed code is actually a very dangerous thing to do because it has the effect…


Brad Abrams — API design hall of shame

Brad thinks the API AppDomainSetup.ShadowCopyFiles is API design hall of shame. I don’t think Brad is fair here. At best, it is just a not-so-well-designed API. An API to be hall of shame should at least have one of the following problems: 1. An API can never be used. 2. An API that nobody…


Assembly loading and AppDomain.AssemblyLoad Event

Assembly loading (Assembly.Load) is the process of loading an assembly reference. It starts with an assembly reference, and ends with a System.Reflection.Assembly instance that can be JITted and executed.   Disclaimer:   The following content is implementation detail. It is only applicable to CLR v2.0. And it may change in the future without notice.  …


Assemblies — Referencing and servicing

Every assembly has two life forms.   At development time, it is referenced by other assemblies. Its assembly version number is burned into assemblies that reference it.   At runtime, it is loaded by the assemblies that reference it. The exactly version of the assembly loaded is determined by the reference version and the servicing…


Host and Add-ins — sharing host assemblies

This is based on a private discussion with David Levine. But the scenario is generally applicable.   David has an application with the following deployment:   Application             Common             Plugin                         Plugin1                         Plugin2   The application loads one or more plugins at runtime. Each plugin is deployed to its own directory. At runtime,…


GAC Assemblies: Install and Uninstall

We have got many questions on GAC assemblies on install and uninstall.   This article attempts to discuss how GAC assemblies install and uninstall are implemented, and the common mistakes/errors people seen in those area.   (Disclaimer: Information discussed here is implementation detail. It only applies to the current product as the article is written,…


Enumerate the assembly identity attributes of a given assembly

In the previous post I showed an example on how to use fusion APIs to get the full display name of a given assembly. This time I am going to show a similar example. Instead of showing the full display name, we will show the display name broken up into attributes and values. ////  EnumIdAttr.cpp…


Getting the full display name of an assembly given the path to the manifest file

Given a path to an assembly manifest file, how do we get its full display name, including ProcessorArchitecture? From my previous discussion, we know there is no managed way to achieve this. We have to use an unmanaged solution. From the discussion of assembly identity, we know that identities can be reference or definition. In unmanaged…


Thomas Quinn on Addins

Thomas Quinn quietly started his blog on Addins. works as an Architect in VSTO (Visual Studio Tools For Office). He worked on the Addin model for Office for long. Now he is also looking to solve the managed Addin problem. If you care about Addin/Add-in/Plug-in, watch Thomas’ blog.