Skip to content

Plugin management rewrite#20

Merged
MrBisquit merged 15 commits into
masterfrom
mrbisquit/plugin-rewrite
Jul 24, 2026
Merged

Plugin management rewrite#20
MrBisquit merged 15 commits into
masterfrom
mrbisquit/plugin-rewrite

Conversation

@MrBisquit

@MrBisquit MrBisquit commented Jul 22, 2026

Copy link
Copy Markdown
Member

@MrBisquit MrBisquit added run-ci Run tests area/plugins This issue/PR is about the plugins area labels Jul 22, 2026
finally
{
plugin.LoadContext = null;
loadContext = null;
}

bool leaked = weakRef.IsAlive;
weakRef = null;

for (int i = 0; weakRef.IsAlive && i < MaxUnloadGCAttempts; i++)
{
GC.Collect();
{
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
Comment thread src/OpenPuppet.SDK/IPlugin.cs Fixed
Comment thread src/OpenPuppet.SDK/IPlugin.cs Fixed
Comment thread src/OpenPuppet.SDK/IPlugin.cs Fixed
Comment thread src/OpenPuppet.SDK/IPlugin.cs Fixed
Comment thread src/OpenPuppet.SDK/IPlugin.cs Fixed
Comment thread src/OpenPuppet.SDK/IPlugin.cs Fixed
@github-actions

github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown

xUnit Tests

4 tests   4 ✅  0s ⏱️
1 suites  0 💤
1 files    0 ❌

Results for commit c38244c.

♻️ This comment has been updated with latest results.

@MrBisquit

Copy link
Copy Markdown
Member Author

There's still some missing bits, like the plugin installation, but they can be added later

get
{
if (RegisteredPlugins[registry].Plugin != null) return;
return Path.Combine(InstallPath!, "Plugins");
{
get
{
return Path.Combine(PluginPath!, "plugins.json");
Comment thread src/OpenPuppet.SDK/IPlugin.cs Fixed
Comment thread src/OpenPuppet.SDK/IPlugin.cs Fixed
Comment thread src/OpenPuppet.SDK/IPlugin.cs Fixed
Comment thread src/OpenPuppet.SDK/IPlugin.cs Fixed
@MrBisquit

Copy link
Copy Markdown
Member Author

It's slightly hard to tell, but plugin unloading may be fixed now. It still says reference leaks exist, but previous issues like the app staying alive after closing when plugins have been unloaded no longer happens. More testing is needed though.

Comment on lines +150 to +156
catch (Exception ex)
{
SDK.logger.WriteLine(
ILogger.Level.Error,
$"Plugin \"{id}\" threw an exception during OnShutdown: {ex}"
);
}
Comment thread src/OpenPuppet.SDK/IPlugin.cs Fixed
Comment on lines +286 to +292
} catch(Exception ex)
{
plugin.LoadContext = null;
}

for (int i = 0; weakRef.IsAlive && i < MaxUnloadGcAttempts; i++)
SDK.logger.WriteLine(
ILogger.Level.Warn,
$"Could not fully uninstall plugin with the ID \"{id}\": {ex.Message}"
);
} finally
Comment on lines +375 to +388
} catch (Exception ex)
{
SDK.logger.WriteLine(
ILogger.Level.Error,
$"Failed to load plugins list: " + ex.Message
);
SDK.logger.WriteLine(
ILogger.Level.Warn,
"Rewriting plugin list with default values. " +
"The user will need to reinstall plugins."
);

RegisteredPlugins[registry].Enabled = true;
GenerateDefault();
}
@MrBisquit

Copy link
Copy Markdown
Member Author

Not much I can do for the generic catch clauses

Comment thread src/OpenPuppet.SDK/IPlugin.cs Fixed
@MrBisquit
MrBisquit marked this pull request as ready for review July 24, 2026 15:05
Comment on lines +230 to +236
} catch(Exception ex) {
SDK.logger.WriteLine(
ILogger.Level.Warn,
$"Failed to load plugin with ID \"{id}\": {ex.Message}"
);
UnloadPlugin(id);
}
@MrBisquit
MrBisquit merged commit a516736 into master Jul 24, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/plugins This issue/PR is about the plugins area run-ci Run tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant