bump selenium container (#6071)

This commit is contained in:
Nicolas Dorier
2024-06-28 17:32:55 +09:00
committed by GitHub
parent 6a5bc99a55
commit c56b660c92
6 changed files with 20 additions and 7 deletions

View File

@@ -258,12 +258,27 @@ namespace BTCPayServer.Plugins
private static IEnumerable<IBTCPayServerPlugin> GetPluginInstancesFromAssembly(Assembly assembly)
{
return assembly.GetTypes().Where(type =>
return GetTypesNotCrash(assembly).Where(type =>
typeof(IBTCPayServerPlugin).IsAssignableFrom(type) && type != typeof(PluginService.AvailablePlugin) &&
!type.IsAbstract).
Select(type => (IBTCPayServerPlugin)Activator.CreateInstance(type, Array.Empty<object>()));
}
private static IEnumerable<Type> GetTypesNotCrash(Assembly assembly)
{
try
{
// Strange crash with selenium
if (assembly.FullName.Contains("Selenium", StringComparison.OrdinalIgnoreCase))
return Array.Empty<Type>();
return assembly.GetTypes();
}
catch(ReflectionTypeLoadException ex)
{
return ex.Types.Where(t => t is not null).ToArray();
}
}
private static IBTCPayServerPlugin GetPluginInstanceFromAssembly(string pluginIdentifier, Assembly assembly)
{
return GetPluginInstancesFromAssembly(assembly).FirstOrDefault(plugin => plugin.Identifier == pluginIdentifier);