diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs
index b9d38504c1..5dcf42aae9 100644
--- a/Emby.Server.Implementations/ApplicationHost.cs
+++ b/Emby.Server.Implementations/ApplicationHost.cs
@@ -303,7 +303,6 @@ namespace Emby.Server.Implementations
/// The user data repository.
private IUserDataManager UserDataManager { get; set; }
private IUserRepository UserRepository { get; set; }
- internal IDisplayPreferencesRepository DisplayPreferencesRepository { get; set; }
internal SqliteItemRepository ItemRepository { get; set; }
private INotificationManager NotificationManager { get; set; }
@@ -472,6 +471,7 @@ namespace Emby.Server.Implementations
{
try
{
+ Logger.LogWarning("Creating instance of {Type}", type);
return ActivatorUtilities.CreateInstance(_serviceProvider, type);
}
catch (Exception ex)
@@ -525,29 +525,6 @@ namespace Emby.Server.Implementations
return parts;
}
- public List<(T, string)> GetExportsWithInfo(bool manageLifetime = true)
- {
- var parts = GetExportTypes()
- .Select(i =>
- {
- var obj = CreateInstanceSafe(i);
-
- return ((T)obj, i.Assembly.Location);
- })
- .Where(i => i.Item1 != null)
- .ToList();
-
- if (manageLifetime)
- {
- lock (DisposableParts)
- {
- DisposableParts.AddRange(parts.Select(i => i.Item1).OfType());
- }
- }
-
- return parts;
- }
-
///
/// Runs the startup tasks.
///
@@ -721,8 +698,7 @@ namespace Emby.Server.Implementations
serviceCollection.AddSingleton(UserRepository);
var displayPreferencesRepo = new SqliteDisplayPreferencesRepository(LoggerFactory, JsonSerializer, ApplicationPaths, FileSystemManager);
- DisplayPreferencesRepository = displayPreferencesRepo;
- serviceCollection.AddSingleton(DisplayPreferencesRepository);
+ serviceCollection.AddSingleton(displayPreferencesRepo);
ItemRepository = new SqliteItemRepository(ServerConfigurationManager, this, JsonSerializer, LoggerFactory, assemblyInfo);
serviceCollection.AddSingleton(ItemRepository);
@@ -1085,7 +1061,10 @@ namespace Emby.Server.Implementations
}
ConfigurationManager.AddParts(GetExports());
- Plugins = GetExportsWithInfo().Select(LoadPlugin).Where(i => i != null).ToArray();
+ Plugins = GetExports()
+ .Select(LoadPlugin)
+ .Where(i => i != null)
+ .ToArray();
HttpServer.Init(GetExports(false), GetExports());
@@ -1119,19 +1098,15 @@ namespace Emby.Server.Implementations
IsoManager.AddParts(GetExports());
}
- private IPlugin LoadPlugin((IPlugin, string) info)
+ private IPlugin LoadPlugin(IPlugin plugin)
{
- var plugin = info.Item1;
- var assemblyFilePath = info.Item2;
-
try
{
- var assemblyPlugin = plugin as IPluginAssembly;
-
- if (assemblyPlugin != null)
+ if (plugin is IPluginAssembly assemblyPlugin)
{
var assembly = plugin.GetType().Assembly;
var assemblyName = assembly.GetName();
+ var assemblyFilePath = assembly.Location;
var dataFolderPath = Path.Combine(ApplicationPaths.PluginsPath, Path.GetFileNameWithoutExtension(assemblyFilePath));
@@ -1401,7 +1376,7 @@ namespace Emby.Server.Implementations
foreach (var file in Directory.EnumerateFiles(ApplicationPaths.PluginsPath, "*.dll", SearchOption.TopDirectoryOnly))
{
Logger.LogInformation("Loading assembly {Path}", file);
- yield return Assembly.LoadFile(file);
+ yield return Assembly.LoadFrom(file);
}
}
diff --git a/Jellyfin.Server/CoreAppHost.cs b/Jellyfin.Server/CoreAppHost.cs
index 315e34a04c..a486c2a475 100644
--- a/Jellyfin.Server/CoreAppHost.cs
+++ b/Jellyfin.Server/CoreAppHost.cs
@@ -21,7 +21,9 @@ namespace Jellyfin.Server
protected override void RestartInternal() => Program.Restart();
protected override IEnumerable GetAssembliesWithPartsInternal()
- => new[] { typeof(CoreAppHost).Assembly };
+ {
+ yield return typeof(CoreAppHost).Assembly;
+ }
protected override void ShutdownInternal() => Program.Shutdown();