Skip to content

Commit d38ce70

Browse files
authored
[dotnet] Avoid potential deadlock when starting new dev tools session (#12592)
Avoid potential deadlock when starting new dev tools session
1 parent 1c036ab commit d38ce70

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

dotnet/src/webdriver/Chromium/ChromiumDriver.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
using System.Collections.Generic;
2121
using System.Collections.ObjectModel;
2222
using System.IO;
23+
using System.Threading.Tasks;
2324
using OpenQA.Selenium.DevTools;
2425
using OpenQA.Selenium.Remote;
2526

@@ -303,7 +304,7 @@ public DevToolsSession GetDevToolsSession(int devToolsProtocolVersion)
303304
try
304305
{
305306
DevToolsSession session = new DevToolsSession(debuggerAddress);
306-
session.StartSession(devToolsProtocolVersion).ConfigureAwait(false).GetAwaiter().GetResult();
307+
Task.Run(async () => await session.StartSession(devToolsProtocolVersion)).GetAwaiter().GetResult();
307308
this.devToolsSession = session;
308309
}
309310
catch (Exception e)

dotnet/src/webdriver/Firefox/FirefoxDriver.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
using System.Globalization;
2323
using System.IO;
2424
using System.IO.Compression;
25+
using System.Threading.Tasks;
2526
using OpenQA.Selenium.DevTools;
2627
using OpenQA.Selenium.Remote;
2728

@@ -395,7 +396,7 @@ public DevToolsSession GetDevToolsSession(int devToolsProtocolVersion)
395396
try
396397
{
397398
DevToolsSession session = new DevToolsSession(debuggerAddress);
398-
session.StartSession(devToolsProtocolVersion).ConfigureAwait(false).GetAwaiter().GetResult();
399+
Task.Run(async () => await session.StartSession(devToolsProtocolVersion)).GetAwaiter().GetResult();
399400
this.devToolsSession = session;
400401
}
401402
catch (Exception e)

dotnet/src/webdriver/Remote/RemoteWebDriver.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
using System;
2020
using System.Collections.Generic;
2121
using System.Collections.ObjectModel;
22+
using System.Threading.Tasks;
2223
using OpenQA.Selenium.DevTools;
2324
using OpenQA.Selenium.Internal;
2425

@@ -455,7 +456,7 @@ public DevToolsSession GetDevToolsSession(int protocolVersion)
455456
try
456457
{
457458
DevToolsSession session = new DevToolsSession(debuggerAddress);
458-
session.StartSession(devToolsProtocolVersion).ConfigureAwait(false).GetAwaiter().GetResult();
459+
Task.Run(async () => await session.StartSession(devToolsProtocolVersion)).GetAwaiter().GetResult();
459460
this.devToolsSession = session;
460461
}
461462
catch (Exception e)

0 commit comments

Comments
 (0)