From 8bdb8a4575e54170d85e81dfe2dbb8e3fbf4d049 Mon Sep 17 00:00:00 2001 From: Jordan Dominion Date: Thu, 23 Nov 2023 18:35:34 -0500 Subject: [PATCH] Nullify `Application` That was easy --- src/Tgstation.Server.Host/Core/Application.cs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/Tgstation.Server.Host/Core/Application.cs b/src/Tgstation.Server.Host/Core/Application.cs index 404655f379..a4deff4806 100644 --- a/src/Tgstation.Server.Host/Core/Application.cs +++ b/src/Tgstation.Server.Host/Core/Application.cs @@ -63,8 +63,6 @@ using Tgstation.Server.Host.System; using Tgstation.Server.Host.Transfer; using Tgstation.Server.Host.Utils; -#nullable disable - namespace Tgstation.Server.Host.Core { /// @@ -81,7 +79,7 @@ namespace Tgstation.Server.Host.Core /// /// The for the . /// - ITokenFactory tokenFactory; + ITokenFactory? tokenFactory; /// /// Create the default . @@ -537,7 +535,7 @@ namespace Tgstation.Server.Host.Core applicationBuilder.UseRouting(); // Set up CORS based on configuration if necessary - Action corsBuilder = null; + Action? corsBuilder = null; if (controlPanelConfiguration.AllowAnyOrigin) { logger.LogTrace("Access-Control-Allow-Origin: *"); @@ -621,9 +619,9 @@ namespace Tgstation.Server.Host.Core // return provider.GetRequiredService().CurrentAuthenticationContext // But M$ said // https://stackoverflow.com/questions/56792917/scoped-services-in-asp-net-core-with-signalr-hubs - services.AddScoped(provider => provider + services.AddScoped(provider => (provider .GetRequiredService() - .HttpContext + .HttpContext ?? throw new InvalidOperationException($"Unable to resolve {nameof(IAuthenticationContext)} due to no HttpContext being available!")) .RequestServices .GetRequiredService() .CurrentAuthenticationContext);