Skip to content

[dotnet] Remove long awaited obsolete members #16121

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 2, 2025

Conversation

nvborisenko
Copy link
Member

@nvborisenko nvborisenko commented Aug 2, 2025

User description

Remove obsolete members, finally.

🔄 Types of changes

  • Cleanup (formatting, renaming)

PR Type

Other


Description

  • Remove obsolete methods and properties from .NET bindings

  • Clean up deprecated DevTools session constructors

  • Remove legacy property aliases and deprecated logging handlers


Diagram Walkthrough

flowchart LR
  A["Obsolete Members"] --> B["DevTools APIs"]
  A --> C["Driver Services"]
  A --> D["Options Classes"]
  A --> E["Logging Handlers"]
  B --> F["Removed deprecated constructors"]
  C --> G["Removed property aliases"]
  D --> H["Removed legacy properties"]
  E --> I["Removed ConsoleLogHandler"]
Loading

File Walkthrough

Relevant files
Cleanup
10 files
ChromiumDriver.cs
Remove obsolete DevTools session method                                   
+0/-13   
ChromiumDriverService.cs
Remove deprecated WhitelistedIPAddresses property               
+0/-11   
DevToolsSession.cs
Remove obsolete constructor overload                                         
+0/-7     
IDevTools.cs
Remove obsolete DevTools interface methods                             
+0/-20   
EdgeDriverService.cs
Remove deprecated UseVerboseLogging property                         
+0/-10   
FirefoxOptions.cs
Remove obsolete BrowserExecutableLocation property             
+0/-10   
ActionSequence.cs
Remove deprecated inputDevice property                                     
+0/-7     
ConsoleLogHandler.cs
Delete entire obsolete logging handler class                         
+0/-28   
RemoteWebDriver.cs
Remove obsolete DevTools session method                                   
+0/-13   
UserAgent.cs
Remove obsolete parameterless constructor                               
+0/-9     

@selenium-ci selenium-ci added the C-dotnet .NET Bindings label Aug 2, 2025
Copy link
Contributor

qodo-merge-pro bot commented Aug 2, 2025

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Missing Method

The interface removed the GetDevToolsSession(DevToolsOptions options) method but this method is still implemented in concrete classes like ChromiumDriver and RemoteWebDriver. This creates an interface-implementation mismatch that could cause compilation errors.

public interface IDevTools
{
    /// <summary>
    /// Gets a value indicating whether a DevTools session is active.
    /// </summary>
    bool HasActiveDevToolsSession { get; }

    /// <summary>
    /// 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>
    /// Closes a DevTools session
    /// </summary>
    [RequiresUnreferencedCode(DevToolsSession.CDP_AOTIncompatibilityMessage)]

Copy link
Contributor

qodo-merge-pro bot commented Aug 2, 2025

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Add missing interface method declaration

The interface is missing the GetDevToolsSession(DevToolsOptions options) method
that was removed from the documentation but is still being used in the
implementation classes. This creates an interface-implementation mismatch that
will cause compilation errors.

dotnet/src/webdriver/DevTools/IDevTools.cs [35-41]

 /// <summary>
 /// 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>
+/// Creates a session to communicate with a browser using a specific version of the Developer Tools debugging protocol.
+/// </summary>
+/// <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);
+

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 10

__

Why: The PR incorrectly removes the non-obsolete GetDevToolsSession(DevToolsOptions options) method from the IDevTools interface, which is a critical breaking change for consumers of this interface.

High
  • Update

@nvborisenko nvborisenko requested a review from Copilot August 2, 2025 22:00
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR removes long-awaited obsolete members from the .NET Selenium bindings as part of a cleanup effort. The changes focus on removing deprecated constructors, properties, and methods that have been marked as obsolete across various components.

  • Remove obsolete DevTools session methods and constructors that used integer protocol versions
  • Remove deprecated property aliases like WhitelistedIPAddresses and BrowserExecutableLocation
  • Delete the entire obsolete ConsoleLogHandler class

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.

Show a summary per file
File Description
ChromiumDriver.cs Remove obsolete DevTools session method with integer protocol version
ChromiumDriverService.cs Remove deprecated WhitelistedIPAddresses property alias
DevToolsSession.cs Remove obsolete constructor overload without options parameter
IDevTools.cs Remove obsolete DevTools interface method with integer protocol version
EdgeDriverService.cs Remove deprecated UseVerboseLogging property alias
FirefoxOptions.cs Remove obsolete BrowserExecutableLocation property alias
ActionSequence.cs Remove deprecated inputDevice property with lowercase naming
ConsoleLogHandler.cs Delete entire obsolete logging handler class
RemoteWebDriver.cs Remove obsolete DevTools session method with integer protocol version
UserAgent.cs Remove obsolete parameterless constructor

@nvborisenko
Copy link
Member Author

Well done.

@nvborisenko nvborisenko merged commit b981b71 into SeleniumHQ:trunk Aug 2, 2025
11 of 12 checks passed
@nvborisenko nvborisenko deleted the dotnet-remove-obsolete branch August 2, 2025 22:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants