There are several layers of binding policies in .Net framework. App Policy, Publisher Policy, Host Policy and Admin policy.

 

Policies are defined in config files. The config files are parsed once per AppDomain. The parsed result is used later for binding.

 

--- Except Publisher Policy.

 

Publisher Policy is per assembly. Unless an assembly load is issued, we will not look for publisher policy for that assembly

 

This creates an interesting problem. For the same appdomain, if a publisher policy is installing to the system, depending on whether the installation finishes before or after the assembly load, the assembly load may or may not see the publisher policy.

 

This ad-hoc publisher policy look up approach also makes domain neutral assemblies sharing much more challenging. There is no way to look at two appdomains and say those two appdomains have exactly the same binding policies.

 

To solve those problems, we made a change in .Net framework 2.0 for publisher policy look up. (Conceptually), on appdomain creation, we cache all the publisher policies in the system. We will only look at the publisher policies cache on binding policy resolution. If there is publisher policy change during the appdomain lifetime, it will not be seen by the appdomain.

 

This change gives us a much more consistent policy model, and enables us to make the right assembly sharing decision.

 

The caching is done at the time when publisher policy is installed/uninstalled, so that the runtime perf penalty is minimum.