Skip to content

Commit e5e7462

Browse files
authored
Merge branch 'trunk' into remove_line_ending_manipulation
2 parents 8e5d6f4 + 97cf9a1 commit e5e7462

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+161
-415
lines changed

dotnet/src/support/UI/LoadableComponentException.cs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,5 @@ public LoadableComponentException(string message, Exception innerException)
5757
: base(message, innerException)
5858
{
5959
}
60-
61-
/// <summary>
62-
/// Initializes a new instance of the <see cref="LoadableComponentException"/> class with serialized data.
63-
/// </summary>
64-
/// <param name="info">The <see cref="SerializationInfo"/> that holds the serialized
65-
/// object data about the exception being thrown.</param>
66-
/// <param name="context">The <see cref="StreamingContext"/> that contains contextual
67-
/// information about the source or destination.</param>
68-
protected LoadableComponentException(SerializationInfo info, StreamingContext context)
69-
: base(info, context)
70-
{
71-
}
7260
}
7361
}

dotnet/src/support/UI/UnexpectedTagNameException.cs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -69,17 +69,5 @@ public UnexpectedTagNameException(string message, Exception innerException)
6969
: base(message, innerException)
7070
{
7171
}
72-
73-
/// <summary>
74-
/// Initializes a new instance of the <see cref="UnexpectedTagNameException"/> class with serialized data.
75-
/// </summary>
76-
/// <param name="info">The <see cref="SerializationInfo"/> that holds the serialized
77-
/// object data about the exception being thrown.</param>
78-
/// <param name="context">The <see cref="StreamingContext"/> that contains contextual
79-
/// information about the source or destination.</param>
80-
protected UnexpectedTagNameException(SerializationInfo info, StreamingContext context)
81-
: base(info, context)
82-
{
83-
}
8472
}
8573
}

dotnet/src/webdriver/DetachedShadowRootException.cs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,5 @@ public DetachedShadowRootException(string message, Exception innerException)
5757
: base(message, innerException)
5858
{
5959
}
60-
61-
/// <summary>
62-
/// Initializes a new instance of the <see cref="DetachedShadowRootException"/> class with serialized data.
63-
/// </summary>
64-
/// <param name="info">The <see cref="SerializationInfo"/> that holds the serialized
65-
/// object data about the exception being thrown.</param>
66-
/// <param name="context">The <see cref="StreamingContext"/> that contains contextual
67-
/// information about the source or destination.</param>
68-
protected DetachedShadowRootException(SerializationInfo info, StreamingContext context)
69-
: base(info, context)
70-
{
71-
}
7260
}
7361
}

dotnet/src/webdriver/DevTools/DevToolsSession.cs

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
// limitations under the License.
1717
// </copyright>
1818

19+
using OpenQA.Selenium.Internal.Logging;
1920
using System;
2021
using System.Collections.Concurrent;
2122
using System.Globalization;
@@ -56,6 +57,8 @@ public class DevToolsSession : IDevToolsSession
5657
private DevToolsDomains domains;
5758
private readonly DevToolsOptions options;
5859

60+
private readonly static ILogger logger = Internal.Logging.Log.GetLogger<DevToolsSession>();
61+
5962
/// <summary>
6063
/// Initializes a new instance of the DevToolsSession class, using the specified WebSocket endpoint.
6164
/// </summary>
@@ -272,6 +275,11 @@ public T GetVersionSpecificDomains<T>() where T : DevToolsSessionDomains
272275

273276
if (this.connection != null && this.connection.IsActive)
274277
{
278+
if (logger.IsEnabled(LogEventLevel.Trace))
279+
{
280+
logger.Trace($"CDP SND >> {message.CommandId} {message.CommandName}: {commandParameters.ToJsonString()}");
281+
}
282+
275283
LogTrace("Sending {0} {1}: {2}", message.CommandId, message.CommandName, commandParameters.ToString());
276284

277285
string contents = JsonSerializer.Serialize(message);
@@ -540,6 +548,11 @@ private void MonitorMessageQueue()
540548

541549
private void ProcessMessage(string message)
542550
{
551+
if (logger.IsEnabled(LogEventLevel.Trace))
552+
{
553+
logger.Trace($"CDP RCV << {message}");
554+
}
555+
543556
var messageObject = JsonObject.Parse(message).AsObject();
544557

545558
if (messageObject.TryGetPropertyValue("id", out var idProperty))
@@ -583,7 +596,22 @@ private void ProcessMessage(string message)
583596
// DevTools commands that may be sent in the body of the attached
584597
// event handler. If thread pool starvation seems to become a problem,
585598
// we can switch to a channel-based queue.
586-
Task.Run(() => OnDevToolsEventReceived(new DevToolsEventReceivedEventArgs(methodParts[0], methodParts[1], eventData)));
599+
Task.Run(() =>
600+
{
601+
try
602+
{
603+
OnDevToolsEventReceived(new DevToolsEventReceivedEventArgs(methodParts[0], methodParts[1], eventData));
604+
}
605+
catch (Exception ex)
606+
{
607+
if (logger.IsEnabled(LogEventLevel.Warn))
608+
{
609+
logger.Warn($"CDP VNT ^^ Unhandled error occured in event handler of '{method}' method. {ex}");
610+
}
611+
612+
throw;
613+
}
614+
});
587615

588616
return;
589617
}

dotnet/src/webdriver/DriverService.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
// limitations under the License.
1717
// </copyright>
1818

19-
using OpenQA.Selenium.Internal.Logging;
2019
using OpenQA.Selenium.Remote;
2120
using System;
2221
using System.Diagnostics;
@@ -42,7 +41,6 @@ public abstract class DriverService : ICommandServer
4241
private bool isDisposed;
4342
private Process driverServiceProcess;
4443
private TimeSpan initializationTimeout = TimeSpan.FromSeconds(20);
45-
private readonly static ILogger logger = Log.GetLogger<DriverService>();
4644

4745
/// <summary>
4846
/// Initializes a new instance of the <see cref="DriverService"/> class.
@@ -238,10 +236,7 @@ protected virtual bool IsInitialized
238236
}
239237
catch (Exception ex) when (ex is HttpRequestException || ex is TaskCanceledException)
240238
{
241-
if (logger.IsEnabled(LogEventLevel.Trace))
242-
{
243-
logger.Trace(ex.ToString());
244-
}
239+
// Do nothing. The exception is expected, meaning driver service is not initialized.
245240
}
246241

247242
return isInitialized;

dotnet/src/webdriver/DriverServiceNotFoundException.cs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,5 @@ public DriverServiceNotFoundException(string message, Exception innerException)
5757
: base(message, innerException)
5858
{
5959
}
60-
61-
/// <summary>
62-
/// Initializes a new instance of the <see cref="DriverServiceNotFoundException"/> class with serialized data.
63-
/// </summary>
64-
/// <param name="info">The <see cref="SerializationInfo"/> that holds the serialized
65-
/// object data about the exception being thrown.</param>
66-
/// <param name="context">The <see cref="StreamingContext"/> that contains contextual
67-
/// information about the source or destination.</param>
68-
protected DriverServiceNotFoundException(SerializationInfo info, StreamingContext context)
69-
: base(info, context)
70-
{
71-
}
7260
}
7361
}

dotnet/src/webdriver/ElementClickInterceptedException.cs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,5 @@ public ElementClickInterceptedException(string message, Exception innerException
5757
: base(message, innerException)
5858
{
5959
}
60-
61-
/// <summary>
62-
/// Initializes a new instance of the <see cref="ElementNotInteractableException"/> class with serialized data.
63-
/// </summary>
64-
/// <param name="info">The <see cref="SerializationInfo"/> that holds the serialized
65-
/// object data about the exception being thrown.</param>
66-
/// <param name="context">The <see cref="StreamingContext"/> that contains contextual
67-
/// information about the source or destination.</param>
68-
protected ElementClickInterceptedException(SerializationInfo info, StreamingContext context)
69-
: base(info, context)
70-
{
71-
}
7260
}
7361
}

dotnet/src/webdriver/ElementNotInteractableException.cs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,5 @@ public ElementNotInteractableException(string message, Exception innerException)
5757
: base(message, innerException)
5858
{
5959
}
60-
61-
/// <summary>
62-
/// Initializes a new instance of the <see cref="ElementNotInteractableException"/> class with serialized data.
63-
/// </summary>
64-
/// <param name="info">The <see cref="SerializationInfo"/> that holds the serialized
65-
/// object data about the exception being thrown.</param>
66-
/// <param name="context">The <see cref="StreamingContext"/> that contains contextual
67-
/// information about the source or destination.</param>
68-
protected ElementNotInteractableException(SerializationInfo info, StreamingContext context)
69-
: base(info, context)
70-
{
71-
}
7260
}
7361
}

dotnet/src/webdriver/ElementNotSelectableException.cs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,5 @@ public ElementNotSelectableException(string message, Exception innerException)
5757
: base(message, innerException)
5858
{
5959
}
60-
61-
/// <summary>
62-
/// Initializes a new instance of the <see cref="ElementNotInteractableException"/> class with serialized data.
63-
/// </summary>
64-
/// <param name="info">The <see cref="SerializationInfo"/> that holds the serialized
65-
/// object data about the exception being thrown.</param>
66-
/// <param name="context">The <see cref="StreamingContext"/> that contains contextual
67-
/// information about the source or destination.</param>
68-
protected ElementNotSelectableException(SerializationInfo info, StreamingContext context)
69-
: base(info, context)
70-
{
71-
}
7260
}
7361
}

dotnet/src/webdriver/ElementNotVisibleException.cs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,5 @@ public ElementNotVisibleException(string message, Exception innerException)
5757
: base(message, innerException)
5858
{
5959
}
60-
61-
/// <summary>
62-
/// Initializes a new instance of the <see cref="ElementNotVisibleException"/> class with serialized data.
63-
/// </summary>
64-
/// <param name="info">The <see cref="SerializationInfo"/> that holds the serialized
65-
/// object data about the exception being thrown.</param>
66-
/// <param name="context">The <see cref="StreamingContext"/> that contains contextual
67-
/// information about the source or destination.</param>
68-
protected ElementNotVisibleException(SerializationInfo info, StreamingContext context)
69-
: base(info, context)
70-
{
71-
}
7260
}
7361
}

0 commit comments

Comments
 (0)