[release/8.0-staging] Handle NativeOverlapped* coming from both the Windows or Portable thread pool in NativeRuntimeEventSource #99656
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Backport of #97365 to release/8.0-staging
/cc @eduardo-vp
Customer Impact
When a customer's app uses the Windows thread pool and tries to fire ThreadPoolIOEnqueue, ThreadPoolIODequeue or ThreadPoolIOPack, it's likely to crash as these events currently expect a NativeOverlapped* from the Portable thread pool. The events are expected to handle either implementation of the thread pool. This change affects apps using the Windows thread pool (it's the default for Native AOT on Windows apps but other apps may enable its usage too).
Regression
Testing
The fix was verified with the following test #98432. It enables the Windows thread pool, provides the conditions to fire the events and makes some assertions to verify everything worked as expected. There were no tests using async read/write which could have showed evidence of the issue.
Risk
Low, the fix just affects apps which fire thread pool events using the Windows thread pool. The fix was locally tested several times and also a test was added to verify it works as expected.