System.IO.IOException when running tests in parallel
Answered
I am currently trying Rider out to see if I can move across from VS. I have so far been very impressed that it simply works out of the box; literally load up my solution and it works without any config! I am running test cases using Selebium WebDriver. In VS I can run these in parallel using NUnit's [Parallelizable] attribute without issue, however in Rider I get the following exception:
System.IO.IOException : The process cannot access the file 'C:\Users\James\AppData\Local\Temp\gwf43mct.3bs\d5ijhazd.vjw\Chrome\77.0.3865.40\X32\chromedriver.exe' because it is being used by another process.
Any ideas?
Please sign in to leave a comment.
Hello,
I would suggest trying some tool for detecting what is using the file, like Process Hacker. Once we know what is locking that file and prevent Rider from using it, we can decide on further steps. Please keep me posted on the result.
Fixed! Basically, when I am writing tests I always comment out Driver.Close and Driver.Quit, so that when the test case fails it keeps the browser up and I can debug. Seems that in Rider this results in a singular instance of chromedriver.exe not being closed down. If I manually close it in Task Explorer then I can run my tests in parallel! :)
Thank you for sharing the details, I am glad to hear the issue is resolved.
Hi, quick update for you - this happens whenever I install Rider on a new machine. It appears to be related to the following option:
Settings > Unit Testing > NUnit > NUnit 3 > When running tests set Environment.CurrentDirectory to: Temporary folder/Test assembly's folder/Custom folder
For some reason, even though I exported and imported all of my Rider settings, on my existing machine it was set to 'Test assembly's folder' and on new build defaulted to 'Temporary folder'. As soon as I switched it over it started working without issue.
Hi James,
It is probably somehow connected to the settings files or the export/import process.
Unit Testing is a layer-based settings group. It means that these settings are stored in special .DotSettings files.
But the action "File | Export Settings" stores only "my computer layer."
You can read more about Rider settings engines here -> https://www.jetbrains.com/help/rider/Rider_Settings.html.
Could you please describe how you did export/import settings?
Sofia.