MarketplaceLoader Class#
Shared logic for loading marketplace-installed extensions into an ExtensionHost. Used by both the in-process Blazor Server host and the out-of-process JSON-RPC host so the trust, resolve, and load behavior stays identical across them.
public static class MarketplaceLoader
Inheritance System.Object → MarketplaceLoader
Methods#
InstallLocalFileAsync(ExtensionHost, NuGetMarketplaceService, ExtensionTrustStore, string, string, CancellationToken) Method#
Installs a sideloaded local extension file (a .dll or .nupkg) into the
managed directory and loads it. The package identity is read from the file first so the
consent prompt names the real extension; on approval trust is persisted, the file is
installed, and its assemblies are loaded. The caller is responsible for recording the
result in the notebook's required extensions and firing change events, since notebook
mutation differs between hosts.
public static System.Threading.Tasks.Task<Verso.Extensions.Marketplace.MarketplaceLoader.LocalInstallOutcome> InstallLocalFileAsync(Verso.Extensions.ExtensionHost extensionHost, Verso.Extensions.Marketplace.NuGetMarketplaceService marketplace, Verso.Extensions.ExtensionTrustStore trustStore, string localFilePath, string managedDir, System.Threading.CancellationToken ct=default(System.Threading.CancellationToken));
Parameters#
extensionHost ExtensionHost
marketplace NuGetMarketplaceService
trustStore ExtensionTrustStore
localFilePath System.String
managedDir System.String
ct System.Threading.CancellationToken
Returns#
System.Threading.Tasks.Task<LocalInstallOutcome>
LoadAssembliesAsync(ExtensionHost, IReadOnlyList<string>, string) Method#
Loads every assembly produced by an install into the host, returning the number of extensions that registered. Dependency assemblies and native libraries register nothing and are skipped without error. When packageId is supplied, what registered is attributed to that package so the extension panel can report what the package added, including that it added nothing.
public static System.Threading.Tasks.Task<int> LoadAssembliesAsync(Verso.Extensions.ExtensionHost extensionHost, System.Collections.Generic.IReadOnlyList<string> assemblyPaths, string? packageId=null);
Parameters#
extensionHost ExtensionHost
assemblyPaths System.Collections.Generic.IReadOnlyList<System.String>
packageId System.String
Returns#
System.Threading.Tasks.Task<System.Int32>
LoadRequiredAsync(ExtensionHost, NotebookModel, ExtensionTrustStore, NuGetMarketplaceService, string, bool, CancellationToken) Method#
Resolves, downloads if needed, and loads the extensions a notebook declares in its required-extensions list. When promptForConsent is true a single batched consent request covers everything not already trusted, and anything that still cannot be loaded is reported through ReportUnavailableExtensionsAsync(IReadOnlyList<UnavailableExtensionInfo>) so the host can show a non-fatal notice. When false only already-pinned, already-trusted packages load and nothing is prompted or reported (used before the host session exists, where no consent channel is available yet); unpinned references are deferred to the later consent pass.
public static System.Threading.Tasks.Task LoadRequiredAsync(Verso.Extensions.ExtensionHost extensionHost, Verso.Abstractions.NotebookModel notebook, Verso.Extensions.ExtensionTrustStore trustStore, Verso.Extensions.Marketplace.NuGetMarketplaceService marketplace, string managedDir, bool promptForConsent, System.Threading.CancellationToken ct=default(System.Threading.CancellationToken));
Parameters#
extensionHost ExtensionHost
notebook NotebookModel
trustStore ExtensionTrustStore
marketplace NuGetMarketplaceService
managedDir System.String
promptForConsent System.Boolean
ct System.Threading.CancellationToken
Returns#
Remarks#
An unpinned ("latest") reference is resolved to a concrete version against the feed first, so consent and trust are pinned to that exact version. A one-time approval therefore does not silently trust a later version: if latest has moved since the last approval, consent is requested again before the new version loads. Cancellation propagates; other failures are collected rather than thrown, so a missing extension never blocks the open.