public virtual Task <Assembly> LoadAsync(IPluginLoadContext pluginLoadContext)
        {
            var loadContext = new DefaultAssemblyLoadContextWithNativeResolver <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
                );

            var loadedPluginKey = new LoadedPluginKey(pluginLoadContext);

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

            return(loadContext.LoadPluginAssemblyAsync(pluginLoadContext));
        }
Esempio n. 2
0
        public virtual Assembly Load(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.LoadPluginAssembly(pluginLoadContext));
        }