diff --git a/.github/workflows/CodeQuality.yml b/.github/workflows/CodeQuality.yml index de987574..e548219f 100644 --- a/.github/workflows/CodeQuality.yml +++ b/.github/workflows/CodeQuality.yml @@ -79,7 +79,7 @@ jobs: run: dotnet-coverage collect --output CoverageResults/integration.test.report.coverage.xml --output-format cobertura --session-id integrationtestsession "dotnet run --project CometServer/CometServer.csproj -c Debug" & - name: Wait for API to start - run: sleep 60 # Adjust as necessary to ensure the API is up + run: sleep 45 # Adjust as necessary to ensure the API is up - name: Checkout Integration Test Suite uses: actions/checkout@v4 diff --git a/CometServer/Authentication/AuthenticationPluginInjector.cs b/CometServer/Authentication/AuthenticationPluginInjector.cs index 146d9c84..b0832ee4 100644 --- a/CometServer/Authentication/AuthenticationPluginInjector.cs +++ b/CometServer/Authentication/AuthenticationPluginInjector.cs @@ -41,13 +41,8 @@ namespace CometServer.Authentication /// /// The injector loads up authenticator plugins. /// - public class AuthenticationPluginInjector : IAuthenticationPluginInjector, IDisposable + public class AuthenticationPluginInjector : IAuthenticationPluginInjector { - /// - /// A collection of that has been discovered - /// - private List discoveredAssemblies = new List(); - /// /// The name of the folder where all authentication modules reside. /// @@ -64,7 +59,6 @@ public class AuthenticationPluginInjector : IAuthenticationPluginInjector, IDisp public AuthenticationPluginInjector(ILogger logger) { this.logger = logger; - AppDomain.CurrentDomain.AssemblyResolve += this.OnAssemblyResolve; this.Plugins = this.LoadPlugins(); @@ -109,7 +103,6 @@ private static string[] GetFolders() /// The of modules private ReadOnlyCollection LoadPlugins() { - this.discoveredAssemblies.Clear(); var sw = Stopwatch.StartNew(); var result = new List(); @@ -123,11 +116,8 @@ private ReadOnlyCollection LoadPlugins() // load all assemblies types encountered in the plugin folders that implement the IAuthenticatorPlugin interface foreach (var pluginFolder in pluginFolders) { - var assemblies = new DirectoryInfo(pluginFolder).GetFiles().Where(file => file.Extension == ".dll") - .Select(file => Assembly.LoadFile(file.FullName)) - .ToList(); - - foreach (var assembly in assemblies) + foreach (var assembly in new DirectoryInfo(pluginFolder).GetFiles().Where(file => file.Extension == ".dll") + .Select(file => Assembly.LoadFile(file.FullName))) { builder.RegisterAssemblyTypes(assembly) .Where(x => typeof(IAuthenticatorPlugin).IsAssignableFrom(x)) @@ -135,8 +125,6 @@ private ReadOnlyCollection LoadPlugins() .PropertiesAutowired() .SingleInstance(); } - - this.discoveredAssemblies.AddRange(assemblies); } var container = builder.Build(); @@ -150,25 +138,5 @@ private ReadOnlyCollection LoadPlugins() return result.AsReadOnly(); } - - /// - /// Helps resolving assemblies that may be required for loaded plugins - /// - /// The sender object - /// The - /// The resolved assemblies, if found - private Assembly OnAssemblyResolve(object sender, ResolveEventArgs args) - { - return this.discoveredAssemblies.FirstOrDefault(x => x.FullName == args.Name); - } - - /// - /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. - /// - public void Dispose() - { - AppDomain.CurrentDomain.AssemblyResolve -= this.OnAssemblyResolve; - } } } -