Skip to content

[dotnet] [build] Bump up C# lang version to 14.0#17236

Merged
nvborisenko merged 2 commits into
SeleniumHQ:trunkfrom
nvborisenko:dotnet-langversion
Mar 18, 2026
Merged

[dotnet] [build] Bump up C# lang version to 14.0#17236
nvborisenko merged 2 commits into
SeleniumHQ:trunkfrom
nvborisenko:dotnet-langversion

Conversation

@nvborisenko

Copy link
Copy Markdown
Member

Use the latest C# version 14, SDK 10.

Updates the C# language version used across the Selenium WebDriver and Support projects from 12.0 to 14.0, and also updates the .NET toolchain version in Bazel configuration. These changes ensure compatibility with newer C# features and .NET tooling.

@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 Mar 18, 2026
@qodo-code-review

Copy link
Copy Markdown
Contributor

Review Summary by Qodo

Upgrade C# language version to 14.0 and .NET SDK to 10.0.100

✨ Enhancement

Grey Divider

Walkthroughs

Description
• Upgrade C# language version from 12.0 to 14.0
• Update .NET SDK version from 8.0.203 to 10.0.100
• Apply language version changes across all build targets
• Enables access to latest C# 14 language features

Grey Divider

File Changes

1. MODULE.bazel ⚙️ Configuration changes +1/-1

Update .NET SDK toolchain version

• Updated dotnet toolchain version from 8.0.203 to 10.0.100
• Aligns .NET SDK with C# 14.0 language version requirements

MODULE.bazel


2. dotnet/src/support/BUILD.bazel ⚙️ Configuration changes +2/-2

Bump C# language version in support library

• Updated langversion from 12.0 to 14.0 in support library target
• Updated langversion from 12.0 to 14.0 in support-strongnamed target
• Changes applied to both standard and strong-named assembly variants

dotnet/src/support/BUILD.bazel


3. dotnet/src/support/Selenium.WebDriver.Support.csproj ⚙️ Configuration changes +1/-1

Update C# language version in project file

• Updated LangVersion property from 12.0 to 14.0
• Applies to WebDriver.Support project configuration

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


View more (2)
4. dotnet/src/webdriver/BUILD.bazel ⚙️ Configuration changes +6/-6

Bump C# language version in webdriver library

• Updated langversion from 12.0 to 14.0 in webdriver-net462 target
• Updated langversion from 12.0 to 14.0 in webdriver-netstandard2.0 target
• Updated langversion from 12.0 to 14.0 in webdriver-net8.0 target
• Updated langversion from 12.0 to 14.0 in all strong-named variants
• Changes applied consistently across all target frameworks

dotnet/src/webdriver/BUILD.bazel


5. dotnet/src/webdriver/Selenium.WebDriver.csproj ⚙️ Configuration changes +1/-1

Update C# language version in project file

• Updated LangVersion property from 12.0 to 14.0
• Applies to WebDriver project configuration across all target frameworks

dotnet/src/webdriver/Selenium.WebDriver.csproj


Grey Divider

Qodo Logo

@qodo-code-review

qodo-code-review Bot commented Mar 18, 2026

Copy link
Copy Markdown
Contributor

Code Review by Qodo

🐞 Bugs (2) 📘 Rule violations (0) 📎 Requirement gaps (0) 📐 Spec deviations (0)

Grey Divider


Remediation recommended

1. SDK10 net8 tool mismatch 🐞 Bug ⛯ Reliability
Description
The Bazel-managed .NET SDK is bumped to 10.0.100, while build-time executables invoked via `dotnet
exec` are pinned to net8.0 (e.g., docfx and the DevTools generator). If the SDK 10 toolchain does
not include net8 runtime/targeting packs, these Bazel actions will fail when executing those net8.0
tools.
Code

MODULE.bazel[114]

+dotnet.toolchain(dotnet_version = "10.0.100")
Evidence
The PR changes the Bazel toolchain SDK version to 10.0.100. Separately, the repo hard-codes docfx’s
DLL path under tools/net8.0/... and executes it via dotnet exec, and it builds the DevTools
generator as a net8.0 executable—both of which rely on the dotnet toolchain being able to execute
net8.0 apps.

MODULE.bazel[113-115]
dotnet/private/docfx_repo.bzl[3-7]
dotnet/private/docfx.bzl[35-41]
third_party/dotnet/devtools/src/generator/BUILD.bazel[3-10]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
Bazel now uses .NET SDK `10.0.100`, but several executed build tools are fixed to `net8.0` (docfx + DevTools generator). If the SDK 10 toolchain doesn’t ship/enable net8 runtime & targeting packs, Bazel will fail when running those tools.

### Issue Context
`docfx` is executed via `dotnet exec` and the docfx NuGet extraction is hard-coded to a `tools/net8.0/...` path. The DevTools generator binary is also built as `net8.0`.

### Fix Focus Areas
- MODULE.bazel[113-115]
- dotnet/private/docfx_repo.bzl[3-7]
- dotnet/private/docfx.bzl[35-41]
- third_party/dotnet/devtools/src/generator/BUILD.bazel[3-10]

### What to change
Pick one consistent approach:
1) **Keep SDK 10**, and ensure the toolchain can build/run `net8.0` tools (e.g., by configuring the toolchain to include net8 targeting/runtime packs if rules_dotnet supports that), or
2) **Retarget executed tools to net10.0** (update docfx selection if the NuGet contains a net10 build; update generator’s `target_frameworks` if appropriate), or
3) **Add explicit roll-forward/runtime selection** to the wrapper scripts (only if you’ve verified it’s needed and correct for your toolchain).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. System dotnet version unchecked 🐞 Bug ⛯ Reliability
Description
dotnet/update-deps.sh may fall back to the system dotnet executable without validating its SDK
version. With this PR raising project LangVersion to 14.0, running the script on machines with an
older installed SDK can now fail depending on the local environment.
Code

dotnet/src/webdriver/Selenium.WebDriver.csproj[7]

+    <LangVersion>14.0</LangVersion>
Evidence
The script explicitly warns that it can’t find the Bazel-managed dotnet and then assigns DOTNET to
the system dotnet command. The PR simultaneously raises the project language version to 14.0,
which increases the chance that an older system SDK will be incompatible.

dotnet/update-deps.sh[6-17]
dotnet/src/webdriver/Selenium.WebDriver.csproj[3-9]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`dotnet/update-deps.sh` can fall back to system `dotnet` with no version check. After bumping `&lt;LangVersion&gt;` to `14.0`, running the script with an older SDK is more likely to fail in a machine-dependent way.

### Issue Context
The script attempts to locate the Bazel-managed dotnet under Bazel’s output_base; if that fails, it uses `dotnet` from PATH.

### Fix Focus Areas
- dotnet/update-deps.sh[6-17]
- dotnet/src/webdriver/Selenium.WebDriver.csproj[3-9]

### What to change
- Add a **minimum SDK version check** when falling back to system `dotnet` (e.g., call `dotnet --version` and error out with a clear message if below the required SDK).
- Optionally add a **global.json** (repo root or `dotnet/`) to pin the SDK version for non-Bazel workflows and keep local `dotnet` usage aligned with `MODULE.bazel` toolchain.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

@selenium-ci

Copy link
Copy Markdown
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

@nvborisenko nvborisenko merged commit 5d40cb9 into SeleniumHQ:trunk Mar 18, 2026
19 checks passed
@nvborisenko nvborisenko deleted the dotnet-langversion branch March 18, 2026 22:22
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants