Skip to content

[dotnet] Hide unnecessary chromium public fields#17113

Open
nvborisenko wants to merge 1 commit intoSeleniumHQ:trunkfrom
nvborisenko:dotnet-chromium-static-fields
Open

[dotnet] Hide unnecessary chromium public fields#17113
nvborisenko wants to merge 1 commit intoSeleniumHQ:trunkfrom
nvborisenko:dotnet-chromium-static-fields

Conversation

@nvborisenko
Copy link
Member

This pull request makes a small but important change to the ChromiumDriver class by changing the visibility of several static fields from public to protected. This limits their accessibility to the class itself and its subclasses, rather than exposing them publicly.

  • Changed the visibility of the following static fields from public to protected in ChromiumDriver.cs:
    • AcceptUntrustedCertificates
    • ExecuteCdp
    • GetCastSinksCommand
    • SelectCastSinkCommand
    • StartCastTabMirroringCommand
    • StartCastDesktopMirroringCommand
    • GetCastIssueMessageCommand
    • StopCastingCommand
    • GetNetworkConditionsCommand
    • SetNetworkConditionsCommand
    • DeleteNetworkConditionsCommand
    • SendChromeCommand
    • SendChromeCommandWithResult
    • LaunchAppCommand
    • SetPermissionCommand

💡 Additional Considerations

Hopefully nobody even knows it exists. So just "remove".

🔄 Types of changes

  • Cleanup (formatting, renaming)
  • Breaking change (fix or feature that would cause existing functionality to change)

Copilot AI review requested due to automatic review settings February 18, 2026 22:10
@qodo-code-review
Copy link
Contributor

PR Type

Enhancement


Description

  • Reduce public API surface by hiding internal Chromium fields

  • Change 15 static fields from public to protected visibility

  • Prevent external code from depending on internal implementation details


File Walkthrough

Relevant files
Enhancement
ChromiumDriver.cs
Reduce public API surface for Chromium driver                       

dotnet/src/webdriver/Chromium/ChromiumDriver.cs

  • Changed visibility of 15 static readonly fields from public to
    protected
  • Fields include command constants and configuration flags used
    internally
  • Maintains functionality while reducing public API surface
  • Affects: AcceptUntrustedCertificates, ExecuteCdp, GetCastSinksCommand,
    SelectCastSinkCommand, StartCastTabMirroringCommand,
    StartCastDesktopMirroringCommand, GetCastIssueMessageCommand,
    StopCastingCommand, GetNetworkConditionsCommand,
    SetNetworkConditionsCommand, DeleteNetworkConditionsCommand,
    SendChromeCommand, SendChromeCommandWithResult, LaunchAppCommand,
    SetPermissionCommand
+15/-15 

@qodo-code-review
Copy link
Contributor

PR Compliance Guide 🔍

Below is a summary of compliance checks for this PR:

Security Compliance
🟢
No security concerns identified No security vulnerabilities detected by AI analysis. Human verification advised for critical code.
Ticket Compliance
🎫 No ticket provided
  • Create ticket/issue
Codebase Duplication Compliance
Codebase context is not defined

Follow the guide to enable codebase context checks.

Custom Compliance
No custom compliance provided

Follow the guide to enable custom compliance check.

Compliance status legend 🟢 - Fully Compliant
🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label

@qodo-code-review
Copy link
Contributor

PR Code Suggestions ✨

No code suggestions found for the PR.

Copy link
Contributor

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 reduces the public API surface of the .NET ChromiumDriver by changing several command-name/static fields from public to protected, limiting access to subclasses (e.g., ChromeDriver, EdgeDriver) rather than all consumers.

Changes:

  • Changed multiple ChromiumDriver static fields (command names and AcceptUntrustedCertificates) from public to protected.

Comment on lines +35 to +40
protected static readonly bool AcceptUntrustedCertificates = true;

/// <summary>
/// Command for executing a Chrome DevTools Protocol command in a driver for a Chromium-based browser.
/// </summary>
public static readonly string ExecuteCdp = "executeCdpCommand";
protected static readonly string ExecuteCdp = "executeCdpCommand";
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

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

Changing these members from public to protected is a breaking source and binary API change (existing compiled consumers can start throwing MissingFieldException). Repo guidance calls out maintaining API/ABI compatibility and using a deprecation cycle before removing public functionality (see AGENTS.md:12 and AGENTS.md:65-67; dotnet/AGENTS.md:26-30). Consider keeping the public fields for now but marking them [Obsolete] (and optionally [EditorBrowsable(EditorBrowsableState.Never)]) so they’re hidden from IntelliSense, then remove in a later release.

Copilot uses AI. Check for mistakes.
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.

3 participants