Share via


Sharing NGEN image in Multi-Domain Host

To reuse the same NGEN image of an assembly for every domain in a multi-domain environment, the assembly has to be loaded as domain neutral.

To enable domain neutral assemblies, the host must enable domain sharing when it starts CLR.

This is all discussed in my previous blog Domain Neutral Assemblies. Specifically,

<quote>

There are two ways for a host to specify this hint. One way is through hosting API CorBindToRuntimeEx. Another way is decorating your Main method with LoaderOptimizationAttribute.

</quote>

If the host did not enable domain sharing when it started CLR, NGEN image will be used in the first appdomain. The other appdomains will JIT compile the assemblies.

Comments

  • Anonymous
    November 23, 2005
    How the static Data structure are maintained across Mutiple application Domain.if an Assembly loaded by Domain neutral.
  • Anonymous
    November 23, 2005
    what is NGEN Image of an Assembly?
    u mean natively jitted code of an Assembly.