Skip to content

Error building dotnet project in Windows #9915

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

Closed
sarvaje opened this issue Oct 13, 2021 · 5 comments
Closed

Error building dotnet project in Windows #9915

sarvaje opened this issue Oct 13, 2021 · 5 comments
Labels
B-build Includes scripting, bazel and CI integrations C-dotnet .NET Bindings

Comments

@sarvaje
Copy link

sarvaje commented Oct 13, 2021

🐛 Bug Report

Building the dotnet project in Windows returns an error.

To Reproduce

Detailed steps to reproduce the behavior:

I have tried to build it using two different ways:

  1. Using Visual Studio 2019. After installing the dependencies, I'm able to build the Webdriver project, but when I try to build the project Webdriver.Common.Tests then I get some issues similar to the this one:
C:/users/<user>/_bazel_<user>/io65vnbs/external/maven/BUILD:1737:8: Executing genrule @maven//:io_netty_netty_transport_native_epoll_4_1_67_Final_extension failed: (Exit 127): bash.exe failed: error executing command
  1. Using the command line. Running the command bazel build dotnet/...
ERROR: C:/github/selenium/dotnet/src/webdriverbackedselenium/BUILD.bazel:227:11: in src attribute of nuget_push rule //dotnet/src/webdriverbackedselenium:publish: '//dotnet/src/webdriverbackedselenium:package' must produce a single file
ERROR: C:/github/selenium/dotnet/src/webdriverbackedselenium/BUILD.bazel:227:11: Analysis of target '//dotnet/src/webdriverbackedselenium:publish' failed
ERROR: file 'dotnet/test/common/bazelout/netcoreapp2.1/Newtonsoft.Json.dll' is generated by these conflicting actions:
Label: //dotnet/test/common:edge, //dotnet/test/common:firefox
RuleClass: nunit_test rule
Configuration: aa07a07519e82af810774c182569ca55c645d883994ca9f38206e0a45c93967d
Mnemonic: CopyFile
Action key: 8e55144576d1ad53f03a8496f5eef0c6956cea29389c534297527ed5abb5881c, 1170696927e279935540456bb63d6023998c9e71393f04e77a136632e239f270
Progress message: Copying files
PrimaryInput: File:[C:/users/<user>/_bazel_<user>/io65vnbs/external/json.net[source]]lib/netstandard2.0/Newtonsoft.Json.dll
PrimaryOutput: File:[[<execution_root>]bazel-out/x64_windows-fastbuild/bin]dotnet/test/common/bazelout/netcoreapp2.1/Newtonsoft.Json.dll
Owner information: ConfiguredTargetKey{label=//dotnet/test/common:edge, config=BuildConfigurationValue.Key[aa07a07519e82af810774c182569ca55c645d883994ca9f38206e0a45c93967d]}, ConfiguredTargetKey{label=//dotnet/test/common:firefox, config=BuildConfigurationValue.Key[aa07a07519e82af810774c182569ca55c645d883994ca9f38206e0a45c93967d]}
MandatoryInputs: Attempted action contains artifacts not in previous action (first 5):
        dotnet/test/common/edge-copy-files.bat
Previous action contains artifacts not in attempted action (first 5):
        dotnet/test/common/firefox-copy-files.bat
Outputs: are equal
ERROR: com.google.devtools.build.lib.skyframe.ArtifactConflictFinder$ConflictException: com.google.devtools.build.lib.actions.MutableActionGraph$ActionConflictException: for dotnet/test/common/bazelout/netcoreapp2.1/Newtonsoft.Json.dll, previous action: action 'Copying files', attempted action: action 'Copying files'
INFO: Elapsed time: 57.083s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (360 packages loaded, 12877 targets configured)

Any idea what can be the issue?

Expected behavior

The project is built.

Test script or set of commands reproducing this issue


Environment

OS: Windows 10
Browser: ---
Browser version: ---
Browser Driver version: ---
Language Bindings version: ---
Selenium Grid version (if applicable): ---

@ghost ghost added the A-needs-triaging A Selenium member will evaluate this soon! label Oct 13, 2021
@AutomatedTester AutomatedTester added B-build Includes scripting, bazel and CI integrations C-dotnet .NET Bindings and removed A-needs-triaging A Selenium member will evaluate this soon! labels Oct 14, 2021
@sarvaje
Copy link
Author

sarvaje commented Oct 14, 2021

I have read this article written by @jimevans about how to build the .net project and it still fails, but if I check out a commit close to when that article was written, I can build it with only a couple of changes in the file .bazelrc probably due to a newer version of bazel.

Looks like something has changed since then that breaks the build.

@sarvaje
Copy link
Author

sarvaje commented Oct 15, 2021

For what I can see, these two options are the one breaking the build for the dotnet project:

# Ensure builds are unpolluted by the user env
build --incompatible_strict_action_env

# Except for the PATH environment variable
build --action_env=PATH

I can open a PR to remove them, but that may break something else.

@jimevans
Copy link
Member

jimevans commented Oct 16, 2021

If you try building using bazel build //dotnet/…, you’re going to have a Bad Time™. The rule set used to build the .NET bindings is not the “official” Bazel .NET rules, because those rules make some assumptions that run counter to how .NET environments like to build. This is particularly so with multiple framework versions encompassing .NET Framewotk, .NET Core, and the subsequent unification of those with .NET 5 and beyond..

The ones we do use, are much better in that regard, but they’re also wildly incomplete, mostly in the execution of stuff using bazel test or bazel run. We attempt to use some custom rules in those cases, but they’re, frankly speaking, poorly written.

The custom rules’ author (me) doesn’t know what he’s doing when constructing Bazel rules, and no one with any real expertise in writing Bazel rules seems to have any interest in donating effort to make them actually work. Those same people with the proper Bazel skill set also usually have no understanding of the peculiarities of .NET projects, or the know how to make them to work seamlessly on Windows.

@jimevans
Copy link
Member

@sarvaje I'm going to go ahead and close this issue. To build the test suite using Bazel, execute the target using bazel build //dotnet/test/common:chrome. This will build, but not run, the prerequisites and the tests. To actually run the tests, use Visual Studio to do so. You can modify appconfig.json to target different browsers.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked and limited conversation to collaborators Dec 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
B-build Includes scripting, bazel and CI integrations C-dotnet .NET Bindings
Projects
None yet
Development

No branches or pull requests

3 participants