Setting HttpRuntime.WebObjectActivator
makes HttpApplication.InitModulesCommon
throw a NullReferenceException
.
I'm setting it in my Application_Start
and setting it back to null makes the error go away so its consistent.
The stacktrace is as follows
[NullReferenceException: Object reference not set to an instance of an object.]
System.Web.HttpApplication.InitModulesCommon() +166
System.Web.HttpApplication.InitInternal(HttpContext context, HttpApplicationState state, MethodInfo[] handlers) +792
System.Web.HttpApplicationFactory.GetNormalApplicationInstance(HttpContext context) +153
System.Web.HttpApplicationFactory.GetApplicationInstance(HttpContext context) +107
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +327
My best guess is that its this line which is failing https://referencesource.microsoft.com/#system.web/HttpApplication.cs,2337 due to all modules being resolved by the WebObjectActivator and therefor returning null if they arent registered as seen here https://referencesource.microsoft.com/#system.web/ModulesEntry.cs,62 and here https://referencesource.microsoft.com/#system.web/HttpRuntime.cs,3388
By is that really the case... ? Is it really the responsibility of the activator to instantiate objects which isn't registered as well?