Describe the bug
Compare the behaviour of the following between .NET Framework and .NET Core's AddWrappedAspNetCoreSession:
- create a class with some simple value properties
- via
System.Web.HttpContext.Current.Session either
- set a new instance of that class into session
- pull an existing instance of that class out of session
- update a property on the instance; do not explicitly write the instance back to
System.Web.HttpContext.Current.Session
- read the property in a subsequent call
In .NET Framework, the updated value is automatically persisted into session at the end of the first call.
In .NET Core via AddWrappedAspNetCoreSession, the updated value does not appear to be persisted into session at the end of the call unless you manually push the instance back into System.Web.HttpContext.Current.Session.
AspNetCoreSessionState does not seem to track what values have been added or retrieved and re-push them to the underlying _session in CommitAsync.
Further, if you retrieve the same value from session twice in one call, in Framework you get the same object, but in Core you get different objects. AspNetCoreSessionState does not seem to track what values have been pulled from the underlying _session and return the same instances.
To Reproduce
Similar Web API code running in Core and Framework.
Run via the caller:
Further technical details
Please include the following if applicable:
ASP.NET Framework Application:
- Technologies and versions used (i.e. MVC/WebForms/etc): WebApi. In-proc session provider. (Observed with SQL session provider too, but not tried with this repro.)
- .NET Framework Version: 4.8
- IIS Version: Express
- Windows Version: 10
ASP.NET Core Application:
- Targeted .NET version: 8 (observed in 10 too, but not tried with this repro)
- .NET SDK version:

Describe the bug
Compare the behaviour of the following between .NET Framework and .NET Core's
AddWrappedAspNetCoreSession:System.Web.HttpContext.Current.SessioneitherSystem.Web.HttpContext.Current.SessionIn .NET Framework, the updated value is automatically persisted into session at the end of the first call.
In .NET Core via
AddWrappedAspNetCoreSession, the updated value does not appear to be persisted into session at the end of the call unless you manually push the instance back intoSystem.Web.HttpContext.Current.Session.AspNetCoreSessionStatedoes not seem to track what values have been added or retrieved and re-push them to the underlying_sessioninCommitAsync.Further, if you retrieve the same value from session twice in one call, in Framework you get the same object, but in Core you get different objects.
AspNetCoreSessionStatedoes not seem to track what values have been pulled from the underlying_sessionand return the same instances.To Reproduce
Similar Web API code running in Core and Framework.
Run via the caller:
Further technical details
Please include the following if applicable:
ASP.NET Framework Application:
ASP.NET Core Application: