feat: add failing plugins to the installer during boot, handle dependency resolution failures

This commit is contained in:
goaaats 2022-06-29 13:28:33 +02:00
parent 716736f022
commit d9c38a9813
No known key found for this signature in database
GPG key ID: 49E2AA8C6A76498B
4 changed files with 48 additions and 9 deletions

View file

@ -734,13 +734,23 @@ internal partial class PluginManager : IDisposable, IServiceType
{
// Dev plugins always get added to the list so they can be fiddled with in the UI
Log.Information(ex, $"Dev plugin failed to load, adding anyways: {dllFile.Name}");
plugin.Disable(); // Disable here, otherwise you can't enable+load later
// NOTE(goat): This can't work - plugins don't "unload" if they fail to load.
// plugin.Disable(); // Disable here, otherwise you can't enable+load later
}
else if (plugin.IsOutdated)
{
// Out of date plugins get added so they can be updated.
Log.Information(ex, $"Plugin was outdated, adding anyways: {dllFile.Name}");
}
else if (isBoot)
{
// During boot load, plugins always get added to the list so they can be fiddled with in the UI
Log.Information(ex, $"Regular plugin failed to load, adding anyways: {dllFile.Name}");
// NOTE(goat): This can't work - plugins don't "unload" if they fail to load.
// plugin.Disable(); // Disable here, otherwise you can't enable+load later
}
else
{
PluginLocations.Remove(plugin.AssemblyName?.FullName ?? string.Empty, out _);
@ -919,7 +929,7 @@ internal partial class PluginManager : IDisposable, IServiceType
if (!dryRun)
{
// Unload if loaded
if (plugin.State == PluginState.Loaded || plugin.State == PluginState.LoadError)
if (plugin.State is PluginState.Loaded or PluginState.LoadError or PluginState.DependencyResolutionFailed)
{
try
{