Esempio n. 1
0
        public virtual Task <Assembly> LoadAsync(IPluginLoadContext pluginLoadContext)
        {
            var pluginAssemblyName = Path.GetFileNameWithoutExtension(pluginLoadContext.PluginAssemblyName);
            var loadContext        = new NetworkAssemblyLoadContext <T>(
                logger,
                options,
                hostFrameworkProvider,
                hostTypesProvider,
                remoteTypesProvider,
                dependencyPathProvider,
                probingPathsProvider,
                runtimePlatformContext,
                depsFileProvider,
                pluginDependencyResolver,
                nativeAssemblyUnloader,
                assemblyLoadStrategyProvider,
                httpClientFactory,
                tempPathProvider
                );

            this.loadContexts[pluginAssemblyName]          = loadContext;
            this.loadContextReferences[pluginAssemblyName] = new System.WeakReference(loadContext);

            return(loadContext.LoadPluginAssemblyAsync(pluginLoadContext));
        }
Esempio n. 2
0
        public virtual Task <Assembly> LoadAsync(IPluginLoadContext pluginLoadContext)
        {
            var loadContext = new NetworkAssemblyLoadContext <T>(
                this.logger,
                this.options,
                this.hostFrameworkProvider,
                this.hostTypesProvider,
                this.downgradableDependenciesProvider,
                this.remoteTypesProvider,
                this.dependencyPathProvider,
                this.probingPathsProvider,
                this.runtimePlatformContext,
                this.depsFileProvider,
                this.pluginDependencyResolver,
                this.nativeAssemblyUnloader,
                this.assemblyLoadStrategyProvider,
                this.httpClientFactory,
                this.tempPathProvider
                );

            var loadedPluginKey = new LoadedPluginKey(pluginLoadContext);

            this.loadContexts[loadedPluginKey]          = loadContext;
            this.loadContextReferences[loadedPluginKey] = new System.WeakReference(loadContext);

            return(loadContext.LoadPluginAssemblyAsync(pluginLoadContext));
        }