aspnet / AspNetSessionState

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

InProc throws NRE in 2.0.0 #94

Open mellamokb opened 1 year ago

mellamokb commented 1 year ago

Just noticed the new version dropped, I get an NRE in the 2.0.0 version due to this line, while using InProcess mode.

var skipKA = config["skipKeepAliveWhenUnused"];

Because config is null in the case of InProc. Simple solution was to add null coalesce operator on the indexing.

eduardo-publi commented 1 year ago

To people that is just want to use performance Benefits from this Async Session State Module using InProc, while fix #98 doesn't come as a package version 2.0.0.1, you can just add InProc as a custom provider, so it will not throw a NRE

<sessionState mode="Custom" customProvider="FakeCustomInProc">
  <providers>
    <add name="FakeCustomInProc" skipKeepAliveWhenUnused="false" type="Microsoft.AspNet.SessionState.InProcSessionStateStoreAsync, Microsoft.AspNet.SessionState.SessionStateModule, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
  </providers>
</sessionState>
kim3er commented 11 months ago

Thank @eduardo-publi, great workaround. Hoping for a release with the hotfix in it though.