-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Plugin assembly loading fix #222
base: 13.1
Are you sure you want to change the base?
Conversation
Please we need this PR, plugins loading is stuck at "Loading x plugins..." |
Encountered some issues with your PR, first I think it's better to load all dependencies before actual plugins, i.e: Log.Info("<---< Loading global dependencies <---<");
LoadDependencies(Paths.GlobalPlugins.Dependencies);
Log.Info("<---< Loading server dependencies <---<");
LoadDependencies(Paths.LocalPlugins.Dependencies);
Log.Info("<---< Loading global plugins <---<");
// Load plugins from the Global directory inside "configs".
LoadPlugins(Paths.GlobalPlugins);
Log.Info("<---< Loading server plugins <---<");
// Load plugins from the [Server port] directory inside "configs".
LoadPlugins(Paths.LocalPlugins);
Log.Info("<---< Load all plugins <---<"); And I also think it's good to put try catch inside try
{
...........all the code of LoadPlugins..........
}
catch (Exception e)
{
Log.Error(e.ToString());
} |
I'm not really not sure why but putting line 145 if (missingDependencies.Count != 0)
{
Log.Error($"Failed loading plugin &2{Path.GetFileNameWithoutExtension(pluginInfo.Path)}&r, missing dependencies\n&2{string.Join("\n", missingDependencies.Select(x => "&r - &2" + x.Key + " v" + x.Value.ToString(3) + "&r"))}", "Loader");
continue;
} in the |
Cross-plugin dependency fix
This PR fixes an issue where plugins would not load if they referenced another plugin that was not yet loaded.
The problem:
Assume the following scenario:
The following plugins are to be loaded:
Both
PluginA
andPluginC
depend onPluginB
.PluginB
has no dependencies.PluginA
's assembly is loaded.PluginA
, but fails because the dependencyPluginB
is not yet found.PluginB
's assembly is loaded and initialized.PluginC
is loaded and starts without any issues.Changes:
PluginAPI.Loader.PluginAssemblyInformation
structInitializing (count) plugins...
This way, a plugin can reference another that comes after it alphabetically and will still be initialized correctly.