コード例 #1
0
 internal AppDomainSetup(AppDomainSetup copy, bool copyDomainBoundData)
 {
     string[] strArray = this.Value;
     if (copy != null)
     {
         string[] strArray2 = copy.Value;
         int      length    = this._Entries.Length;
         int      num2      = strArray2.Length;
         int      num3      = (num2 < length) ? num2 : length;
         for (int i = 0; i < num3; i++)
         {
             strArray[i] = strArray2[i];
         }
         if (num3 < length)
         {
             for (int j = num3; j < length; j++)
             {
                 strArray[j] = null;
             }
         }
         this._LoaderOptimization            = copy._LoaderOptimization;
         this._AppDomainInitializerArguments = copy.AppDomainInitializerArguments;
         this._ActivationArguments           = copy.ActivationArguments;
         this._ApplicationTrust = copy._ApplicationTrust;
         if (copyDomainBoundData)
         {
             this._AppDomainInitializer = copy.AppDomainInitializer;
         }
         else
         {
             this._AppDomainInitializer = null;
         }
         this._ConfigurationBytes       = copy.GetConfigurationBytes();
         this._DisableInterfaceCache    = copy._DisableInterfaceCache;
         this._AppDomainManagerAssembly = copy.AppDomainManagerAssembly;
         this._AppDomainManagerType     = copy.AppDomainManagerType;
         this._AptcaVisibleAssemblies   = copy.PartialTrustVisibleAssemblies;
         if (copy._CompatFlags != null)
         {
             this._CompatFlags = new Dictionary <string, object>(copy._CompatFlags);
         }
     }
     else
     {
         this._LoaderOptimization = System.LoaderOptimization.NotSpecified;
     }
 }
コード例 #2
0
        internal AppDomainSetup(AppDomainSetup copy, bool copyDomainBoundData)
        {
            string[] mine = Value;
            if (copy != null)
            {
                string[] other     = copy.Value;
                int      mineSize  = _Entries.Length;
                int      otherSize = other.Length;
                int      size      = (otherSize < mineSize) ? otherSize : mineSize;

                for (int i = 0; i < size; i++)
                {
                    mine[i] = other[i];
                }

                if (size < mineSize)
                {
                    for (int i = size; i < mineSize; i++)
                    {
                        mine[i] = null;
                    }
                }

                _LoaderOptimization = copy._LoaderOptimization;

                _AppDomainInitializerArguments = copy.AppDomainInitializerArguments;
                _ActivationArguments           = copy.ActivationArguments;
                if (copyDomainBoundData)
                {
                    _AppDomainInitializer = copy.AppDomainInitializer;
                }
                else
                {
                    _AppDomainInitializer = null;
                }

                _ConfigurationBytes = copy.GetConfigurationBytes();
            }
            else
            {
                _LoaderOptimization = LoaderOptimization.NotSpecified;
            }
        }
コード例 #3
0
ファイル: AppDomainSetup.cs プロジェクト: randomize/VimConfig
 internal AppDomainSetup(AppDomainSetup copy, bool copyDomainBoundData)
 {
     string[] strArray = this.Value;
     if (copy != null)
     {
         string[] strArray2 = copy.Value;
         int      length    = this._Entries.Length;
         int      num2      = strArray2.Length;
         int      num3      = (num2 < length) ? num2 : length;
         for (int i = 0; i < num3; i++)
         {
             strArray[i] = strArray2[i];
         }
         if (num3 < length)
         {
             for (int j = num3; j < length; j++)
             {
                 strArray[j] = null;
             }
         }
         this._LoaderOptimization            = copy._LoaderOptimization;
         this._AppDomainInitializerArguments = copy.AppDomainInitializerArguments;
         this._ActivationArguments           = copy.ActivationArguments;
         this._ApplicationTrust = copy._ApplicationTrust;
         if (copyDomainBoundData)
         {
             this._AppDomainInitializer = copy.AppDomainInitializer;
         }
         else
         {
             this._AppDomainInitializer = null;
         }
         this._ConfigurationBytes    = copy.GetConfigurationBytes();
         this._DisableInterfaceCache = copy._DisableInterfaceCache;
     }
     else
     {
         this._LoaderOptimization = System.LoaderOptimization.NotSpecified;
     }
 }
コード例 #4
0
        internal AppDomainSetup(AppDomainSetup copy, bool copyDomainBoundData)
        {
            string[] mine = Value;
            if (copy != null)
            {
                string[] other     = copy.Value;
                int      mineSize  = _Entries.Length;
                int      otherSize = other.Length;
                int      size      = (otherSize < mineSize) ? otherSize : mineSize;

                for (int i = 0; i < size; i++)
                {
                    mine[i] = other[i];
                }

                if (size < mineSize)
                {
                    // This case can happen when the copy is a deserialized version of
                    // an AppDomainSetup object serialized by Everett.
                    for (int i = size; i < mineSize; i++)
                    {
                        mine[i] = null;
                    }
                }

                _LoaderOptimization = copy._LoaderOptimization;

                _AppDomainInitializerArguments = copy.AppDomainInitializerArguments;
                _ApplicationTrust = copy._ApplicationTrust;

                if (copyDomainBoundData)
                {
                    _AppDomainInitializer = copy.AppDomainInitializer;
                }
                else
                {
                    _AppDomainInitializer = null;
                }

                _ConfigurationBytes = copy.GetConfigurationBytes();
#if FEATURE_COMINTEROP
                _DisableInterfaceCache = copy._DisableInterfaceCache;
#endif // FEATURE_COMINTEROP
                _AppDomainManagerAssembly = copy.AppDomainManagerAssembly;
                _AppDomainManagerType     = copy.AppDomainManagerType;

                if (copy._CompatFlags != null)
                {
                    SetCompatibilitySwitches(copy._CompatFlags.Keys);
                }

                _TargetFrameworkName = copy._TargetFrameworkName;

#if FEATURE_RANDOMIZED_STRING_HASHING
                _UseRandomizedStringHashing = copy._UseRandomizedStringHashing;
#endif
            }
            else
            {
                _LoaderOptimization = LoaderOptimization.NotSpecified;
            }
        }
コード例 #5
0
 internal AppDomainSetup(AppDomainSetup copy, bool copyDomainBoundData)
 {
     string[] strArray = this.Value;
     if (copy != null)
     {
         string[] strArray2 = copy.Value;
         int length = this._Entries.Length;
         int num2 = strArray2.Length;
         int num3 = (num2 < length) ? num2 : length;
         for (int i = 0; i < num3; i++)
         {
             strArray[i] = strArray2[i];
         }
         if (num3 < length)
         {
             for (int j = num3; j < length; j++)
             {
                 strArray[j] = null;
             }
         }
         this._LoaderOptimization = copy._LoaderOptimization;
         this._AppDomainInitializerArguments = copy.AppDomainInitializerArguments;
         this._ActivationArguments = copy.ActivationArguments;
         this._ApplicationTrust = copy._ApplicationTrust;
         if (copyDomainBoundData)
         {
             this._AppDomainInitializer = copy.AppDomainInitializer;
         }
         else
         {
             this._AppDomainInitializer = null;
         }
         this._ConfigurationBytes = copy.GetConfigurationBytes();
         this._DisableInterfaceCache = copy._DisableInterfaceCache;
         this._AppDomainManagerAssembly = copy.AppDomainManagerAssembly;
         this._AppDomainManagerType = copy.AppDomainManagerType;
         this._AptcaVisibleAssemblies = copy.PartialTrustVisibleAssemblies;
         if (copy._CompatFlags != null)
         {
             this._CompatFlags = new Dictionary<string, object>(copy._CompatFlags);
         }
     }
     else
     {
         this._LoaderOptimization = System.LoaderOptimization.NotSpecified;
     }
 }
コード例 #6
0
 internal void SetupFusionContext(IntPtr fusionContext, AppDomainSetup oldADS)
 {
     this.UpdateContextPropertyIfNeeded(LoaderInformation.ApplicationBaseValue, ApplicationBaseKey, null, fusionContext, oldADS);
     this.UpdateContextPropertyIfNeeded(LoaderInformation.PrivateBinPathValue, PrivateBinPathKey, null, fusionContext, oldADS);
     this.UpdateContextPropertyIfNeeded(LoaderInformation.DevPathValue, DeveloperPathKey, null, fusionContext, oldADS);
     this.UpdateBooleanContextPropertyIfNeeded(LoaderInformation.DisallowPublisherPolicyValue, DisallowPublisherPolicyKey, fusionContext, oldADS);
     this.UpdateBooleanContextPropertyIfNeeded(LoaderInformation.DisallowCodeDownloadValue, DisallowCodeDownloadKey, fusionContext, oldADS);
     this.UpdateBooleanContextPropertyIfNeeded(LoaderInformation.DisallowBindingRedirectsValue, DisallowBindingRedirectsKey, fusionContext, oldADS);
     this.UpdateBooleanContextPropertyIfNeeded(LoaderInformation.DisallowAppBaseProbingValue, DisallowAppBaseProbingKey, fusionContext, oldADS);
     if (this.UpdateContextPropertyIfNeeded(LoaderInformation.ShadowCopyFilesValue, ShadowCopyFilesKey, this.ShadowCopyFiles, fusionContext, oldADS))
     {
         if (this.Value[7] == null)
         {
             this.ShadowCopyDirectories = this.BuildShadowCopyDirectories();
         }
         this.UpdateContextPropertyIfNeeded(LoaderInformation.ShadowCopyDirectoriesValue, ShadowCopyDirectoriesKey, null, fusionContext, oldADS);
     }
     this.UpdateContextPropertyIfNeeded(LoaderInformation.CachePathValue, CachePathKey, null, fusionContext, oldADS);
     this.UpdateContextPropertyIfNeeded(LoaderInformation.PrivateBinPathProbeValue, PrivateBinPathProbeKey, this.PrivateBinPathProbe, fusionContext, oldADS);
     this.UpdateContextPropertyIfNeeded(LoaderInformation.ConfigurationFileValue, ConfigurationFileKey, null, fusionContext, oldADS);
     UpdateByteArrayContextPropertyIfNeeded(this._ConfigurationBytes, (oldADS == null) ? null : oldADS.GetConfigurationBytes(), ConfigurationBytesKey, fusionContext);
     this.UpdateContextPropertyIfNeeded(LoaderInformation.ApplicationNameValue, ApplicationNameKey, this.ApplicationName, fusionContext, oldADS);
     this.UpdateContextPropertyIfNeeded(LoaderInformation.DynamicBaseValue, DynamicBaseKey, null, fusionContext, oldADS);
     StringBuilder builder = new StringBuilder();
     builder.Append(RuntimeEnvironment.GetRuntimeDirectoryImpl());
     builder.Append(RuntimeConfigurationFile);
     UpdateContextProperty(fusionContext, MachineConfigKey, builder.ToString());
     string hostBindingFile = RuntimeEnvironment.GetHostBindingFile();
     if ((hostBindingFile != null) || (oldADS != null))
     {
         UpdateContextProperty(fusionContext, HostBindingKey, hostBindingFile);
     }
 }
コード例 #7
0
        /// <summary>
        /// Create an instance of the wrapped ITask for a batch run of the task.
        /// </summary>
        public ITask CreateTaskInstance(ElementLocation taskLocation, TaskLoggingContext taskLoggingContext, AppDomainSetup appDomainSetup, bool isOutOfProc)
        {
            separateAppDomain = false;
            separateAppDomain = loadedType.HasLoadInSeparateAppDomainAttribute();

            taskAppDomain = null;

            if (separateAppDomain)
            {
                if (!loadedType.Type.IsMarshalByRef)
                {
                    taskLoggingContext.LogError
                    (
                        new BuildEventFileInfo(taskLocation),
                        "TaskNotMarshalByRef",
                        taskName
                     );

                    return null;
                }
                else
                {
                    // Our task depend on this name to be precisely that, so if you change it make sure
                    // you also change the checks in the tasks run in separate AppDomains. Better yet, just don't change it.

                    // Make sure we copy the appdomain configuration and send it to the appdomain we create so that if the creator of the current appdomain
                    // has done the binding redirection in code, that we will get those settings as well.
                    AppDomainSetup appDomainInfo = new AppDomainSetup();

                    // Get the current app domain setup settings
                    byte[] currentAppdomainBytes = appDomainSetup.GetConfigurationBytes();

                    // Apply the appdomain settings to the new appdomain before creating it
                    appDomainInfo.SetConfigurationBytes(currentAppdomainBytes);
                    taskAppDomain = AppDomain.CreateDomain(isOutOfProc ? "taskAppDomain (out-of-proc)" : "taskAppDomain (in-proc)", null, appDomainInfo);

                    // Hook up last minute dumping of any exceptions 
                    taskAppDomain.UnhandledException += new UnhandledExceptionEventHandler(ExceptionHandling.UnhandledExceptionHandler);
                }
            }

            // instantiate the task in given domain
            if (taskAppDomain == null || taskAppDomain == AppDomain.CurrentDomain)
            {
                // perf improvement for the same appdomain case - we already have the type object
                // and don't want to go through reflection to recreate it from the name.
                taskInstance = (ITask)Activator.CreateInstance(loadedType.Type);

                return taskInstance;
            }

            if (loadedType.Assembly.AssemblyFile != null)
            {
                taskInstance = (ITask)taskAppDomain.CreateInstanceFromAndUnwrap(loadedType.Assembly.AssemblyFile, loadedType.Type.FullName);

                // this will force evaluation of the task class type and try to load the task assembly
                Type taskType = taskInstance.GetType();

                // If the types don't match, we have a problem. It means that our AppDomain was able to load
                // a task assembly using Load, and loaded a different one. I don't see any other choice than
                // to fail here.
                if (taskType != loadedType.Type)
                {
                    taskLoggingContext.LogError
                    (
                    new BuildEventFileInfo(taskLocation),
                    "ConflictingTaskAssembly",
                    loadedType.Assembly.AssemblyFile,
                    loadedType.Type.Assembly.Location
                    );

                    taskInstance = null;
                }
            }
            else
            {
                taskInstance = (ITask)taskAppDomain.CreateInstanceAndUnwrap(loadedType.Type.Assembly.FullName, loadedType.Type.FullName);
            }

            return taskInstance;
        }
コード例 #8
0
ファイル: AppDomainSetup.cs プロジェクト: geoffkizer/coreclr
        internal AppDomainSetup(AppDomainSetup copy, bool copyDomainBoundData)
        {
            string[] mine = Value;
            if(copy != null) {
                string[] other = copy.Value;
                int mineSize = _Entries.Length;
                int otherSize = other.Length;
                int size = (otherSize < mineSize) ? otherSize : mineSize;

                for (int i = 0; i < size; i++)
                    mine[i] = other[i];

                if (size < mineSize)
                {
                    // This case can happen when the copy is a deserialized version of
                    // an AppDomainSetup object serialized by Everett.
                    for (int i = size; i < mineSize; i++)
                        mine[i] = null;
                }

                _LoaderOptimization = copy._LoaderOptimization;

                _AppDomainInitializerArguments = copy.AppDomainInitializerArguments;
#if FEATURE_CLICKONCE
                _ActivationArguments = copy.ActivationArguments;
#endif
                _ApplicationTrust = copy._ApplicationTrust;
                if (copyDomainBoundData)
                    _AppDomainInitializer = copy.AppDomainInitializer;
                else
                    _AppDomainInitializer = null;

                _ConfigurationBytes = copy.GetConfigurationBytes();
#if FEATURE_COMINTEROP
                _DisableInterfaceCache = copy._DisableInterfaceCache;
#endif // FEATURE_COMINTEROP
                _AppDomainManagerAssembly = copy.AppDomainManagerAssembly;
                _AppDomainManagerType = copy.AppDomainManagerType;
#if FEATURE_APTCA
                _AptcaVisibleAssemblies = copy.PartialTrustVisibleAssemblies;
#endif

                if (copy._CompatFlags != null)
                {
                    SetCompatibilitySwitches(copy._CompatFlags.Keys);
                }

#if !FEATURE_CORECLR
                if(copy._AppDomainSortingSetupInfo != null)
                {
                    _AppDomainSortingSetupInfo = new AppDomainSortingSetupInfo(copy._AppDomainSortingSetupInfo);
                }
#endif
                _TargetFrameworkName = copy._TargetFrameworkName;

#if FEATURE_RANDOMIZED_STRING_HASHING
                _UseRandomizedStringHashing = copy._UseRandomizedStringHashing;
#endif

            }
            else 
                _LoaderOptimization = LoaderOptimization.NotSpecified;
        }
