[System.Security.SecurityCritical]  // auto-generated
        private void SetupFusionStore(AppDomainSetup info, AppDomainSetup oldInfo)
        {
            Contract.Requires(info != null);

#if FEATURE_FUSION
            if (oldInfo == null) {
                        
       // Create the application base and configuration file from the imagelocation
            // passed in or use the Win32 Image name.
            if(info.Value[(int) AppDomainSetup.LoaderInformation.ApplicationBaseValue] == null ||
               info.Value[(int) AppDomainSetup.LoaderInformation.ConfigurationFileValue] == null ) 
#else        
            if (info.ApplicationBase == null)
#endif                

            {
#if FEATURE_FUSION
                AppDomain defaultDomain = GetDefaultDomain();
                if (this == defaultDomain) {
                    // The default domain gets its defaults from the main process.
                    info.SetupDefaults(RuntimeEnvironment.GetModuleFileName(), imageLocationAlreadyNormalized : true);
                }
                else {
                    // Other domains get their defaults from the default domain. This way, a host process
                    // can use AppDomainManager to set up the defaults for every domain created in the process.
                    if (info.Value[(int) AppDomainSetup.LoaderInformation.ConfigurationFileValue] == null)
                        info.ConfigurationFile = defaultDomain.FusionStore.Value[(int) AppDomainSetup.LoaderInformation.ConfigurationFileValue];
                    if (info.Value[(int) AppDomainSetup.LoaderInformation.ApplicationBaseValue] == null)
                        info.ApplicationBase = defaultDomain.FusionStore.Value[(int) AppDomainSetup.LoaderInformation.ApplicationBaseValue];
                    if (info.Value[(int) AppDomainSetup.LoaderInformation.ApplicationNameValue] == null)
                        info.ApplicationName = defaultDomain.FusionStore.Value[(int) AppDomainSetup.LoaderInformation.ApplicationNameValue];
                }
#else
                info.SetupDefaults(RuntimeEnvironment.GetModuleFileName(), imageLocationAlreadyNormalized : true);
#endif
                
            }

#if FEATURE_FUSION
            // If there is no relative path then check the
            // environment
            if(info.Value[(int) AppDomainSetup.LoaderInformation.PrivateBinPathValue] == null)
                info.PrivateBinPath = Environment.nativeGetEnvironmentVariable(AppDomainSetup.PrivateBinPathEnvironmentVariable);

            // Add the developer path if it exists on this
            // machine.
            if(info.DeveloperPath == null)
                info.DeveloperPath = RuntimeEnvironment.GetDeveloperPath();

            }
                        
            // Set up the fusion context
            IntPtr fusionContext = GetFusionContext();
            info.SetupFusionContext(fusionContext, oldInfo);

            // Set loader optimization policy
#else
#if FEATURE_VERSIONING
            nCreateContext();
#endif // FEATURE_VERSIONING
#endif // FEATURE_FUSION

#if FEATURE_LOADER_OPTIMIZATION
            if (info.LoaderOptimization != LoaderOptimization.NotSpecified || (oldInfo != null && info.LoaderOptimization != oldInfo.LoaderOptimization))
                UpdateLoaderOptimization(info.LoaderOptimization);
#endif                        



            // This must be the last action taken
            _FusionStore = info;
        }
        private void SetupFusionStore(AppDomainSetup info)
        {
            // Create the application base and configuration file from the imagelocation
            // passed in or use the Win32 Image name.
            if(info.Value[(int) AppDomainSetup.LoaderInformation.ApplicationBaseValue] == null ||
               info.Value[(int) AppDomainSetup.LoaderInformation.ConfigurationFileValue] == null ) {
                AppDomain defaultDomain = GetDefaultDomain();
                if (this == defaultDomain) {
                    // The default domain gets its defaults from the main process.
                    info.SetupDefaultApplicationBase(RuntimeEnvironment.GetModuleFileName());
                }
                else {
                    // Other domains get their defaults from the default domain. This way, a host process
                    // can use AppDomainManager to set up the defaults for every domain created in the process.
                    if (info.Value[(int) AppDomainSetup.LoaderInformation.ConfigurationFileValue] == null)
                        info.ConfigurationFile = defaultDomain.FusionStore.Value[(int) AppDomainSetup.LoaderInformation.ConfigurationFileValue];
                    if (info.Value[(int) AppDomainSetup.LoaderInformation.ApplicationBaseValue] == null)
                        info.ApplicationBase = defaultDomain.FusionStore.Value[(int) AppDomainSetup.LoaderInformation.ApplicationBaseValue];
                    if (info.Value[(int) AppDomainSetup.LoaderInformation.ApplicationNameValue] == null)
                        info.ApplicationName = defaultDomain.FusionStore.Value[(int) AppDomainSetup.LoaderInformation.ApplicationNameValue];
                }
            }

            // If there is no relative path then check the
            // environment
            if(info.Value[(int) AppDomainSetup.LoaderInformation.PrivateBinPathValue] == null)
                info.PrivateBinPath = Environment.nativeGetEnvironmentVariable(AppDomainSetup.PrivateBinPathEnvironmentVariable);

            // Add the developer path if it exists on this
            // machine.
            if(info.DeveloperPath == null)
                info.DeveloperPath = RuntimeEnvironment.GetDeveloperPath();

            // Set up the fusion context
            IntPtr fusionContext = GetFusionContext();
            info.SetupFusionContext(fusionContext);

            // Set loader optimization policy
            if (info.LoaderOptimization != LoaderOptimization.NotSpecified)
                UpdateLoaderOptimization((int) info.LoaderOptimization);

            // This must be the last action taken
            _FusionStore = info;
        }
