Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot Access HttpContextAccessor inside hybridcache factory method #5648

Open
PouryaNoufallah96 opened this issue Nov 14, 2024 · 0 comments
Labels
area-caching-hybrid bug This issue describes a behavior which is not expected - a bug. untriaged

Comments

@PouryaNoufallah96
Copy link

Description

hello, i was trying the hybrid cache and noticed that when I'm inside the factory of the new hybridcache in GetOrCreateAsync and tried to access httpcontext but it was null.

this is when I'm inside the factory and try to access httpcontext to get user Identity or empty Guid and as you can see its empty
Image

and after I'm out of the cache in the same request I can access it and its filled:
Image

Reproduction Steps

injecting IHttpContextAccessor and then try to access it inside factory of GetOrCreateAsync

Expected behavior

i was expecting it to be filled current user identity

Actual behavior

and because httpcontextaccessor was null i get empty guid

Regression?

No response

Known Workarounds

No response

Configuration

No response

Other information

No response

@PouryaNoufallah96 PouryaNoufallah96 added bug This issue describes a behavior which is not expected - a bug. untriaged labels Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-caching-hybrid bug This issue describes a behavior which is not expected - a bug. untriaged
Projects
None yet
Development

No branches or pull requests

2 participants