aspnet / AspNetSessionState

ASP.NET Session State (not for ASP.NET Core)
MIT License
55 stars 43 forks source link

Null Reference exception in InProc mode #101

Open faraazaamir opened 12 months ago

faraazaamir commented 12 months ago

When using SessionStateModuleAsync (2.0.0) in InProc mode, I get the following exception when the application is launched. With version 1.1.0 there is no error, but with version 2.0.0 the below exception is thrown. Please advise:

Object reference not set to an instance of an object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an object.] Microsoft.AspNet.SessionState.SessionStateStoreProviderAsyncBase.Initialize(String name, NameValueCollection config) +45 Microsoft.AspNet.SessionState.InProcSessionStateStoreAsync.Initialize(String name, NameValueCollection config) +48 Microsoft.AspNet.SessionState.SessionStateModuleAsync.InitModuleFromConfig(HttpApplication app, SessionStateSection config) +696 Microsoft.AspNet.SessionState.SessionStateModuleAsync.Init(HttpApplication app) +234 System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +586 System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172 System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +254 System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +346

[HttpException (0x80004005): Object reference not set to an instance of an object.] System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +552 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +122 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +737

sharadshahihw commented 11 months ago

I got the exception too. There's a pull request which fixes it. https://github.com/aspnet/AspNetSessionState/pull/98

This works https://github.com/aspnet/AspNetSessionState/issues/94

Dhugal commented 4 months ago

We're hitting this issue too - can the PR be merged and released, please?