aspnetcore: NullReferenceException thrown by IISHttpContext.AbortIO in ASP.NET Core 3.0.1
Describe the bug
From a weekly review of our production error logs, we noticed a single isolated example of the following exception from an ASP.NET Core 3.0.1 app running on Windows Server 2016 with IIS in-process hosting:
System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.AspNetCore.Server.IIS.Core.IISHttpContext.AbortIO(Boolean clientDisconnect)
at Microsoft.AspNetCore.Server.IIS.Core.IISHttpServer.OnDisconnect(IntPtr pvManagedHttpContext)
To Reproduce
Unknown - presumably some edge-case when the client disconnects.
From looking at the code, I’d guess that somehow _bodyOutput
was null
.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 46 (20 by maintainers)
I am also facing this error quote often! My project is in .net core 3.1
Fixed via https://github.com/dotnet/aspnetcore/pull/22806
Yep, we haven’t made a fix yet, so that would make sense 😃. Your exception settings also seem to be configured to break when this exception is thrown. I have the same suggestion for you as I described above. You should check the box in the Exception Thrown popup that says “Except when thrown from Microsoft.AspNetCore.Server.IIS”. When we make a fix, you won’t need that, but it’s relatively safe to do so now if you aren’t seeing a functional issue because of this.
As far as I’ve seen the issue, it’s just an issue when debugging as it pauses the execution of the application, from a user perspective, nothing goes wrong.
Sorry, didn’t know it was on the Details tab.
10.0.18362.1
@anurse IIS version I am running is 10.0.18362.1
This happens to me as well. context becomes null for some reason.
at Microsoft.AspNetCore.Server.IIS.Core.IISHttpServer.OnDisconnect
I am also getting this error on core 3.1 - I have my code on a repo if needed to be seen. Happens once and then if I continue my program it does not happen again.