diff --git a/src/Middleware/StaticFiles/src/PublicAPI.Shipped.txt b/src/Middleware/StaticFiles/src/PublicAPI.Shipped.txt index 5aff8dc36c11..bdbdcbf36de2 100644 --- a/src/Middleware/StaticFiles/src/PublicAPI.Shipped.txt +++ b/src/Middleware/StaticFiles/src/PublicAPI.Shipped.txt @@ -40,7 +40,6 @@ Microsoft.AspNetCore.StaticFiles.Infrastructure.SharedOptionsBase.RequestPath.ge Microsoft.AspNetCore.StaticFiles.Infrastructure.SharedOptionsBase.RequestPath.set -> void Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware Microsoft.AspNetCore.StaticFiles.StaticFileResponseContext -Microsoft.AspNetCore.StaticFiles.StaticFileResponseContext.StaticFileResponseContext() -> void Microsoft.Extensions.DependencyInjection.DirectoryBrowserServiceExtensions ~Microsoft.AspNetCore.Builder.DefaultFilesOptions.DefaultFileNames.get -> System.Collections.Generic.IList ~Microsoft.AspNetCore.Builder.DefaultFilesOptions.DefaultFileNames.set -> void diff --git a/src/Middleware/StaticFiles/src/StaticFileResponseContext.cs b/src/Middleware/StaticFiles/src/StaticFileResponseContext.cs index eb74797f89eb..9c435547c2cb 100644 --- a/src/Middleware/StaticFiles/src/StaticFileResponseContext.cs +++ b/src/Middleware/StaticFiles/src/StaticFileResponseContext.cs @@ -12,16 +12,6 @@ namespace Microsoft.AspNetCore.StaticFiles /// public class StaticFileResponseContext { - /// - /// Constructs the . - /// - [Obsolete("Use the constructor that passes in the HttpContext and IFileInfo parameters: StaticFileResponseContext(HttpContext context, IFileInfo file)", false)] -#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - public StaticFileResponseContext() -#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - { - } - /// /// Constructs the . /// @@ -29,16 +19,8 @@ public StaticFileResponseContext() /// The file to be served. public StaticFileResponseContext(HttpContext context, IFileInfo file) { - if (file == null) - { - throw new ArgumentNullException(nameof(file)); - } - if (context == null) - { - throw new ArgumentNullException(nameof(context)); - } - Context = context; - File = file; + Context = context ?? throw new ArgumentNullException(nameof(context)); + File = file ?? throw new ArgumentNullException(nameof(file)); } ///