[release/5.0] Fix null ref in UrlGroup.Dispose due to logger not set (#28494)
* Fix null ref in UrlGroup.Dispose due to logger not set * PR Feedback: make _logger readonly Co-authored-by: Nolan Glore <nglore@microsoft.com>
This commit is contained in:
parent
894f4cabae
commit
050c257590
|
|
@ -24,7 +24,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys
|
|||
{
|
||||
try
|
||||
{
|
||||
UrlGroup = new UrlGroup(this, UrlPrefix.Create(urlPrefix));
|
||||
UrlGroup = new UrlGroup(this, UrlPrefix.Create(urlPrefix), logger);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
|
|
|||
|
|
@ -16,8 +16,9 @@ namespace Microsoft.AspNetCore.Server.HttpSys
|
|||
private static readonly int RequestPropertyInfoSize =
|
||||
Marshal.SizeOf<HttpApiTypes.HTTP_BINDING_INFO>();
|
||||
|
||||
private readonly ILogger _logger;
|
||||
|
||||
private ServerSession _serverSession;
|
||||
private ILogger _logger;
|
||||
private bool _disposed;
|
||||
private bool _created;
|
||||
|
||||
|
|
@ -40,8 +41,10 @@ namespace Microsoft.AspNetCore.Server.HttpSys
|
|||
Id = urlGroupId;
|
||||
}
|
||||
|
||||
internal unsafe UrlGroup(RequestQueue requestQueue, UrlPrefix url)
|
||||
internal unsafe UrlGroup(RequestQueue requestQueue, UrlPrefix url, ILogger logger)
|
||||
{
|
||||
_logger = logger;
|
||||
|
||||
ulong urlGroupId = 0;
|
||||
_created = false;
|
||||
var statusCode = HttpApi.HttpFindUrlGroupId(
|
||||
|
|
|
|||
|
|
@ -326,6 +326,10 @@ namespace Microsoft.AspNetCore.Server.HttpSys
|
|||
|
||||
internal unsafe void Delegate(DelegationRule destination)
|
||||
{
|
||||
if (destination == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(destination));
|
||||
}
|
||||
if (Request.HasRequestBodyStarted)
|
||||
{
|
||||
throw new InvalidOperationException("This request cannot be delegated, the request body has already started.");
|
||||
|
|
|
|||
Loading…
Reference in New Issue