You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Protect against claimsPrincipal being null (#7719)
## Summary of changes
We are getting `NullReferenceException` in `HttpContextSetUser`,
guessing the `claimsPrincipal` can be `null`.
## Reason for change
```
Error : Exception occurred when calling the CallTarget integration continuation.
System.NullReferenceException
at Datadog.Trace.ClrProfiler.AutoInstrumentation.AspNetCore.UserEvents.HttpContextSetUser.OnMethodBegin[TTarget](TTarget instance, ClaimsPrincipal& claimsPrincipal)
at Microsoft.AspNetCore.Http.DefaultHttpContext.set_User(ClaimsPrincipal value)
```
## Implementation details
Added `claimsPrincipal is not null`
## Test coverage
None 🤷
## Other details
<!-- Fixes #{issue} -->
<!-- ⚠️ Note:
Where possible, please obtain 2 approvals prior to merging. Unless
CODEOWNERS specifies otherwise, for external teams it is typically best
to have one review from a team member, and one review from apm-dotnet.
Trivial changes do not require 2 reviews.
MergeQueue is NOT enabled in this repository. If you have write access
to the repo, the PR has 1-2 approvals (see above), and all of the
required checks have passed, you can use the Squash and Merge button to
merge the PR. If you don't have write access, or you need help, reach
out in the #apm-dotnet channel in Slack.
-->
---------
Co-authored-by: Andrew Lock <andrew.lock@datadoghq.com>
0 commit comments