コード例 #9
0
ファイル: TaskLoader.cs プロジェクト: nikson/msbuild
        /// <summary>
        /// Creates an ITask instance and returns it.  
        /// </summary>
        internal static ITask CreateTask(LoadedType loadedType, string taskName, string taskLocation, int taskLine, int taskColumn, LogError logError, AppDomainSetup appDomainSetup, bool isOutOfProc, out AppDomain taskAppDomain)
        {
            bool separateAppDomain = loadedType.HasLoadInSeparateAppDomainAttribute();
            s_resolverLoadedType = null;
            taskAppDomain = null;
            ITask taskInstanceInOtherAppDomain = null;

            try
            {
                if (separateAppDomain)
                {
                    if (!loadedType.Type.IsMarshalByRef)
                    {
                        logError
                        (
                            taskLocation,
                            taskLine,
                            taskColumn,
                            "TaskNotMarshalByRef",
                            taskName
                         );

                        return null;
                    }
                    else
                    {
                        // Our task depend on this name to be precisely that, so if you change it make sure
                        // you also change the checks in the tasks run in separate AppDomains. Better yet, just don't change it.

                        // Make sure we copy the appdomain configuration and send it to the appdomain we create so that if the creator of the current appdomain
                        // has done the binding redirection in code, that we will get those settings as well.
                        AppDomainSetup appDomainInfo = new AppDomainSetup();

                        // Get the current app domain setup settings
                        byte[] currentAppdomainBytes = appDomainSetup.GetConfigurationBytes();

                        // Apply the appdomain settings to the new appdomain before creating it
                        appDomainInfo.SetConfigurationBytes(currentAppdomainBytes);

                        if (BuildEnvironmentHelper.Instance.RunningTests)
                        {
                            // Prevent the new app domain from looking in the VS test runner location. If this
                            // is not done, we will not be able to find Microsoft.Build.* assemblies.
                            appDomainInfo.ApplicationBase = BuildEnvironmentHelper.Instance.CurrentMSBuildToolsDirectory;
                            appDomainInfo.ConfigurationFile = BuildEnvironmentHelper.Instance.CurrentMSBuildConfigurationFile;
                        }

                        AppDomain.CurrentDomain.AssemblyResolve += AssemblyResolver;
                        s_resolverLoadedType = loadedType;

                        taskAppDomain = AppDomain.CreateDomain(isOutOfProc ? "taskAppDomain (out-of-proc)" : "taskAppDomain (in-proc)", null, appDomainInfo);

                        if (loadedType.LoadedAssembly != null)
                        {
                            taskAppDomain.Load(loadedType.LoadedAssembly.GetName());
                        }

                        // Hook up last minute dumping of any exceptions 
                        taskAppDomain.UnhandledException += new UnhandledExceptionEventHandler(ExceptionHandling.UnhandledExceptionHandler);
                    }
                }
                else
                {
                    // perf improvement for the same appdomain case - we already have the type object
                    // and don't want to go through reflection to recreate it from the name.
                    return (ITask)Activator.CreateInstance(loadedType.Type);
                }

                if (loadedType.Assembly.AssemblyFile != null)
                {
                    taskInstanceInOtherAppDomain = (ITask)taskAppDomain.CreateInstanceFromAndUnwrap(loadedType.Assembly.AssemblyFile, loadedType.Type.FullName);

                    // this will force evaluation of the task class type and try to load the task assembly
                    Type taskType = taskInstanceInOtherAppDomain.GetType();

                    // If the types don't match, we have a problem. It means that our AppDomain was able to load
                    // a task assembly using Load, and loaded a different one. I don't see any other choice than
                    // to fail here.
                    if (taskType != loadedType.Type)
                    {
                        logError
                        (
                        taskLocation,
                        taskLine,
                        taskColumn,
                        "ConflictingTaskAssembly",
                        loadedType.Assembly.AssemblyFile,
                        loadedType.Type.Assembly.Location
                        );

                        taskInstanceInOtherAppDomain = null;
                    }
                }
                else
                {
                    taskInstanceInOtherAppDomain = (ITask)taskAppDomain.CreateInstanceAndUnwrap(loadedType.Type.Assembly.FullName, loadedType.Type.FullName);
                }

                return taskInstanceInOtherAppDomain;
            }
            finally
            {
                // Don't leave appdomains open
                if (taskAppDomain != null && taskInstanceInOtherAppDomain == null)
                {
                    AppDomain.Unload(taskAppDomain);
                    RemoveAssemblyResolver();
                }
            }
        }
コード例 #10
0
        internal void SetupFusionContext(IntPtr fusionContext, AppDomainSetup oldADS)
        {
            UpdateContextPropertyIfNeeded(LoaderInformation.ApplicationBaseValue, ApplicationBaseKey, null, fusionContext, oldADS);
            UpdateContextPropertyIfNeeded(LoaderInformation.PrivateBinPathValue, PrivateBinPathKey, null, fusionContext, oldADS);
            UpdateContextPropertyIfNeeded(LoaderInformation.DevPathValue, DeveloperPathKey, null, fusionContext, oldADS);

            UpdateBooleanContextPropertyIfNeeded(LoaderInformation.DisallowPublisherPolicyValue, DisallowPublisherPolicyKey, fusionContext, oldADS);
            UpdateBooleanContextPropertyIfNeeded(LoaderInformation.DisallowCodeDownloadValue, DisallowCodeDownloadKey, fusionContext, oldADS);
            UpdateBooleanContextPropertyIfNeeded(LoaderInformation.DisallowBindingRedirectsValue, DisallowBindingRedirectsKey, fusionContext, oldADS);
            UpdateBooleanContextPropertyIfNeeded(LoaderInformation.DisallowAppBaseProbingValue, DisallowAppBaseProbingKey, fusionContext, oldADS);

            if(UpdateContextPropertyIfNeeded(LoaderInformation.ShadowCopyFilesValue, ShadowCopyFilesKey, ShadowCopyFiles, fusionContext, oldADS)) {

                // If we are asking for shadow copy directories then default to
                // only to the ones that are in the private bin path.
                if(Value[(int) LoaderInformation.ShadowCopyDirectoriesValue] == null)
                    ShadowCopyDirectories = BuildShadowCopyDirectories();

                UpdateContextPropertyIfNeeded(LoaderInformation.ShadowCopyDirectoriesValue, ShadowCopyDirectoriesKey, null, fusionContext, oldADS);
            }

            UpdateContextPropertyIfNeeded(LoaderInformation.CachePathValue, CachePathKey, null, fusionContext, oldADS);
            UpdateContextPropertyIfNeeded(LoaderInformation.PrivateBinPathProbeValue, PrivateBinPathProbeKey, PrivateBinPathProbe, fusionContext, oldADS);
            UpdateContextPropertyIfNeeded(LoaderInformation.ConfigurationFileValue, ConfigurationFileKey, null, fusionContext, oldADS);

            UpdateByteArrayContextPropertyIfNeeded(_ConfigurationBytes, oldADS == null ? null : oldADS.GetConfigurationBytes(), ConfigurationBytesKey, fusionContext);

            UpdateContextPropertyIfNeeded(LoaderInformation.ApplicationNameValue, ApplicationNameKey, ApplicationName, fusionContext, oldADS);
            UpdateContextPropertyIfNeeded(LoaderInformation.DynamicBaseValue, DynamicBaseKey, null, fusionContext, oldADS);

            // Always add the runtime configuration file to the appdomain
            UpdateContextProperty(fusionContext, MachineConfigKey, RuntimeEnvironment.GetRuntimeDirectoryImpl() + RuntimeConfigurationFile);

            String hostBindingFile = RuntimeEnvironment.GetHostBindingFile();
            if(hostBindingFile != null || oldADS != null) // If oldADS != null, we don't know the old value of the hostBindingFile, so we force an update even when hostBindingFile == null.
                UpdateContextProperty(fusionContext, HostBindingKey, hostBindingFile);
        }