Exemple #3
0
 private void SetupFusionStore(AppDomainSetup info)
 {
     if ((info.Value[0] == null) || (info.Value[1] == null))
     {
         AppDomain defaultDomain = GetDefaultDomain();
         if (this == defaultDomain)
         {
             info.SetupDefaultApplicationBase(RuntimeEnvironment.GetModuleFileName());
         }
         else
         {
             if (info.Value[1] == null)
             {
                 info.ConfigurationFile = defaultDomain.FusionStore.Value[1];
             }
             if (info.Value[0] == null)
             {
                 info.ApplicationBase = defaultDomain.FusionStore.Value[0];
             }
             if (info.Value[4] == null)
             {
                 info.ApplicationName = defaultDomain.FusionStore.Value[4];
             }
         }
     }
     if (info.Value[5] == null)
     {
         info.PrivateBinPath = Environment.nativeGetEnvironmentVariable(AppDomainSetup.PrivateBinPathEnvironmentVariable);
     }
     if (info.DeveloperPath == null)
     {
         info.DeveloperPath = RuntimeEnvironment.GetDeveloperPath();
     }
     IntPtr fusionContext = this.GetFusionContext();
     info.SetupFusionContext(fusionContext);
     if (info.LoaderOptimization != LoaderOptimization.NotSpecified)
     {
         this.UpdateLoaderOptimization((int) info.LoaderOptimization);
     }
     this._FusionStore = info;
 }
Exemple #4
0
        private void SetupFusionStore(AppDomainSetup info)
        {
            _FusionStore = info;            

            // Create the application base and configuration file from the imagelocation
            // passed in or use the Win32 Image name.
            if(info.Value[(int) AppDomainSetup.LoaderInformation.ApplicationBaseValue] == null) {
                char[] sep = { '\\', '/'};
                String imageLocation = RuntimeEnvironment.GetModuleFileName();
                StringBuilder config = null;

                int i = imageLocation.LastIndexOfAny(sep);
                String appBase = null;
                if(i == -1) 
                    config = new StringBuilder(imageLocation);
                else {
                    appBase = imageLocation.Substring(0, i+1);
                    config = new StringBuilder(imageLocation.Substring(i+1));
                }
                
                config.Append(AppDomainSetup.ConfigurationExtension);
                info.ApplicationBase = appBase;                

                // If there was no configuration file but we built 
                // the appbase from the module name then add the
                // default configuration file.
                if(info.Value[(int) AppDomainSetup.LoaderInformation.ConfigurationFileValue] == null)
                    info.ConfigurationFile = config.ToString();

                String appName = null;
                if (i == -1)
                    appName = imageLocation;
                else
                    appName = imageLocation.Substring(i+1);

                // Set the application name so fusion can use it instead of falling back to exe name
                // which is "clix" 99.9% of the time on Rotor
                if(info.Value[(int) AppDomainSetup.LoaderInformation.ApplicationNameValue] == null)
                    info.ApplicationName = appName;
            }

            // If there is no relative path then check the
            // environment
            if(info.PrivateBinPath == null)
                info.PrivateBinPath = Environment.nativeGetEnvironmentVariable(AppDomainSetup.PrivateBinPathEnvironmentVariable);

            // Add the developer path if it exists on this
            // machine.
            info.DeveloperPath = RuntimeEnvironment.GetDeveloperPath();

            // Set up the fusion context
            IntPtr fusionContext = GetFusionContext();
            info.SetupFusionContext(fusionContext);
        }