-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Description
There is a potential issue regarding the section:
Load session state asynchronously
Naturally, whoever is implementing such a work-around to asynchronously load the cache prior to any use (get, set) may decide to use the ISession.IsAvailable property to check if the session had been loaded and only when this property is false to perform the async LoadAsync. However, it turns out that the current MS implementation of DistributedSession (which is the one used when you do the AddSession startup call) has an issue with that - see:
The IsAvailable property is performing unconditional call to the synchronous version of Load. That means, any code that tries to conditionally load the session data asynchronously will basically complete synchronously.
Please, add an underlined comment on the article that the LoadAsync should be called explicitly, without relying on the IsAvailable property, which actually would otherwise break the async implementation intent.
Best Regards
Marin
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
- ID: 76e22150-f1f1-5e4f-0e97-39b1ac089297
- Version Independent ID: 687172c3-b7d8-525d-39dc-658b4a0f526f
- Content: Session in ASP.NET Core
- Content Source: aspnetcore/fundamentals/app-state.md
- Product: aspnet-core
- Technology: aspnetcore-fundamentals
- GitHub Login: @Rick-Anderson
- Microsoft Alias: riande