You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The method name 'SetFiles' is missing the 'Async' suffix, while it returns a Task. This is inconsistent with other async methods in the class like 'ReleaseActionsAsync'.
There's no validation for the file paths provided in the 'Files' parameter. The implementation should check if the files exist and are accessible before sending the command.
✅ Add Async suffixSuggestion Impact:The commit directly implemented the suggestion by renaming the SetFiles method to SetFilesAsync, following the C# naming convention for async methods
Why: The suggestion correctly identifies an inconsistency in method naming conventions. Methods that return Task should have the "Async" suffix according to C# conventions, especially since the method it calls (SetFilesAsync) follows this pattern. This improves code consistency and readability.
Medium
Learned best practice
Add null parameter validation to prevent potential NullReferenceExceptions when handling required method parameters
The SetFilesAsync method should validate that the element and files parameters are not null before using them. Add null checks using ArgumentNullException.ThrowIfNull() at the beginning of the method to ensure proper error handling and prevent potential NullReferenceExceptions.
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
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.
User description
https://w3c.github.io/webdriver-bidi/#command-input-setFiles
Motivation and Context
Contributes to BiDi implementation.
Types of changes
Checklist
PR Type
Enhancement
Description
Added
SetFilescommand to the BiDi Input module.Implemented
SetFilesCommandand its parameters for file upload.Extended
BrowsingContextInputModuleandInputModulewithSetFilesfunctionality.Introduced
SetFilesOptionsfor additional command configuration.Changes walkthrough 📝
BrowsingContextInputModule.cs
Add `SetFiles` method to `BrowsingContextInputModule`dotnet/src/webdriver/BiDi/Modules/BrowsingContext/BrowsingContextInputModule.cs
SetFilesmethod toBrowsingContextInputModule.SetFileswith theinputModule.InputModule.cs
Add `SetFilesAsync` method to `InputModule`dotnet/src/webdriver/BiDi/Modules/Input/InputModule.cs
SetFilesAsyncmethod toInputModule.SetFiles.SetFilesCommand.cs
Implement `SetFilesCommand` and parametersdotnet/src/webdriver/BiDi/Modules/Input/SetFilesCommand.cs
SetFilesCommandclass forinput.setFiles.SetFilesCommandParametersfor command parameters.SetFilesOptionsfor optional configurations.