Welcome to MSDN Blogs Sign in | Join | Help

Publisher Policy revisit

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.

Published Tuesday, May 24, 2005 12:01 PM by junfeng
Filed under: ,

Comments

# New and Notable 73

Wednesday, May 25, 2005 11:20 AM by Sam Gentile's Blog

# re: Publisher Policy revisit

Wednesday, June 22, 2005 4:12 PM by fred
All examples I have seen use the /link option (of AL.EXE) to build a publisher policy assembly from the publisher policy xml, thereby forcing the consumer to always have the xml file in the same directory as the policy assembly in order to install the policy assembly in the GAC. Is it possible to use the /embed option, so the user does not need the xml? (Does not work, in my experience.)
Thanks.

# re: Publisher Policy revisit

Wednesday, June 22, 2005 4:19 PM by junfeng
Fred,

Sorry there is no way to do that.

# re: Publisher Policy revisit

Tuesday, July 12, 2005 5:52 PM by Raj
Dropping a publisher policy assembly into the GAC requires you to do it from the folder containing the .config file which was used to create the published policy assembly.

So on the developer's machine one can run gacutil /i and install the policy into the GAC.

How does one do it using the installer. Or does one have to run gacutil on the end-user's computer to install the policy assembly into the GAC?

# re: Publisher Policy revisit

Tuesday, July 12, 2005 5:59 PM by junfeng
Publisher policy assembly is simply a multi-file assembly. You install it the same way as other multi-file assemblies.
New Comments to this post are disabled
 
Page view tracker