From afe0685f72513bba40078882d98848436a04fbef Mon Sep 17 00:00:00 2001 From: Nikolay Borisenko Date: Tue, 26 Sep 2023 00:05:40 +0300 Subject: [PATCH] Don't break devtools processing events thread in case of unexpected exception --- dotnet/src/webdriver/DevTools/DevToolsSession.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/dotnet/src/webdriver/DevTools/DevToolsSession.cs b/dotnet/src/webdriver/DevTools/DevToolsSession.cs index da03bd4860dfa..d42c9568219b8 100644 --- a/dotnet/src/webdriver/DevTools/DevToolsSession.cs +++ b/dotnet/src/webdriver/DevTools/DevToolsSession.cs @@ -455,7 +455,16 @@ private void MonitorMessageQueue() // in the IEnumerable, meaning the foreach loop will terminate gracefully. foreach (string message in this.messageQueue.GetConsumingEnumerable()) { - this.ProcessMessage(message); + // Don't breake entire thread in case of unsuccessful message, + // and give a chance for the next message in queue to be processed + try + { + this.ProcessMessage(message); + } + catch(Exception ex) + { + LogError("Unexpected error occured while processing message: {0}", ex); + } } }