Release and dispose the native handles when releasing RequestContext#134
Merged
Release and dispose the native handles when releasing RequestContext#134
Conversation
…easing RequestContext.
There was a problem hiding this comment.
Pull Request Overview
This PR improves the resource cleanup of the request context by properly releasing and disposing the native handle while also updating several tests to validate connection handling and ensure correct disposal of resources.
- Updated test attributes to limit cross-platform execution (Windows only)
- Added middleware to capture connection IDs and to track active connections
- Refactored disposal logic in production code (ResponseContext and RequestContext) to ensure native handles are released appropriately
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/YetAnotherHttpHandler.Test/YetAnotherHttpHandlerTest.cs | Adjusted test attributes for platform-specific execution |
| test/YetAnotherHttpHandler.Test/TestServerForHttp1AndHttp2.cs | Added middleware to inject a connection ID header |
| test/YetAnotherHttpHandler.Test/Http2TestBase.cs | Modified disposal of HTTP handler and client, added assertions for connection cleanup |
| test/YetAnotherHttpHandler.Test/Helpers/TestWebAppServer.cs | Introduced active connections tracking via middleware |
| src/YetAnotherHttpHandler/ResponseContext.cs | Ensured _tokenRegistration is disposed in all completion methods |
| src/YetAnotherHttpHandler/RequestContext.cs | Refactored native handle disposal in Release() and removed redundant code from Dispose() |
Comments suppressed due to low confidence (1)
test/YetAnotherHttpHandler.Test/YetAnotherHttpHandlerTest.cs:113
- [nitpick] Consider adding a brief comment explaining that the test now explicitly runs only on Windows to clarify the rationale behind the platform-specific condition.
[Fact] and [OSSkipCondition(OperatingSystems.MacOSX | OperatingSystems.Linux)]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.