Skip to content

Commit

Permalink
Merge pull request #6791 from cvium/fix_plugin_loading
Browse files Browse the repository at this point in the history
  • Loading branch information
Bond-009 committed Nov 6, 2021
2 parents b217f84 + d95c281 commit 8d8e113
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Emby.Server.Implementations/Plugins/PluginManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,16 @@ public IEnumerable<Assembly> LoadAssemblies()
{
assembly = Assembly.LoadFrom(file);

assembly.GetExportedTypes();
// Load all required types to verify that the plugin will load
assembly.GetTypes();
}
catch (FileLoadException ex)
{
_logger.LogError(ex, "Failed to load assembly {Path}. Disabling plugin.", file);
ChangePluginState(plugin, PluginStatus.Malfunctioned);
continue;
}
catch (TypeLoadException ex) // Undocumented exception
catch (SystemException ex) when (ex is TypeLoadException or ReflectionTypeLoadException) // Undocumented exception
{
_logger.LogError(ex, "Failed to load assembly {Path}. This error occurs when a plugin references an incompatible version of one of the shared libraries. Disabling plugin.", file);
ChangePluginState(plugin, PluginStatus.NotSupported);
Expand Down

0 comments on commit 8d8e113

Please sign in to comment.