mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-07-06 05:43:03 +02:00
Fix more possible exceptions
This commit is contained in:
parent
f62af07381
commit
6973182ade
|
@ -1181,10 +1181,32 @@ namespace Emby.Server.Implementations
|
||||||
{
|
{
|
||||||
Logger.LogInformation("Loading assemblies");
|
Logger.LogInformation("Loading assemblies");
|
||||||
|
|
||||||
AllConcreteTypes = GetComposablePartAssemblies()
|
AllConcreteTypes = GetTypes(GetComposablePartAssemblies()).ToArray();
|
||||||
.SelectMany(x => x.ExportedTypes)
|
}
|
||||||
.Where(type => type.IsClass && !type.IsAbstract && !type.IsInterface && !type.IsGenericType)
|
|
||||||
.ToArray();
|
private IEnumerable<Type> GetTypes(IEnumerable<Assembly> assemblies)
|
||||||
|
{
|
||||||
|
foreach (var ass in assemblies)
|
||||||
|
{
|
||||||
|
Type[] exportedTypes;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
exportedTypes = ass.GetExportedTypes();
|
||||||
|
}
|
||||||
|
catch (TypeLoadException ex)
|
||||||
|
{
|
||||||
|
Logger.LogError(ex, "Error getting exported types from {Assembly}", ass.FullName);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (Type type in exportedTypes)
|
||||||
|
{
|
||||||
|
if (type.IsClass && !type.IsAbstract && !type.IsInterface && !type.IsGenericType)
|
||||||
|
{
|
||||||
|
yield return type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private CertificateInfo CertificateInfo { get; set; }
|
private CertificateInfo CertificateInfo { get; set; }
|
||||||
|
@ -1353,7 +1375,7 @@ namespace Emby.Server.Implementations
|
||||||
{
|
{
|
||||||
plugAss = Assembly.LoadFrom(file);
|
plugAss = Assembly.LoadFrom(file);
|
||||||
}
|
}
|
||||||
catch (TypeLoadException ex)
|
catch (FileLoadException ex)
|
||||||
{
|
{
|
||||||
Logger.LogError(ex, "Failed to load assembly {Path}", file);
|
Logger.LogError(ex, "Failed to load assembly {Path}", file);
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in a new issue