-
Notifications
You must be signed in to change notification settings - Fork 389
"The process cannot access the file, because it is being used by another process" error during attempt to collect coverage #857
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
Comments
I've collected some events using Process Monitor, there no processes, except Attached two files with events, first one for run with |
Can you try only with collectors and enable verbose logging and attach logs(before check if there are sensitive data inside) https://github.com/coverlet-coverage/coverlet/blob/master/Documentation/Troubleshooting.md#collectors-integration? |
Hi, please find verbose log for collectors attached. Thanks for your patience |
Thanks |
I cannot repro and without stack trace of thread that blocks files it's hard to understand the reason, I've got a temporary idea to try, we could avoid to raise error in case of issue during file restoring, so at least you can get a coverage file output. Could work for the moment?The only drawback is that the files inside bin/debug will remain instrumented and so no more usable for further test run. |
That errors happens at the end of all coverage when we copy back original(non instrumented) files, but at that time coverage data are correctly gathered. |
@AntiPasha I'm working on a workaround/solution, can you try with this package(collectors driver nuget feed source https://f.feedz.io/marcorossignoli/coverletunofficial/nuget/index.json This is the feed I use for preview/investigation. |
@MarcoRossignoli Thanks a lot for the update, I've tried your package and it seems to work fine, I didn't seen any exceptions, report is generated in random folder under |
For collector the default one is cobertura as explained in the guide |
If you confirm that amend works well I can merge and you can use nightly build until next official release |
Does it work only for VSTest integration? What about msbuild one? |
Works for both the engine in shared, but give me some minutes...I'll upload also msbuild version so you can try and confirm. |
Uploaded BTW my advice is to use collectors because has got better integration and doesn't suffer of some issues https://github.com/coverlet-coverage/coverlet/blob/master/Documentation/KnownIssues.md#1-vstest-stops-process-execution-earlydotnet-test Please let me know if works as expected! |
@MarcoRossignoli MSBuild integration works as well, thanks in advance! |
Great will PR asap! |
I do not think this has been released yet. Is there a release with this fix coming soon? |
We should be near new release, we're discussing new versioning schema and after we'll release. cc: @tonerdo |
Good thread! I think we are on the same problem here. I managed to install the coverlet.collector.1.3.1-preview.6.g1f7fe02d13, but I can't seem to find the coverlet.msbuild.2.9.1-preview.6.g1f7fe02d13. Did you update to another preview? |
Maybe I need the coverlet.msbuild, because I have a single test in a single class, causing this lockup, every time, it is not even intermittent for me. Currently, it is not open source code. I will see if I can produce an open example from the code. The output is: --- End of inner exception stack trace --- Test Run Successful. |
@xJom I apologize but we're in the middle of nightly migration and at the moment you can try with my unofficial feed I use to debug https://f.feedz.io/marcorossignoli/coverletunofficial/nuget/index.json Keep the eyes on #969 |
Thanks! I managed to run it with 3.0.0-preview.9 for both coverlet.msbuild and coverlet.collector, but still one file is locking up. I also run with all parameters:
I also tried to turn off the Real-time protection of Microsoft Defender, but no difference. |
Strange...keep me informed on it, also pls in case open a new issue this is boiled. |
I am also running into this and the preview package has fixed it. Any plans to have a stable release for this? Thanks! |
^^ Still running into this too |
@danjcosg can you open a new issue? |
This is a year later, and this problem still exists. Newest Coverlet Nuget, .NET 6 (or .NET Core 3.1 same). Was it ever fixed? I'm not allowed to use unofficial Nuget feeds so I haven't tried that. |
The problem will always exist if some tool open handle to files when we want to restore the dll at the end, unfortunately we're not in control of that in any way. One solution can be skip the restore(with some flag opt-in) if we're sure that the test build will be discarded at the end of the test and not used anymore outside testing. |
The error message for MSBuild intergration
The same behavior for VSTest integration
It happens all the time, when I try to collect coverage for xunit test projects (with NUnit everything works fine suddenly) using default commands, like
dotnet test --collect:"XPlat Code Coverage"
ordotnet test /p:CollectCoverage=true
Adding
-nr:false -m:1
arguments to MSBuild didn't help, as well as running commands with separatecsproj
file. I've used the latest versions ofcoverlet
,xunit
andMicrosoft.NET.Test.Sdk
packagesInstalled SDKs are below
Migrated from comments of 725 issue
The text was updated successfully, but these errors were encountered: