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 usage of ExecutionContext in netstandard2.0 #2951

Merged
merged 2 commits into from
Apr 28, 2023

Conversation

shyamnamboodiripad
Copy link
Contributor

@shyamnamboodiripad shyamnamboodiripad commented Apr 28, 2023

  • Always pass a copy of the captured ExecutionContext to the ExecutionContext.Run API. Without this, executing this code atop net472 results in the error mentioned in Trying to host ProxyKernel within a .NET Framework assembly results in an InvalidOperationException #2775. It seems like the .NET Framework version of this API requires that the same ExecutionContext instance should not be passed to ExecutionContext.Run more than once. See this note in the documentation under the The following is applicable to .NET Framework only section.

  • Also fixes a NullReferenceException that is encountered during the KernelScheduler's disposal if cancellation is triggered after the blocking collection is disposed. This exception is not encountered if we switch the order of execution to trigger cancellation before the blocking collection is disposed.

…text.Run API.

This is required to make the API work correctly when running against .NET Framework.
…perations BlockingCollection after _schedulerDisposalSource.Cancel() is called.

Also dispose _schedulerDisposalSource.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants