[release/7.0] Unload MsQuic after checking for QUIC support to free resources. #74931
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 #74749 to release/7.0, closes #74629.
/cc @rzikm
Customer Impact
When using HttpClient, we also check whether the running platform supports QUIC (to enable HTTP3). However, the way we are checking QUIC support causes many threads to be allocated in the native MsQuic library (2* number of logical cores). This causes unnecessary resource increase even if the process does not end up using HTTP3 at all (HTTP3 is opt-in). This would therefore cause regression in memory usage when upgrading to .NET 7 in such cases.
Affected platforms include Windows 11, Windos Server 2022, many Linux platforms with msquic package installed.
Testing
Functional tests suite passes as part of the CI, resource consumption was checked manually.
Risk
Low, the fix consists of gracefully unloading MsQuic library from the process after checking QUIC support. The library is reloaded only when actually needed.