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

Fix for using passed PnPMonitoredScope in async method #666

Merged
merged 1 commit into from
Jun 8, 2022

Conversation

patrikhellgren
Copy link
Contributor

Q A
Bug fix? yes
New feature? no
New sample? no
Related issues?

What's in this Pull Request?

This PR fixes an issue which occurred when passing a PnPMonitoredScope as a parameter to an async method and then trying to use that passed scope to log messages. Since PnPMonitoredScope was using an internal ThreadStatic variable the async method could not access that variable if switching threads when doing some async work. Making the variable AsyncLocal instead should accomplish somewhat the same thing but making it usable with async work while still creating a new TopScope if used in different threads outside of the same async code flow.

@jansenbe jansenbe self-assigned this Jun 8, 2022
jansenbe added a commit that referenced this pull request Jun 8, 2022
@jansenbe jansenbe merged commit d863f19 into pnp:dev Jun 8, 2022
@patrikhellgren patrikhellgren deleted the fix-pnp-monitored-scope branch September 13, 2022 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants