From 9707c36b5c7e3a0165b232f7ff3a30567c3892a1 Mon Sep 17 00:00:00 2001 From: Scott Addie <10702007+scottaddie@users.noreply.github.com> Date: Thu, 10 Oct 2019 13:58:46 -0500 Subject: [PATCH] Add remark to ControllerBase.File methods regarding stream disposal (#14472) --- src/Mvc/Mvc.Core/src/ControllerBase.cs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/Mvc/Mvc.Core/src/ControllerBase.cs b/src/Mvc/Mvc.Core/src/ControllerBase.cs index 3590d6146f..c3b49e76a5 100644 --- a/src/Mvc/Mvc.Core/src/ControllerBase.cs +++ b/src/Mvc/Mvc.Core/src/ControllerBase.cs @@ -1260,6 +1260,9 @@ namespace Microsoft.AspNetCore.Mvc /// The with the contents of the file. /// The Content-Type of the file. /// The created for the response. + /// + /// The parameter is disposed after the response is sent. + /// [NonAction] public virtual FileStreamResult File(Stream fileStream, string contentType) => File(fileStream, contentType, fileDownloadName: null); @@ -1274,6 +1277,9 @@ namespace Microsoft.AspNetCore.Mvc /// The Content-Type of the file. /// Set to true to enable range requests processing. /// The created for the response. + /// + /// The parameter is disposed after the response is sent. + /// [NonAction] public virtual FileStreamResult File(Stream fileStream, string contentType, bool enableRangeProcessing) => File(fileStream, contentType, fileDownloadName: null, enableRangeProcessing: enableRangeProcessing); @@ -1289,6 +1295,9 @@ namespace Microsoft.AspNetCore.Mvc /// The Content-Type of the file. /// The suggested file name. /// The created for the response. + /// + /// The parameter is disposed after the response is sent. + /// [NonAction] public virtual FileStreamResult File(Stream fileStream, string contentType, string fileDownloadName) => new FileStreamResult(fileStream, contentType) { FileDownloadName = fileDownloadName }; @@ -1305,6 +1314,9 @@ namespace Microsoft.AspNetCore.Mvc /// The suggested file name. /// Set to true to enable range requests processing. /// The created for the response. + /// + /// The parameter is disposed after the response is sent. + /// [NonAction] public virtual FileStreamResult File(Stream fileStream, string contentType, string fileDownloadName, bool enableRangeProcessing) => new FileStreamResult(fileStream, contentType) @@ -1324,6 +1336,9 @@ namespace Microsoft.AspNetCore.Mvc /// The of when the file was last modified. /// The associated with the file. /// The created for the response. + /// + /// The parameter is disposed after the response is sent. + /// [NonAction] public virtual FileStreamResult File(Stream fileStream, string contentType, DateTimeOffset? lastModified, EntityTagHeaderValue entityTag) { @@ -1346,6 +1361,9 @@ namespace Microsoft.AspNetCore.Mvc /// The associated with the file. /// Set to true to enable range requests processing. /// The created for the response. + /// + /// The parameter is disposed after the response is sent. + /// [NonAction] public virtual FileStreamResult File(Stream fileStream, string contentType, DateTimeOffset? lastModified, EntityTagHeaderValue entityTag, bool enableRangeProcessing) { @@ -1369,6 +1387,9 @@ namespace Microsoft.AspNetCore.Mvc /// The of when the file was last modified. /// The associated with the file. /// The created for the response. + /// + /// The parameter is disposed after the response is sent. + /// [NonAction] public virtual FileStreamResult File(Stream fileStream, string contentType, string fileDownloadName, DateTimeOffset? lastModified, EntityTagHeaderValue entityTag) { @@ -1393,6 +1414,9 @@ namespace Microsoft.AspNetCore.Mvc /// The associated with the file. /// Set to true to enable range requests processing. /// The created for the response. + /// + /// The parameter is disposed after the response is sent. + /// [NonAction] public virtual FileStreamResult File(Stream fileStream, string contentType, string fileDownloadName, DateTimeOffset? lastModified, EntityTagHeaderValue entityTag, bool enableRangeProcessing) {