Skip to content

Commit c405e23

Browse files
committed
[dotnet] wrap async executions inside task run
1 parent eca81ec commit c405e23

File tree

4 files changed

+5
-6
lines changed

4 files changed

+5
-6
lines changed

dotnet/src/webdriver/Navigator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public Navigator(WebDriver driver)
4242
/// </summary>
4343
public void Back()
4444
{
45-
BackAsync().GetAwaiter().GetResult();
45+
Task.Run(this.BackAsync).GetAwaiter().GetResult();
4646
}
4747

4848
/// <summary>

dotnet/src/webdriver/Remote/DriverServiceCommandExecutor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public HttpCommandExecutor HttpExecutor
9494
/// <returns>A response from the browser</returns>
9595
public Response Execute(Command commandToExecute)
9696
{
97-
return this.ExecuteAsync(commandToExecute).GetAwaiter().GetResult();
97+
return Task.Run(() => this.ExecuteAsync(commandToExecute)).GetAwaiter().GetResult();
9898
}
9999

100100
/// <summary>

dotnet/src/webdriver/Remote/HttpCommandExecutor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ public bool TryAddCommand(string commandName, CommandInfo info)
159159
/// <returns>A response from the browser</returns>
160160
public virtual Response Execute(Command commandToExecute)
161161
{
162-
return this.ExecuteAsync(commandToExecute).GetAwaiter().GetResult();
162+
return Task.Run(() => this.ExecuteAsync(commandToExecute)).GetAwaiter().GetResult();
163163
}
164164

165165
/// <summary>

dotnet/src/webdriver/WebDriver.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ internal ReadOnlyCollection<IWebElement> GetElementsFromResponse(Response respon
567567
/// <returns>WebDriver Response</returns>
568568
internal Response InternalExecute(string driverCommandToExecute, Dictionary<string, object> parameters)
569569
{
570-
return this.InternalExecuteAsync(driverCommandToExecute, parameters).GetAwaiter().GetResult();
570+
return Task.Run(() => this.InternalExecuteAsync(driverCommandToExecute, parameters)).GetAwaiter().GetResult();
571571
}
572572

573573
/// <summary>
@@ -585,10 +585,9 @@ internal Task<Response> InternalExecuteAsync(string driverCommandToExecute,
585585
internal Response Execute(string driverCommandToExecute,
586586
Dictionary<string, object> parameters)
587587
{
588-
return this.ExecuteAsync(driverCommandToExecute, parameters).GetAwaiter().GetResult();
588+
return Task.Run(() => this.ExecuteAsync(driverCommandToExecute, parameters)).GetAwaiter().GetResult();
589589
}
590590

591-
592591
/// <summary>
593592
/// Executes a command with this driver .
594593
/// </summary>

0 commit comments

Comments
 (0)