Esempio n. 1
0
        public override async Task <Assembly> LoadPluginAssemblyAsync(IPluginLoadContext pluginLoadContext)
        {
            if (this.pluginDependencyContext != null)
            {
                throw new PrisePluginException($"Plugin {pluginLoadContext.PluginAssemblyName} was already loaded");
            }

            this.pluginDependencyContext = await PluginDependencyContext.FromPluginAssemblyAsync(
                pluginLoadContext,
                this.logger,
                this.hostFrameworkProvider,
                this.hostTypesProvider.ProvideHostTypes(),
                this.hostTypesProvider.ProvideHostAssemblies(),
                this.downgradableDependenciesProvider.ProvideDowngradableTypes(),
                this.downgradableDependenciesProvider.ProvideDowngradableAssemblies(),
                this.remoteTypesProvider.ProvideRemoteTypes(),
                this.runtimePlatformContext,
                this.depsFileProvider,
                this.options.IgnorePlatformInconsistencies);

            using (var pluginStream = await LoadPluginFromNetworkAsync(this.baseUrl, pluginLoadContext.PluginAssemblyName))
            {
                this.assemblyLoadStrategy = this.assemblyLoadStrategyProvider.ProvideAssemblyLoadStrategy(this.logger, pluginLoadContext, this.pluginDependencyContext);

                return(base.LoadFromStream(pluginStream)); // ==> AssemblyLoadContext.LoadFromStream(Stream stream);
            }
        }
        public override Assembly LoadPluginAssembly(IPluginLoadContext pluginLoadContext)
        {
            this.pluginDependencyContext = PluginDependencyContext.FromPluginAssembly(
                pluginLoadContext,
                this.hostFrameworkProvider,
                this.hostTypesProvider.ProvideHostTypes(),
                this.remoteTypesProvider.ProvideRemoteTypes(),
                this.runtimePlatformContext,
                this.depsFileProvider,
                this.options.IgnorePlatformInconsistencies);

            using (var pluginStream = LoadPluginFromNetwork(this.baseUrl, pluginLoadContext.PluginAssemblyName))
            {
                this.assemblyLoadStrategy = this.assemblyLoadStrategyProvider.ProvideAssemblyLoadStrategy(this.logger, pluginLoadContext, this.pluginDependencyContext);

                return(base.LoadFromStream(pluginStream)); // ==> AssemblyLoadContext.LoadFromStream(Stream stream);
            }
        }
        public virtual Assembly LoadPluginAssembly(IPluginLoadContext pluginLoadContext)
        {
            GuardIfAlreadyLoaded(pluginLoadContext?.PluginAssemblyName);

            this.pluginDependencyContext = PluginDependencyContext.FromPluginAssembly <T>(
                pluginLoadContext,
                this.hostFrameworkProvider,
                this.hostTypesProvider.ProvideHostTypes(),
                this.remoteTypesProvider.ProvideRemoteTypes(),
                this.runtimePlatformContext,
                this.depsFileProvider,
                this.options.IgnorePlatformInconsistencies);

            using (var pluginStream = LoadFileFromLocalDisk(pluginLoadContext.PluginAssemblyPath, pluginLoadContext.PluginAssemblyName))
            {
                this.assemblyLoadStrategy = this.assemblyLoadStrategyProvider.ProvideAssemblyLoadStrategy(this.logger, pluginLoadContext, this.pluginDependencyContext);

                return(base.LoadFromStream(pluginStream)); // ==> AssemblyLoadContext.LoadFromStream(Stream stream);
            }
        }
        public virtual Assembly LoadPluginAssembly(IPluginLoadContext pluginLoadContext)
        {
            if (this.pluginDependencyContext != null)
            {
                throw new PrisePluginException($"Plugin {pluginLoadContext.PluginAssemblyName} was already loaded");
            }

            this.pluginDependencyContext = PluginDependencyContext.FromPluginAssembly <T>(
                pluginLoadContext,
                this.hostFrameworkProvider,
                this.hostTypesProvider.ProvideHostTypes(),
                this.remoteTypesProvider.ProvideRemoteTypes(),
                this.runtimePlatformContext,
                this.depsFileProvider,
                this.options.IgnorePlatformInconsistencies);

            using (var pluginStream = LoadFileFromLocalDisk(pluginLoadContext.PluginAssemblyPath, pluginLoadContext.PluginAssemblyName))
            {
                this.assemblyLoadStrategy = this.assemblyLoadStrategyProvider.ProvideAssemblyLoadStrategy(pluginLoadContext, this.pluginDependencyContext);

                return(base.LoadFromStream(pluginStream)); // ==> AssemblyLoadContext.LoadFromStream(Stream stream);
            }
        }
Esempio n. 5
0
        public virtual async Task <Assembly> LoadPluginAssemblyAsync(IPluginLoadContext pluginLoadContext)
        {
            GuardIfAlreadyLoaded(pluginLoadContext?.PluginAssemblyName);

            this.pluginDependencyContext = await PluginDependencyContext.FromPluginAssemblyAsync(
                pluginLoadContext,
                this.logger,
                this.hostFrameworkProvider,
                this.hostTypesProvider.ProvideHostTypes(),
                this.hostTypesProvider.ProvideHostAssemblies(),
                this.downgradableDependenciesProvider.ProvideDowngradableTypes(),
                this.downgradableDependenciesProvider.ProvideDowngradableAssemblies(),
                this.remoteTypesProvider.ProvideRemoteTypes(),
                this.runtimePlatformContext,
                this.depsFileProvider,
                this.options.IgnorePlatformInconsistencies);

            using (var pluginStream = await LoadFileFromLocalDiskAsync(pluginLoadContext.PluginAssemblyPath, pluginLoadContext.PluginAssemblyName))
            {
                this.assemblyLoadStrategy = this.assemblyLoadStrategyProvider.ProvideAssemblyLoadStrategy(this.logger, pluginLoadContext, this.pluginDependencyContext);
                return(LoadAndAddToWeakReferences(pluginStream));
            }
        }