question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NullReferenceException in IISHttpContext

See original GitHub issue

Describe the bug

Since updating a website running in Azure App Service to use ASP.NET Core 2.2.0 with in-process hosting, I’ve observed a small number of NullReferenceExceptions being thrown via Application Insights.

System.NullReferenceException:
   at Microsoft.AspNetCore.Server.IIS.Core.IISHttpContext.GetOriginalPath (Microsoft.AspNetCore.Server.IIS, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60)
   at Microsoft.AspNetCore.Server.IIS.Core.IISHttpContext.InitializeContext (Microsoft.AspNetCore.Server.IIS, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60)
   at Microsoft.AspNetCore.Server.IIS.Core.IISHttpContextOfT`1+<ProcessRequestAsync>d__2.MoveNext (Microsoft.AspNetCore.Server.IIS, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60)
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
   at Microsoft.AspNetCore.Server.IIS.Core.IISHttpServer+<HandleRequest>d__27.MoveNext (Microsoft.AspNetCore.Server.IIS, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60)

To Reproduce

Application experiencing the issue was built from this commit: martincostello/website@ee2ca4ba02823b97062924b7dc8f313e6278a3f8

Expected behavior

HTTP request is processed successfully.

Screenshots

image

Additional context

Add any other context about the problem here. Include the output of dotnet --info

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:14
  • Comments:38 (21 by maintainers)

github_iconTop GitHub Comments

9reactions
mxwlfcommented, Sep 5, 2019

If I understand this thread correctly, we are supposed to wait for another release and in the meantime this is not causing any harm. But it is really distracting to see these false positives where we expect to see only “real” exceptions. Is there some middleware that you can provide to catch this condition? I do not want to filter this on my side, for fear of eating up an authentic failure. TIA

8reactions
jeremycookcommented, Apr 23, 2019

I’m glad this will be addressed in 3.0 but will this be addressed in 2.2.x or 2.x?

Read more comments on GitHub >

github_iconTop Results From Across the Web

IISHttpServer OnDisconnect NullReferenceException
NET Core web application that is primarily based on executing Endpoints, I frequently get a NullReferenceException on the AbortIO call following ...
Read more >
dotnet core 5 hosted in IIS using inprocess (Serilog ???)
Exception: System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.AspNetCore.Hosting.
Read more >
AspNetCore.Server.IIS.Core.IISHttpServer - Connection ID ...
An unhandled exception was thrown by the application. System. ... NET core has own App Pools. ... IISHttpContext.OnStarting(Func 2 callback, ...
Read more >
ASP.Net Core – Unexpected exception in IISHttpServer. ...
asp.net-corec++iis. I have ASP. ... NullReferenceException: Object reference not set to an instance of an object.\r\n at ... HandleRequest(IISHttpContext
Read more >
Issues with System.NullReferenceException occurrence ...
NET Core 3.1 is breaking when starting the web application because of a NullReferenceException, but this one is thrown in the IISHttpServer.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found