Skip to content

Remove obsolete StaticFileResponseContext constructor #28893

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/Middleware/StaticFiles/src/PublicAPI.Shipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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<string>
~Microsoft.AspNetCore.Builder.DefaultFilesOptions.DefaultFileNames.set -> void
Expand Down
22 changes: 2 additions & 20 deletions src/Middleware/StaticFiles/src/StaticFileResponseContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,33 +12,15 @@ namespace Microsoft.AspNetCore.StaticFiles
/// </summary>
public class StaticFileResponseContext
{
/// <summary>
/// Constructs the <see cref="StaticFileResponseContext"/>.
/// </summary>
[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.
{
}

/// <summary>
/// Constructs the <see cref="StaticFileResponseContext"/>.
/// </summary>
/// <param name="context">The request and response information.</param>
/// <param name="file">The file to be served.</param>
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));
}

/// <summary>
Expand Down