コード例 #11
0
        internal AppDomainSetup(AppDomainSetup copy, bool copyDomainBoundData)
        {
            string[] mine = Value;
            if(copy != null) {
                string[] other = copy.Value;
                int mineSize = _Entries.Length;
                int otherSize = other.Length;
                int size = (otherSize < mineSize) ? otherSize : mineSize;

                for (int i = 0; i < size; i++)
                    mine[i] = other[i];

                if (size < mineSize)
                {
                    for (int i = size; i < mineSize; i++)
                        mine[i] = null;
                }

                _LoaderOptimization = copy._LoaderOptimization;

                _AppDomainInitializerArguments = copy.AppDomainInitializerArguments;
                _ActivationArguments = copy.ActivationArguments;
                if (copyDomainBoundData)
                    _AppDomainInitializer = copy.AppDomainInitializer;
                else
                    _AppDomainInitializer = null;

                _ConfigurationBytes = copy.GetConfigurationBytes();
            }
            else 
                _LoaderOptimization = LoaderOptimization.NotSpecified;
        }
コード例 #12
0
        internal void SetupFusionContext(IntPtr fusionContext, AppDomainSetup oldADS)
        {
            this.UpdateContextPropertyIfNeeded(LoaderInformation.ApplicationBaseValue, ApplicationBaseKey, null, fusionContext, oldADS);
            this.UpdateContextPropertyIfNeeded(LoaderInformation.PrivateBinPathValue, PrivateBinPathKey, null, fusionContext, oldADS);
            this.UpdateContextPropertyIfNeeded(LoaderInformation.DevPathValue, DeveloperPathKey, null, fusionContext, oldADS);
            this.UpdateBooleanContextPropertyIfNeeded(LoaderInformation.DisallowPublisherPolicyValue, DisallowPublisherPolicyKey, fusionContext, oldADS);
            this.UpdateBooleanContextPropertyIfNeeded(LoaderInformation.DisallowCodeDownloadValue, DisallowCodeDownloadKey, fusionContext, oldADS);
            this.UpdateBooleanContextPropertyIfNeeded(LoaderInformation.DisallowBindingRedirectsValue, DisallowBindingRedirectsKey, fusionContext, oldADS);
            this.UpdateBooleanContextPropertyIfNeeded(LoaderInformation.DisallowAppBaseProbingValue, DisallowAppBaseProbingKey, fusionContext, oldADS);
            if (this.UpdateContextPropertyIfNeeded(LoaderInformation.ShadowCopyFilesValue, ShadowCopyFilesKey, this.ShadowCopyFiles, fusionContext, oldADS))
            {
                if (this.Value[7] == null)
                {
                    this.ShadowCopyDirectories = this.BuildShadowCopyDirectories();
                }
                this.UpdateContextPropertyIfNeeded(LoaderInformation.ShadowCopyDirectoriesValue, ShadowCopyDirectoriesKey, null, fusionContext, oldADS);
            }
            this.UpdateContextPropertyIfNeeded(LoaderInformation.CachePathValue, CachePathKey, null, fusionContext, oldADS);
            this.UpdateContextPropertyIfNeeded(LoaderInformation.PrivateBinPathProbeValue, PrivateBinPathProbeKey, this.PrivateBinPathProbe, fusionContext, oldADS);
            this.UpdateContextPropertyIfNeeded(LoaderInformation.ConfigurationFileValue, ConfigurationFileKey, null, fusionContext, oldADS);
            UpdateByteArrayContextPropertyIfNeeded(this._ConfigurationBytes, (oldADS == null) ? null : oldADS.GetConfigurationBytes(), ConfigurationBytesKey, fusionContext);
            this.UpdateContextPropertyIfNeeded(LoaderInformation.ApplicationNameValue, ApplicationNameKey, this.ApplicationName, fusionContext, oldADS);
            this.UpdateContextPropertyIfNeeded(LoaderInformation.DynamicBaseValue, DynamicBaseKey, null, fusionContext, oldADS);
            StringBuilder builder = new StringBuilder();

            builder.Append(RuntimeEnvironment.GetRuntimeDirectoryImpl());
            builder.Append(RuntimeConfigurationFile);
            UpdateContextProperty(fusionContext, MachineConfigKey, builder.ToString());
            string hostBindingFile = RuntimeEnvironment.GetHostBindingFile();

            if ((hostBindingFile != null) || (oldADS != null))
            {
                UpdateContextProperty(fusionContext, HostBindingKey, hostBindingFile);
            }
        }