Closed KavenBreton-eaton closed 1 month ago
I forgot to add that our project is in C# .NET Framework 4.8
Is this the same service you mentioned here? https://github.com/microsoft/codecoverage/issues/96
From the logs, I can see that dlls are being loaded and eventually added in the final report. Can you please check if server and service are running under same credentials? Administrator mode?
Yes, same as #96 I think it might be related to the user since our services are running under Local System. Is it possible to do or would I have to make our services run under another user? Do both the command prompt from where I start the collection and the service need to be in Administrator mode?
After more testing, I was able to get coverage from our client application but not our services. Even if I make our services runs as the same user, I never get a block covered for them. I also tried starting the collection in a not elevated command prompt. l also tried starting a command prompt using the Local System user.
Do you have Visual Studio Enterprise? If yes, then can you please try using Microsoft.CodeCoverage.Console.exe
from VS? It has same commands as of dotnet-coverage
. You can specify users in the runsettings file. https://github.com/microsoft/codecoverage/blob/967a10da1decde0f185c88aaba0d586fbd51ae34/docs/configuration.md?plain=1#L97
https://learn.microsoft.com/en-us/visualstudio/test/microsoft-code-coverage-console-tool?view=vs-2022
I am going to test it. Is there anything really different from dotnet-coverage itsefl?
Microsoft.CodeCoverage.Console.exe is built against net framework while dotnet-coverage is net core.
This could be because of security features available in net framework but not available in net core.
https://learn.microsoft.com/en-us/answers/questions/1470826/how-do-i-use-microsoft-codecoverage-console-exe-in It was asked here but it seems like I won't be able to use that tool on our test VMs anyway. Is it worth trying anyway?
https://learn.microsoft.com/en-us/answers/questions/1470826/how-do-i-use-microsoft-codecoverage-console-exe-in It was asked here but it seems like I won't be able to use that tool on our test VMs anyway. Is it worth trying anyway?
You can use it if you install dotnet framework on VM.
Thank you. Using the Microsoft CodeCoverage console allowed us to gather the coverage from our services.
Hello,
Since we have a lot of Windows services running from which we want to gather code coverage, we decided to instrument all our binaries using
dotnet-coverage instrument -s "C:\dev\localCoverageTest\codecoverage.runsettings" -id "Project.CodeCoverage" "c:\file\path"
We are then starting collection usingdotnet-coverage collect -id "Project.CodeCoverage" --server-mode -s "C:\dev\localCoverageTest\codecoverage.runsettings"
Our runsettings file looks like this `<?xml version="1.0" encoding="utf-8"?>