-
-
Notifications
You must be signed in to change notification settings - Fork 10
refactor: Parameter validation in "async"/"await" methods should be wrapped #894
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors async methods to follow the best practice of wrapping parameter validation in a synchronous outer method with an inner async implementation. This pattern ensures that parameter validation (like null checks) happens immediately when the method is called, rather than being deferred until the async state machine starts executing.
Key Changes:
- Async methods are split into synchronous outer methods that perform parameter validation and asynchronous inner implementation methods
- Parameter validation exceptions are thrown synchronously before any async operations begin
- Inner async methods use abbreviated parameter names to avoid closure capture of outer parameters
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| ZipArchiveWrapper.cs | Refactored two ExtractToDirectoryAsync overloads to use the validation-wrapping pattern with local async functions |
| ZipArchiveEntryWrapper.cs | Refactored two ExtractToFileAsync overloads to use the validation-wrapping pattern with local async functions |
|
|
This is addressed in release v5.0.0. |



This PR refactors async methods to follow the best practice of wrapping parameter validation in a synchronous outer method with an inner async implementation. This pattern ensures that parameter validation (like null checks) happens immediately when the method is called, rather than being deferred until the async state machine starts executing.
Key Changes: