Skip to content

Commit 43f9b67

Browse files
authored
Remove obsolete StaticFileResponseContext constructor #27529 (#28893)
1 parent 8cf5845 commit 43f9b67

File tree

2 files changed

+2
-21
lines changed

2 files changed

+2
-21
lines changed

src/Middleware/StaticFiles/src/PublicAPI.Shipped.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ Microsoft.AspNetCore.StaticFiles.Infrastructure.SharedOptionsBase.RequestPath.ge
4040
Microsoft.AspNetCore.StaticFiles.Infrastructure.SharedOptionsBase.RequestPath.set -> void
4141
Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware
4242
Microsoft.AspNetCore.StaticFiles.StaticFileResponseContext
43-
Microsoft.AspNetCore.StaticFiles.StaticFileResponseContext.StaticFileResponseContext() -> void
4443
Microsoft.Extensions.DependencyInjection.DirectoryBrowserServiceExtensions
4544
~Microsoft.AspNetCore.Builder.DefaultFilesOptions.DefaultFileNames.get -> System.Collections.Generic.IList<string>
4645
~Microsoft.AspNetCore.Builder.DefaultFilesOptions.DefaultFileNames.set -> void

src/Middleware/StaticFiles/src/StaticFileResponseContext.cs

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,33 +12,15 @@ namespace Microsoft.AspNetCore.StaticFiles
1212
/// </summary>
1313
public class StaticFileResponseContext
1414
{
15-
/// <summary>
16-
/// Constructs the <see cref="StaticFileResponseContext"/>.
17-
/// </summary>
18-
[Obsolete("Use the constructor that passes in the HttpContext and IFileInfo parameters: StaticFileResponseContext(HttpContext context, IFileInfo file)", false)]
19-
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
20-
public StaticFileResponseContext()
21-
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
22-
{
23-
}
24-
2515
/// <summary>
2616
/// Constructs the <see cref="StaticFileResponseContext"/>.
2717
/// </summary>
2818
/// <param name="context">The request and response information.</param>
2919
/// <param name="file">The file to be served.</param>
3020
public StaticFileResponseContext(HttpContext context, IFileInfo file)
3121
{
32-
if (file == null)
33-
{
34-
throw new ArgumentNullException(nameof(file));
35-
}
36-
if (context == null)
37-
{
38-
throw new ArgumentNullException(nameof(context));
39-
}
40-
Context = context;
41-
File = file;
22+
Context = context ?? throw new ArgumentNullException(nameof(context));
23+
File = file ?? throw new ArgumentNullException(nameof(file));
4224
}
4325

4426
/// <summary>

0 commit comments

Comments
 (0)