Skip to content

[dotnet] Hide driver service window by default#16782

Merged
nvborisenko merged 3 commits intoSeleniumHQ:trunkfrom
nvborisenko:dotnet-hide-service-window
Dec 23, 2025
Merged

[dotnet] Hide driver service window by default#16782
nvborisenko merged 3 commits intoSeleniumHQ:trunkfrom
nvborisenko:dotnet-hide-service-window

Conversation

@nvborisenko
Copy link
Member

@nvborisenko nvborisenko commented Dec 22, 2025

User description

When using UI application.

🔄 Types of changes

  • Bug fix (backwards compatible)

PR Type

Bug fix


Description

  • Set ProcessWindowStyle to Hidden when HideCommandPromptWindow is enabled

  • Ensures driver service window is completely hidden in UI applications

  • Complements existing CreateNoWindow setting for full window suppression


Diagram Walkthrough

flowchart LR
  A["HideCommandPromptWindow enabled"] -- "Set WindowStyle" --> B["ProcessWindowStyle.Hidden"]
  B -- "Combined with" --> C["CreateNoWindow = true"]
  C --> D["Fully hidden service window"]
Loading

File Walkthrough

Relevant files
Bug fix
DriverService.cs
Add ProcessWindowStyle.Hidden for window suppression         

dotnet/src/webdriver/DriverService.cs

  • Added conditional logic to set ProcessWindowStyle.Hidden when
    HideCommandPromptWindow is true
  • Enhances window hiding behavior by combining CreateNoWindow with
    explicit WindowStyle setting
  • Ensures driver service process window is completely hidden in UI
    applications
+5/-0     

@qodo-code-review
Copy link
Contributor

qodo-code-review bot commented Dec 22, 2025

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

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

@qodo-code-review
Copy link
Contributor

qodo-code-review bot commented Dec 22, 2025

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Remove ineffective window style setting
Suggestion Impact:The commit removed the conditional block that set StartInfo.WindowStyle = Hidden when HideCommandPromptWindow is true, matching the suggestion that it is ineffective with UseShellExecute=false.

code diff:

@@ -253,11 +253,6 @@
         this.driverServiceProcess.StartInfo.Arguments = this.CommandLineArguments;
         this.driverServiceProcess.StartInfo.UseShellExecute = false;
         this.driverServiceProcess.StartInfo.CreateNoWindow = this.HideCommandPromptWindow;
-
-        if (this.HideCommandPromptWindow)
-        {
-            this.driverServiceProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
-        }

Remove the ineffective WindowStyle assignment, as it has no effect when
UseShellExecute is false. The existing CreateNoWindow property already handles
hiding the window.

dotnet/src/webdriver/DriverService.cs [254-260]

 this.driverServiceProcess.StartInfo.UseShellExecute = false;
 this.driverServiceProcess.StartInfo.CreateNoWindow = this.HideCommandPromptWindow;
 
-if (this.HideCommandPromptWindow)
-{
-    this.driverServiceProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
-}
-

[Suggestion processed]

Suggestion importance[1-10]: 7

__

Why: The suggestion correctly identifies that the code added in the PR is ineffective because UseShellExecute is set to false, and it proposes removing the dead code, which is the optimal fix.

Medium
  • Update

@nvborisenko nvborisenko changed the title [dotnet] Hide driver service window [dotnet] Hide driver service window by default Dec 23, 2025
@nvborisenko nvborisenko merged commit 98a9c63 into SeleniumHQ:trunk Dec 23, 2025
10 checks passed
@nvborisenko nvborisenko deleted the dotnet-hide-service-window branch December 23, 2025 21:46
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