Skip to content
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

[🐛 Bug]: OneTimeSetUp: System.IO.FileLoadException : Could not load file or assembly 'System.Text.Json, Version=8.0.0.0 #14600

Open
Guitrum opened this issue Oct 14, 2024 · 6 comments
Labels
I-defect I-issue-template Applied to issues not following the template, or missing information.

Comments

@Guitrum
Copy link

Guitrum commented Oct 14, 2024

What happened?

Ever since updating Selenium.WebDriver past 4.23.0, running integration tests fails on the OneTimeSetUp. To be clear, I can run my full integration test suite on 4.23.0, but I get the same setup failures on 4.24.0 and 4.25.0. For some reason it seems to still be looking for System.Text.Json, Version=8.0.0.0 even though the dependency requires 8.0.4. I notice that when trying to install 8.0.0 manually, it says there is a high severity vulnerability which is why I assume the update to require 8.0.4 exists.

Something is still stuck trying to download System.Text.Json 8.0.0 even after the update of the webdriver beyond 4.23.0

How can we reproduce the issue?

Install Selenium.WebDriver v4.25.0 and try to run integration test suite.

Relevant log output

Message: 
OneTimeSetUp: System.IO.FileLoadException : Could not load file or assembly 'System.Text.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

  Stack Trace: 
SeleniumManager.BinaryPaths(String arguments)
DriverFinder.BinaryPaths()
DriverFinder.GetDriverPath()
ChromiumDriver.GenerateDriverServiceCommandExecutor(DriverService service, DriverOptions options, TimeSpan commandTimeout)
ChromiumDriver.ctor(ChromiumDriverService service, ChromiumOptions options, TimeSpan commandTimeout)
ChromeDriver.ctor(ChromeOptions options)
Setup.Init() line 42

Operating System

Windows 11

Selenium version

Selenium.WebDriver v4.25.0

What are the browser(s) and version(s) where you see this issue?

Chrome

What are the browser driver(s) and version(s) where you see this issue?

Selenium.WebDriver.ChromeDriver v129.0.6668.10000

Are you using Selenium Grid?

No response

Copy link

@Guitrum, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

@Guitrum Guitrum changed the title [🐛 Bug]: [🐛 Bug]: OneTimeSetUp: System.IO.FileLoadException : Could not load file or assembly 'System.Text.Json, Version=8.0.0.0 Oct 14, 2024
@shbenzer
Copy link
Contributor

Have you tried updating System.Text.Json to 8.0.4 using your package manager?

@nvborisenko
Copy link
Member

@Guitrum we really need simple reproducible project where we can face this issue. Why? It works fine on my environment. The only one difference between 4.23 and 4.24 is that the latest one uses System.Text.Json instead of Newtonsoft.Json package. Theoretically and practically it just works. Your reproducible steps will help us to investigate a root cause of the issue to move furth.

@pujagani pujagani added the I-issue-template Applied to issues not following the template, or missing information. label Oct 16, 2024
Copy link

Hi, @Guitrum.
Please follow the issue template, we need more information to reproduce the issue.

Either a complete code snippet and URL/HTML (if more than one file is needed, provide a GitHub repo and instructions to run the code), the specific versions used, or a more detailed description to help us understand the issue.

Note: If you cannot share your code and URL/HTML, any complete code snippet and URL/HTML that reproduces the issue is good enough.

Reply to this issue when all information is provided, thank you.

@mvaneijken
Copy link

Got the same issue when using Selenium in Windows PowerShell 5.1. It gives the following error:
New-Object : Exception calling ".ctor" with "2" argument(s): "The type initializer for 'System.Text.Json ' threw an exception."

Tried versions 8.0.0, 8.0.4 and 8.0.5. Version 8.0.4 gives a slightly different error:

New-Object : Exception calling ".ctor" with "2" argument(s): "The type initializer for 'System.Text.Json.JsonSerializer ' threw an exception."

To invoke the web driver I'm executing the following code:

Add-Type -Path $("System.Text.Json.dll")
Add-Type -Path $("Webdriver.dll")

$EdgeOptions = New-Object  OpenQA.Selenium.Edge.EdgeOptions
$EdgeDriverService = [OpenQA.Selenium.Edge.EdgeDriverService]::CreateDefaultService("msedgedriver.exe")
$EdgeDriver = New-Object OpenQA.Selenium.Edge.EdgeDriver("msedgedriver.exe"), $EdgeOptions)

Versions used:
Windows 11 23H2 v10.0.22631.4317
Microsoft Edge v130.0.2849.46
PowerShell v5.1.22621.4249
msedgedriver.exe v130.0.2849.46
Webdriver.dll v4.25

@nvborisenko
Copy link
Member

@Guitrum @mvaneijken If somebody can rephrase steps to reproduce for me (as for dummy), I appreciate it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-defect I-issue-template Applied to issues not following the template, or missing information.
Projects
None yet
Development

No branches or pull requests

6 participants