Closed KavenBreton-eaton closed 9 months ago
Can you please share log files? Also, how are you shutting down dotnet-coverage collect session? What is your service type?
We are shutting it down by calling dotnet-coverage shutdown "Project.CodeCoverage"
.
Here are the logs: project.coverage.txt I did not see any error in the logs but nothing showing activity either.
I don't know what you expect for the service type. I know we inherit from System.ServiceProcess.ServiceBase.
When opening the .coverage in Visual Studio, we can read: Empty results generated: No binaries were instrumented. Make sure the tests ran, required binaries were loaded, had matching symbol files, and were not excluded through custom settings. For native C++ code coverage you have to link with /PROFILE option enabled. For more information see https://docs.microsoft.com/visualstudio/test/troubleshooting-code-coverage
Log seems to be empty 1KB => (PCH�). By service type, I meant what kind of service is it? like IIS service?
This is a Windows desktop service. Not IIS. Sorry for the logs, I sent you the .coverage file instead. Here is the right one dotnet-coverage-collect.log
--include-files "*Project.*.dll"
From the logs, it was not able to find any matching dlls for the given pattern. We use globing pattern to find dlls. https://learn.microsoft.com/en-us/dotnet/core/extensions/file-globbing
Please check your pattern and see if it works.
I am getting the same result just by using "*.dll" for instance.
Do you pdbs present in the matching dll folder? Any change in the log files?
To be sure, when you specify --include-files "*.dll"
, it is going to search dlls present only in the current directory.
Do you pdbs present in the matching dll folder? Yes. Symbols are present alongside the binaries. I am not sure of what you mean by you second sentence. When I specify files to include, it is not going to try and instrument any dll that match that pattern on the machine?
No, it will not look for dlls on the machine. It will look only in the working directory.
For example, if you are running it from C:\code\src
then it will only look for files in that folder for instrumentation.
--include-files
argument can be provided more than once. For example,
dotnet-coverage collect --server-mode --session-id coverageSession --include-files d:\server\*.dll --include-files d:\client\*.dll
In this case we will instrument all dlls in d:\server
and d:\client
folders for coverage collection.
Ok. Thanks for your input. I did not know it was working like this. From a quick test, I was able to get some coverage information.
Platform: Windows .Net version: .NET Framework 4.8
We want to get coverage data from our system tests but are unable to get any coverage from our services or any process launched by them.
dotnet-coverage collect -id "Project.CodeCoverage" --server-mode --include-files "*Project.*.dll" --output "C:\dev\localCoverageTest\project.coverage" --log-file "C:\dev\localCoverageTest\dotnet-coverage-collect.log" --log-level "Verbose"
We are calling the collect from a powershell script that then start the services and perform our automated tests. The PowerShell ISE is running as admin with the current user while the service might be running with Local System.
Is there something special that should be done in this particular case?