Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
923f23f
[dotnet] Add trimming attributes, address some trim warnings
RenderMichael Oct 23, 2024
1b6adc1
Merge branch 'trunk' into trim-improvement
RenderMichael Oct 23, 2024
84714f3
Make DomainType struct readonly
RenderMichael Oct 23, 2024
5c2430a
Merge branch 'trim-improvement' of https://github.com/RenderMichael/s…
RenderMichael Oct 23, 2024
ec91f98
Merge branch 'trunk' into trim-improvement
RenderMichael Oct 28, 2024
b19ca4d
merge develop
RenderMichael Nov 17, 2024
59baae4
center preprocessor directives on .net 8+
RenderMichael Nov 17, 2024
b4564f9
Add file header to `TrimmingAttributes.cs`
RenderMichael Nov 17, 2024
a5c2e09
Tweak #if location
RenderMichael Nov 17, 2024
53e3d08
Merge branch 'trunk' into trim-improvement
RenderMichael Nov 17, 2024
26e327f
Hide `Assembly.CodeBase` from .NET 8 compilation
RenderMichael Nov 18, 2024
225a030
Remove changes from `DevToolsDomains`
RenderMichael Dec 8, 2024
1440e22
remove remaining changes from `DevToolsDomains`
RenderMichael Dec 8, 2024
310bdf8
Merge branch 'trunk' into trim-improvement
RenderMichael Dec 8, 2024
61a7f01
Merge branch 'trunk' into trim-improvement
RenderMichael Jan 25, 2025
6a6cd74
Merge branch 'trunk' into trim-improvement
RenderMichael Jan 31, 2025
ba85340
merge main
RenderMichael Jan 31, 2025
f1fce52
Annotate CDP as AOT-unsafe
RenderMichael Jan 31, 2025
1092962
Annotate CDP as fully AOT-unsafe
RenderMichael Jan 31, 2025
1a03caa
merge trunk
RenderMichael Feb 27, 2025
70489a6
merge trunk
RenderMichael Feb 28, 2025
68339cd
Improve AOT incompatibility message
RenderMichael Feb 28, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions dotnet/src/webdriver/Chromium/ChromiumDriver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,8 @@ public void SetPermission(string permissionName, string permissionValue)
/// Creates a session to communicate with a browser using the Chromium Developer Tools debugging protocol.
/// </summary>
/// <returns>The active session to use to communicate with the Chromium Developer Tools debugging protocol.</returns>
[RequiresUnreferencedCode(DevToolsSession.CDP_AOTIncompatibilityMessage)]
[RequiresDynamicCode(DevToolsSession.CDP_AOTIncompatibilityMessage)]
public DevToolsSession GetDevToolsSession()
{
return GetDevToolsSession(new DevToolsOptions() { ProtocolVersion = DevToolsSession.AutoDetectDevToolsProtocolVersion });
Expand All @@ -308,6 +310,8 @@ public DevToolsSession GetDevToolsSession()
/// Creates a session to communicate with a browser using the Chromium Developer Tools debugging protocol.
/// </summary>
/// <returns>The active session to use to communicate with the Chromium Developer Tools debugging protocol.</returns>
[RequiresUnreferencedCode(DevToolsSession.CDP_AOTIncompatibilityMessage)]
[RequiresDynamicCode(DevToolsSession.CDP_AOTIncompatibilityMessage)]
public DevToolsSession GetDevToolsSession(DevToolsOptions options)
{
if (this.devToolsSession == null)
Expand Down Expand Up @@ -349,6 +353,8 @@ public DevToolsSession GetDevToolsSession(DevToolsOptions options)
/// <param name="devToolsProtocolVersion">The version of the Chromium Developer Tools protocol to use. Defaults to autodetect the protocol version.</param>
/// <returns>The active session to use to communicate with the Chromium Developer Tools debugging protocol.</returns>
[Obsolete("Use GetDevToolsSession(DevToolsOptions options)")]
[RequiresUnreferencedCode(DevToolsSession.CDP_AOTIncompatibilityMessage)]
[RequiresDynamicCode(DevToolsSession.CDP_AOTIncompatibilityMessage)]
public DevToolsSession GetDevToolsSession(int devToolsProtocolVersion)
{
return GetDevToolsSession(new DevToolsOptions() { ProtocolVersion = devToolsProtocolVersion });
Expand Down
5 changes: 5 additions & 0 deletions dotnet/src/webdriver/DevTools/DevToolsSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
using OpenQA.Selenium.Internal.Logging;
using System;
using System.Collections.Concurrent;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Net.Http;
using System.Text.Json;
Expand All @@ -35,8 +36,12 @@ namespace OpenQA.Selenium.DevTools
/// Represents a WebSocket connection to a running DevTools instance that can be used to send
/// commands and receive events.
///</summary>
[RequiresUnreferencedCode(CDP_AOTIncompatibilityMessage)]
[RequiresDynamicCode(CDP_AOTIncompatibilityMessage)]
public class DevToolsSession : IDevToolsSession
{
internal const string CDP_AOTIncompatibilityMessage = "CDP is not compatible with trimming or AOT.";

/// <summary>
/// A value indicating that the version of the DevTools protocol in use
/// by the browser should be automatically detected.
Expand Down
9 changes: 9 additions & 0 deletions dotnet/src/webdriver/DevTools/IDevTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
// </copyright>

using System;
using System.Diagnostics.CodeAnalysis;

#nullable enable

Expand All @@ -37,6 +38,8 @@ public interface IDevTools
/// Creates a session to communicate with a browser using a Developer Tools debugging protocol.
/// </summary>
/// <returns>The active session to use to communicate with the Developer Tools debugging protocol.</returns>
[RequiresUnreferencedCode(DevToolsSession.CDP_AOTIncompatibilityMessage)]
[RequiresDynamicCode(DevToolsSession.CDP_AOTIncompatibilityMessage)]
DevToolsSession GetDevToolsSession();

/// <summary>
Expand All @@ -45,6 +48,8 @@ public interface IDevTools
/// <param name="options">The options for the DevToolsSession to use.</param>
/// <returns>The active session to use to communicate with the Developer Tools debugging protocol.</returns>
/// <exception cref="ArgumentNullException">If <paramref name="options"/> is <see langword="null"/>.</exception>
[RequiresUnreferencedCode(DevToolsSession.CDP_AOTIncompatibilityMessage)]
[RequiresDynamicCode(DevToolsSession.CDP_AOTIncompatibilityMessage)]
DevToolsSession GetDevToolsSession(DevToolsOptions options);

/// <summary>
Expand All @@ -53,11 +58,15 @@ public interface IDevTools
/// <param name="protocolVersion">The specific version of the Developer Tools debugging protocol to use.</param>
/// <returns>The active session to use to communicate with the Developer Tools debugging protocol.</returns>
[Obsolete("Use GetDevToolsSession(DevToolsOptions options)")]
[RequiresUnreferencedCode(DevToolsSession.CDP_AOTIncompatibilityMessage)]
[RequiresDynamicCode(DevToolsSession.CDP_AOTIncompatibilityMessage)]
DevToolsSession GetDevToolsSession(int protocolVersion);

/// <summary>
/// Closes a DevTools session
/// </summary>
[RequiresUnreferencedCode(DevToolsSession.CDP_AOTIncompatibilityMessage)]
[RequiresDynamicCode(DevToolsSession.CDP_AOTIncompatibilityMessage)]
void CloseDevToolsSession();
}
}
7 changes: 7 additions & 0 deletions dotnet/src/webdriver/DevTools/IDevToolsSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
// </copyright>

using System;
using System.Diagnostics.CodeAnalysis;
using System.Text.Json;
using System.Text.Json.Nodes;
using System.Threading;
Expand Down Expand Up @@ -63,6 +64,8 @@ public interface IDevToolsSession : IDisposable
/// <param name="throwExceptionIfResponseNotReceived"><see langword="true"/> to throw an exception if a response is not received; otherwise, <see langword="false"/>.</param>
/// <returns>The command response object implementing the <see cref="ICommandResponse{T}"/> interface.</returns>
/// <exception cref="ArgumentNullException">If <paramref name="command"/> is <see langword="null"/>.</exception>
[RequiresUnreferencedCode(DevToolsSession.CDP_AOTIncompatibilityMessage)]
[RequiresDynamicCode(DevToolsSession.CDP_AOTIncompatibilityMessage)]
Task<ICommandResponse<TCommand>?> SendCommand<TCommand>(TCommand command, CancellationToken cancellationToken, int? millisecondsTimeout, bool throwExceptionIfResponseNotReceived)
where TCommand : ICommand;

Expand All @@ -77,6 +80,8 @@ public interface IDevToolsSession : IDisposable
/// <param name="throwExceptionIfResponseNotReceived"><see langword="true"/> to throw an exception if a response is not received; otherwise, <see langword="false"/>.</param>
/// <returns>The command response object implementing the <see cref="ICommandResponse{T}"/> interface.</returns>
/// <exception cref="ArgumentNullException">If <paramref name="command"/> is <see langword="null"/>.</exception>
[RequiresUnreferencedCode(DevToolsSession.CDP_AOTIncompatibilityMessage)]
[RequiresDynamicCode(DevToolsSession.CDP_AOTIncompatibilityMessage)]
Task<TCommandResponse?> SendCommand<TCommand, TCommandResponse>(TCommand command, CancellationToken cancellationToken, int? millisecondsTimeout, bool throwExceptionIfResponseNotReceived)
where TCommand : ICommand
where TCommandResponse : ICommandResponse<TCommand>;
Expand All @@ -91,6 +96,8 @@ public interface IDevToolsSession : IDisposable
/// <param name="throwExceptionIfResponseNotReceived"><see langword="true"/> to throw an exception if a response is not received; otherwise, <see langword="false"/>.</param>
/// <returns>The command response object implementing the <see cref="ICommandResponse{T}"/> interface.</returns>
/// <exception cref="ArgumentNullException">If <paramref name="commandName"/> is <see langword="null"/>.</exception>
[RequiresUnreferencedCode(DevToolsSession.CDP_AOTIncompatibilityMessage)]
[RequiresDynamicCode(DevToolsSession.CDP_AOTIncompatibilityMessage)]
Task<JsonElement?> SendCommand(string commandName, JsonNode @params, CancellationToken cancellationToken, int? millisecondsTimeout, bool throwExceptionIfResponseNotReceived);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Runtime.Serialization;
using System.Text.Json;
Expand All @@ -28,7 +29,7 @@

namespace OpenQA.Selenium.DevTools.Json
{
internal sealed class JsonEnumMemberConverter<TEnum> : JsonConverter<TEnum>
internal sealed class JsonEnumMemberConverter<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields)] TEnum> : JsonConverter<TEnum>
where TEnum : struct, Enum
{
private readonly Dictionary<TEnum, string> _enumToString = new Dictionary<TEnum, string>();
Expand Down
5 changes: 5 additions & 0 deletions dotnet/src/webdriver/INetwork.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
// </copyright>

using System;
using System.Diagnostics.CodeAnalysis;
using System.Threading.Tasks;

#nullable enable
Expand Down Expand Up @@ -79,12 +80,16 @@ public interface INetwork
/// Asynchronously starts monitoring for network traffic.
/// </summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[RequiresUnreferencedCode("Network monitoring is currently implemented with CDP. When it is implemented with BiDi, AOT will be supported")]
[RequiresDynamicCode("Network monitoring is currently implemented with CDP. When it is implemented with BiDi, AOT will be supported.")]
Task StartMonitoring();

/// <summary>
/// Asynchronously stops monitoring for network traffic.
/// </summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[RequiresUnreferencedCode("Network monitoring is currently implemented with CDP. When it is implemented with BiDi, AOT will be supported")]
[RequiresDynamicCode("Network monitoring is currently implemented with CDP. When it is implemented with BiDi, AOT will be supported.")]
Task StopMonitoring();
}
}
Loading
Loading