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

Exception is shown "Cannot access a disposed object" when using Parallelizable attribute #38

Open
bankova opened this issue Dec 5, 2023 · 2 comments
Assignees

Comments

@bankova
Copy link

bankova commented Dec 5, 2023

Setup in Bellatrix.Web.GettingStarted:

  1. Add [Parallelizable] in classes LocateElementsTests and WaitElementsTests
  2. In testFrameworkSettings.Debug.json set
"webSettings": {
  "isParallelExecutionEnabled": "true",
"processCleanupSettings": {
  "isParallelExecutionEnabled": "true"
},
  1. Select in the Test Explorer in Visual Studio all tests from both classes and run them all.

Expected: All tests pass.

Actual: Only the tests from one of the classes will pass, the tests from the other will fail. The exception is:
OneTimeSetUp: System.ObjectDisposedException : Cannot access a disposed object.
Object name: 'System.Net.Http.HttpClient'.
In the log even for the tests that have passed the following is displayed:

Standard Error: 
**********
OpenQA.Selenium.WebDriverException: An unknown exception was encountered sending an HTTP request to the remote WebDriver server for URL http://127.0.0.1:51887/session/c5a9c64bf9f9a19ec7e92b3b13eada54/window. The exception message was: An error occurred while sending the request.
---> System.Net.Http.HttpRequestException: An error occurred while sending the request.
---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host..
---> System.Net.Sockets.SocketException (10054): An existing connection was forcibly closed by the remote host.
--- End of inner exception stack trace ---
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource<System.Int32>.GetResult(Int16 token)
at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpClient.g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
at OpenQA.Selenium.Remote.HttpCommandExecutor.MakeHttpRequest(HttpRequestInfo requestInfo)
at OpenQA.Selenium.Remote.HttpCommandExecutor.Execute(Command commandToExecute)
--- End of inner exception stack trace ---
at OpenQA.Selenium.Remote.HttpCommandExecutor.Execute(Command commandToExecute)
at OpenQA.Selenium.Remote.DriverServiceCommandExecutor.Execute(Command commandToExecute)
at OpenQA.Selenium.WebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.WebDriver.Close()
at Bellatrix.Web.Services.DisposeDriverService.Dispose(IWebDriver webDriver, ServicesCollection container) in C:\Users\bankova\Desktop\BELLATRIX-master\src\Bellatrix.Web\services\DisposeDriverService.cs:line 46
**********

@n1xan
Copy link
Collaborator

n1xan commented Feb 14, 2024

Hello Kristina,

We have just released the latest version of the framework. One of the issues resolved was the parallel execution, so please download the new source code and try again your scenario.

-Nikolay

@n1xan n1xan self-assigned this Feb 14, 2024
@bankova
Copy link
Author

bankova commented Feb 27, 2024

Hi Niki,
thank you for the update. The issue is still reproducible, I have tested with the newest version available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants