Skip to content

Commit

Permalink
[dotnet] Avoid potential deadlock when starting new dev tools session (
Browse files Browse the repository at this point in the history
…#12592)

Avoid potential deadlock when starting new dev tools session
  • Loading branch information
nvborisenko authored Aug 30, 2023
1 parent 1c036ab commit d38ce70
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion dotnet/src/webdriver/Chromium/ChromiumDriver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Threading.Tasks;
using OpenQA.Selenium.DevTools;
using OpenQA.Selenium.Remote;

Expand Down Expand Up @@ -303,7 +304,7 @@ public DevToolsSession GetDevToolsSession(int devToolsProtocolVersion)
try
{
DevToolsSession session = new DevToolsSession(debuggerAddress);
session.StartSession(devToolsProtocolVersion).ConfigureAwait(false).GetAwaiter().GetResult();
Task.Run(async () => await session.StartSession(devToolsProtocolVersion)).GetAwaiter().GetResult();
this.devToolsSession = session;
}
catch (Exception e)
Expand Down
3 changes: 2 additions & 1 deletion dotnet/src/webdriver/Firefox/FirefoxDriver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
using System.Globalization;
using System.IO;
using System.IO.Compression;
using System.Threading.Tasks;
using OpenQA.Selenium.DevTools;
using OpenQA.Selenium.Remote;

Expand Down Expand Up @@ -395,7 +396,7 @@ public DevToolsSession GetDevToolsSession(int devToolsProtocolVersion)
try
{
DevToolsSession session = new DevToolsSession(debuggerAddress);
session.StartSession(devToolsProtocolVersion).ConfigureAwait(false).GetAwaiter().GetResult();
Task.Run(async () => await session.StartSession(devToolsProtocolVersion)).GetAwaiter().GetResult();
this.devToolsSession = session;
}
catch (Exception e)
Expand Down
3 changes: 2 additions & 1 deletion dotnet/src/webdriver/Remote/RemoteWebDriver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Threading.Tasks;
using OpenQA.Selenium.DevTools;
using OpenQA.Selenium.Internal;

Expand Down Expand Up @@ -455,7 +456,7 @@ public DevToolsSession GetDevToolsSession(int protocolVersion)
try
{
DevToolsSession session = new DevToolsSession(debuggerAddress);
session.StartSession(devToolsProtocolVersion).ConfigureAwait(false).GetAwaiter().GetResult();
Task.Run(async () => await session.StartSession(devToolsProtocolVersion)).GetAwaiter().GetResult();
this.devToolsSession = session;
}
catch (Exception e)
Expand Down

0 comments on commit d38ce70

Please sign in to comment.