AspNetCore.CacheOutput icon indicating copy to clipboard operation
AspNetCore.CacheOutput copied to clipboard

Thread.CurrentPrincipal is null inside IsCachingAllowed

Open prayatna opened this issue 6 years ago • 2 comments

Hi,

I keep getting null reference exception as my CacheOutput attribute was not working on my .net core 3 app. Turns out the Thread.CurrentPrincipal is null on [.net core 3]https://github.com/dotnet/runtime/issues/29151)

Should we be using the workaround as tagged on the issue above? or change our Thread.CurrentPrincipal

prayatna avatar Feb 07 '20 08:02 prayatna

Hi @prayatna,

I've hotfixed this in a separate branch. Please let me know if it works for you.

Iamcerba avatar Feb 08 '20 07:02 Iamcerba

@Iamcerba Your hotfix null check solved the null reference exception issue however did not solve the underlying problem which is Thread.CurrentPrincipal was null for authorised users. I have a PR to fix it. https://github.com/Iamcerba/AspNetCore.CacheOutput/pull/13

praga avatar Oct 29 '20 01:10 praga