-
Notifications
You must be signed in to change notification settings - Fork 388
[BUG] Collector fails when one of the project's libraries is called collector #1739
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
Please provide more information e.g. diag log files. This looks like a known issue CoverletCoverageDataCollector: Failed to instrument modules Please build test project, publish test project and try |
I think it would be better if try to produce diag log files as it seems that you know how to do it and I, unfortunately, do not... If you have any troubles reproducing the issue on your end, please let me know. |
You can use optional parameters to create diag log files (see below). I used your instructions and created a repo but could not reproduce your errors. We need still more information e.g.
Please use latest released coverlet nuget package
or use vstest
![]() |
Thank you for the instruction, very helpful! The error is reproducible on my end. The log files attached. The test.diag.host.25-03-25_09-32-19_24233_5.log |
|
Please also check the whether repo.zip project also generates the same error with your environment. Thanks. My system has:
|
The log files have no additional information but there are similar issues and only reproducible on your systems. This is hard to troubleshoot because individual system have different configuration e.g. virus scanner and so on. The issues mentioned above have some hints which might help. Please check. Please also check before the test execution:
Try also this (from issue 725):
|
I've tried it in Docker and it worked ok: FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
WORKDIR /
ENV PATH="$PATH:/root/.dotnet/tools"
RUN apt-get update
RUN apt-get upgrade -y
RUN dotnet tool install --global coverlet.console
RUN mkdir MySolution
WORKDIR /MySolution
RUN dotnet new classlib -n MyLibrary
RUN dotnet new console -n Collector
WORKDIR /MySolution/Collector
RUN dotnet add reference ../MyLibrary/MyLibrary.csproj
WORKDIR /MySolution
RUN dotnet new nunit -n MyTests
WORKDIR /MySolution/MyTests
RUN dotnet add reference ../Collector/Collector.csproj
WORKDIR /MySolution
RUN dotnet test MyTests/MyTests.csproj --collect:"XPlat Code Coverage" |
FYI, I've just tested this:
🤷 |
This is a really interesting. I am not sure wether this is coverlet.collector issue. I will contact other team member. https://github.com/search?q=repo%3Amicrosoft%2Fvstest+Collector.dll&type=code |
It looks I can put one more example into my collection. It will stay just just between the fork-bomb and date-bomb. |
##Summary This assembly name problem cannot be resolved by coverlet because the limitation is introduced with DataCollector Assembly Naming Convention. |
I cannot find any workaround for this so I suppose I should just not name the assembly this way. Thank you for finding this. This is very useful. |
One question through: can coverlet instrument assembly before vstest loads/locks it and do modify it afterwards? This way it still can be processed and there will be no error, right? |
Please use coverlet.msbuild nuget apckage 6.0.4. |
Um... I'm not sure how to do that. I've tried: mkdir MySolution
cd MySolution
dotnet new classlib -n MyLibrary
dotnet new console -n Collector
cd Collector
dotnet add reference ../MyLibrary/MyLibrary.csproj
cd ..
dotnet new nunit -n MyTests
cd MyTests
dotnet add reference ../Collector/Collector.csproj
dotnet add package coverlet.msbuild --version 6.0.4
cd ..
dotnet.exe test MyTests\MyTests.csproj --collect:"XPlat Code Coverage" but it does not seem to make any difference. |
The first link is the integration description. Here you find the integration documentation for coverlet.msbuild.
|
We finally made it work. Thank you for your help! |
Tested on two machines, reproducible 100%.
fails with
The text was updated successfully, but these errors were encountered: