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 virtual async Task <Assembly> LoadPluginAssemblyAsync(IPluginLoadContext pluginLoadContext) { GuardIfAlreadyLoaded(pluginLoadContext?.PluginAssemblyName); this.pluginDependencyContext = await PluginDependencyContext.FromPluginAssemblyAsync( pluginLoadContext, this.hostFrameworkProvider, this.hostTypesProvider.ProvideHostTypes(), 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(base.LoadFromStream(pluginStream)); // ==> AssemblyLoadContext.LoadFromStream(Stream stream); } }