[dotnet] [bidi] Fix commands cancelling callback#17315
[dotnet] [bidi] Fix commands cancelling callback#17315nvborisenko merged 2 commits intoSeleniumHQ:trunkfrom
Conversation
Review Summary by QodoFix BiDi command cancellation by moving return before finally block
WalkthroughsDescription• Move return statement inside try block before finally cleanup • Ensures awaited task result returned before buffer resources released • Prevents command cancellation timeout callback disposal race condition File Changes1. dotnet/src/webdriver/BiDi/Broker.cs
|
Code Review by Qodo
|
There was a problem hiding this comment.
Pull request overview
This PR fixes BiDi command timeout/cancellation behavior in the .NET WebDriver by adjusting control flow in Broker.ExecuteCommandAsync so that cancellation registrations remain active while awaiting the command result.
Changes:
- Move the
await tcs.Taskreturn into thetryblock so the method awaits the command completion before leaving the scope that contains the cancellation registration.
Disposing
ctsRegistrationtoo early, preventing command cannot be cancelled via timeout.💥 What does this PR do?
This pull request makes a minor change to the
ExecuteCommandAsyncmethod inBroker.cs, moving the return statement inside thetryblock to ensure the awaited task result is returned before buffer cleanup in thefinallyblock. This change helps prevent returning a result after resources may have been released.🔄 Types of changes