fix(plugins): close LA5 host lifecycle review
This commit is contained in:
parent
95f4be94db
commit
fbe9c8a288
25 changed files with 1043 additions and 120 deletions
|
|
@ -15,12 +15,24 @@ public interface IUiRegistry
|
|||
void AddMarkupPanel(string markupPath, object binding);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Host-infrastructure extension used to give each plugin a removable UI
|
||||
/// registration lifetime. Plugins continue to call
|
||||
/// <see cref="IUiRegistry.AddMarkupPanel"/>; the shared plugin host wraps that
|
||||
/// call and owns the returned token so failed initialization, failed enable,
|
||||
/// and shutdown can roll the registration back without trusting plugin code.
|
||||
/// </summary>
|
||||
public interface IScopedUiRegistry : IUiRegistry
|
||||
{
|
||||
IDisposable RegisterMarkupPanel(string markupPath, object binding);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// BCL-only UI sink for no-window plugin hosts. It intentionally retains
|
||||
/// neither markup paths nor binding objects, so a UI registration cannot keep
|
||||
/// a plugin assembly alive after its collectible load context is unloaded.
|
||||
/// </summary>
|
||||
public sealed class NoOpUiRegistry : IUiRegistry
|
||||
public sealed class NoOpUiRegistry : IScopedUiRegistry
|
||||
{
|
||||
public static NoOpUiRegistry Instance { get; } = new();
|
||||
|
||||
|
|
@ -31,4 +43,16 @@ public sealed class NoOpUiRegistry : IUiRegistry
|
|||
public void AddMarkupPanel(string markupPath, object binding)
|
||||
{
|
||||
}
|
||||
|
||||
public IDisposable RegisterMarkupPanel(string markupPath, object binding) =>
|
||||
NoOpRegistration.Instance;
|
||||
|
||||
private sealed class NoOpRegistration : IDisposable
|
||||
{
|
||||
internal static NoOpRegistration Instance { get; } = new();
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue