Skip to content

Conversation

@nvborisenko
Copy link
Member

@nvborisenko nvborisenko commented Nov 30, 2025

User description

Collecting internal helpers for compiler services in one place.

🔄 Types of changes

  • Cleanup (formatting, renaming)

PR Type

Enhancement


Description

  • Move internal compiler services to Properties folder

  • Add pragma directives to suppress IDE0130 namespace warnings

  • Update namespace for StringSyntaxConstants from Internal to Properties

  • Update build configuration and project references


Diagram Walkthrough

flowchart LR
  A["Internal Folder<br/>Compiler Services"] -->|"Move & Reorganize"| B["Properties Folder<br/>Compiler Services"]
  B -->|"Add Pragma<br/>Directives"| C["IDE0130 Warnings<br/>Suppressed"]
  D["Build Config<br/>References"] -->|"Update Paths"| E["Properties Folder<br/>References"]
Loading

File Walkthrough

Relevant files
Enhancement
IsExternalInit.cs
Add pragma directives and conditional compilation               

dotnet/src/webdriver/Properties/IsExternalInit.cs

  • Added conditional compilation directive #if !NET8_0_OR_GREATER
  • Added pragma directives to suppress IDE0130 namespace mismatch
    warnings
  • Wrapped namespace declaration with warning disable/restore pragmas
+6/-0     
NullableAttributes.cs
Add pragma directives for namespace warnings                         

dotnet/src/webdriver/Properties/NullableAttributes.cs

  • Removed extra blank line before conditional compilation
  • Added pragma directives to suppress IDE0130 namespace warnings
  • Wrapped namespace declaration with warning disable/restore pragmas
+2/-1     
StringSyntaxAttribute.cs
Add pragma directives and cleanup formatting                         

dotnet/src/webdriver/Properties/StringSyntaxAttribute.cs

  • Added pragma directives to suppress IDE0130 namespace warnings
  • Wrapped namespace declaration with warning disable/restore pragmas
  • Removed trailing blank line at end of file
+2/-1     
StringSyntaxConstants.cs
Update namespace and add pragma directives                             

dotnet/src/webdriver/Properties/StringSyntaxConstants.cs

  • Changed namespace from OpenQA.Selenium.Internal to OpenQA.Selenium
  • Added pragma directives to suppress IDE0130 namespace warnings
  • Wrapped namespace declaration with warning disable/restore pragmas
+3/-1     
TrimmingAttributes.cs
Add pragma directives for namespace warnings                         

dotnet/src/webdriver/Properties/TrimmingAttributes.cs

  • Added pragma directives to suppress IDE0130 namespace warnings
  • Wrapped namespace declaration with warning disable/restore pragmas
+2/-0     
Configuration changes
BUILD.bazel
Update build configuration file paths                                       

dotnet/BUILD.bazel

  • Updated file references from Internal/StringSyntaxAttribute.cs to
    Properties/StringSyntaxAttribute.cs
  • Updated file references from Internal/StringSyntaxConstants.cs to
    Properties/StringSyntaxConstants.cs
+2/-2     
Selenium.WebDriver.Support.csproj
Update project file paths                                                               

dotnet/src/support/Selenium.WebDriver.Support.csproj

  • Updated compile include paths from Internal\StringSyntaxAttribute.cs
    to Properties\StringSyntaxAttribute.cs
  • Updated compile include paths from Internal\StringSyntaxConstants.cs
    to Properties\StringSyntaxConstants.cs
+2/-2     
BUILD.bazel
Update build exports file paths                                                   

dotnet/src/webdriver/BUILD.bazel

  • Updated exports_files references from
    Internal/StringSyntaxAttribute.cs to
    Properties/StringSyntaxAttribute.cs
  • Updated exports_files references from
    Internal/StringSyntaxConstants.cs to
    Properties/StringSyntaxConstants.cs
+2/-2     

@selenium-ci selenium-ci added C-dotnet .NET Bindings B-build Includes scripting, bazel and CI integrations B-support Issue or PR related to support classes labels Nov 30, 2025
@selenium-ci
Copy link
Member

Thank you, @nvborisenko for this code suggestion.

The support packages contain example code that many users find helpful, but they do not necessarily represent
the best practices for using Selenium, and the Selenium team is not currently merging changes to them.

After reviewing the change, unless it is a critical fix or a feature that is needed for Selenium
to work, we will likely close the PR.

We actively encourage people to add the wrapper and helper code that makes sense for them to their own frameworks.
If you have any questions, please contact us

@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
🟢
Generic: Comprehensive Audit Trails

Objective: To create a detailed and reliable record of critical system actions for security analysis
and compliance.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Meaningful Naming and Self-Documenting Code

Objective: Ensure all identifiers clearly express their purpose and intent, making code
self-documenting

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Robust Error Handling and Edge Case Management

Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Error Handling

Objective: To prevent the leakage of sensitive system information through error messages while
providing sufficient detail for internal debugging.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Logging Practices

Objective: To ensure logs are useful for debugging and auditing without exposing sensitive
information like PII, PHI, or cardholder data.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Security-First Input Validation and Data Handling

Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent
vulnerabilities

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

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

@qodo-code-review
Copy link
Contributor

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
High-level
Use .editorconfig for warning suppression

Instead of using #pragma directives in multiple files to suppress IDE0130
warnings, use a centralized .editorconfig file to apply this rule to the entire
Properties folder. This improves maintainability and declutters the source code.

Examples:

dotnet/src/webdriver/Properties/IsExternalInit.cs [22-24]
#pragma warning disable IDE0130 // Namespace does not match folder structure
namespace System.Runtime.CompilerServices;
#pragma warning restore IDE0130 // Namespace does not match folder structure
dotnet/src/webdriver/Properties/NullableAttributes.cs [25-27]
#pragma warning disable IDE0130 // Namespace does not match folder structure
namespace System.Diagnostics.CodeAnalysis;
#pragma warning restore IDE0130 // Namespace does not match folder structure

Solution Walkthrough:

Before:

// In dotnet/src/webdriver/Properties/IsExternalInit.cs
#pragma warning disable IDE0130 // Namespace does not match folder structure
namespace System.Runtime.CompilerServices;
#pragma warning restore IDE0130 // Namespace does not match folder structure

// In dotnet/src/webdriver/Properties/NullableAttributes.cs
#pragma warning disable IDE0130 // Namespace does not match folder structure
namespace System.Diagnostics.CodeAnalysis;
#pragma warning restore IDE0130 // Namespace does not match folder structure

// ... and so on for 3 other files.

After:

# In a new or existing .editorconfig file
[dotnet/src/webdriver/Properties/**.cs]
dotnet_diagnostic.IDE0130.severity = none

// In dotnet/src/webdriver/Properties/IsExternalInit.cs
// Pragma directives are removed.
namespace System.Runtime.CompilerServices;

// In dotnet/src/webdriver/Properties/NullableAttributes.cs
// Pragma directives are removed.
namespace System.Diagnostics.CodeAnalysis;
Suggestion importance[1-10]: 7

__

Why: This is a strong suggestion that improves maintainability by centralizing warning suppression logic into an .editorconfig file, rather than scattering #pragma directives across multiple source files.

Medium
General
Match namespace to folder structure

Change the namespace of StringSyntaxConstants to OpenQA.Selenium.Properties to
match its folder structure and remove the pragma suppressing the IDE0130
warning.

dotnet/src/webdriver/Properties/StringSyntaxConstants.cs [20-27]

-#pragma warning disable IDE0130 // Namespace does not match folder structure
-namespace OpenQA.Selenium;
-#pragma warning restore IDE0130 // Namespace does not match folder structure
+namespace OpenQA.Selenium.Properties;
 
 internal static class StringSyntaxConstants
 {
     public const string JavaScript = "javascript";
 }
  • Apply / Chat
Suggestion importance[1-10]: 6

__

Why: The suggestion correctly identifies that StringSyntaxConstants is not a polyfill and should follow standard namespace conventions, unlike other files in the PR, thus improving code organization and maintainability.

Low
  • More

@nvborisenko nvborisenko merged commit 43d32dd into SeleniumHQ:trunk Nov 30, 2025
15 checks passed
@nvborisenko nvborisenko deleted the dotnet-properties branch November 30, 2025 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

B-build Includes scripting, bazel and CI integrations B-support Issue or PR related to support classes C-dotnet .NET Bindings Review effort 1/5

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants