You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`warning : [coverlet] Hits file:'C:\Users\REDACTED\AppData\Local\Temp\testApp_ac32258b-fd4a-4bb4-824c-a79061e97c31' not found for module: 'testApp'`
13
13
14
-
* zero coverage result (often only on CI but not on local)
14
+
* zero coverage result (often only on CI but not on local)
15
15
```
16
16
Calculating coverage result...
17
17
C:\Users\REDACTED\.nuget\packages\coverlet.msbuild\2.6.0\build\netstandard2.0\coverlet.msbuild.targets(21,5): warning : [coverlet] Hits file:'C:\Users\REDACTED\AppData\Local\Temp\testApp_ac32258b-fd4a-4bb4-824c-a79061e97c31' not found for module: 'testApp' [C:\Users\REDACTED\Documents\repo\testapp\testapp.Tests\testapp.Tests.csproj]
The issue is related to vstest platform https://github.com/microsoft/vstest/issues/1900#issuecomment-457488472
38
+
The issue is related to vstest platform https://github.com/microsoft/vstest/issues/1900#issuecomment-457488472
39
39
```
40
40
However if testhost doesn't shut down within 100ms(as the execution is completed, we expect it to shutdown fast). vstest.console forcefully kills the process.
41
41
```
@@ -44,21 +44,21 @@ Coverlet collect and write hits data on process exist, if for some reason proces
44
44
This happen also if there are other "piece of code" during testing that slow down process exit.
45
45
We found problem for instance with test that uses RabbitMQ.
46
46
47
-
*Solution:*
48
-
The only way to solve this issue is to use collectors integration https://github.com/coverlet-coverage/coverlet#vstest-integration-preferred-due-to-known-issue-supports-only-net-core-application.
49
-
With collector we're injected in test host through a in-proc collector that talk with vstest platform so we can signal when we end our work.
47
+
*Solution:*
48
+
The only way to solve this issue is to use collectors integration https://github.com/coverlet-coverage/coverlet#vstest-integration-preferred-due-to-known-issue-supports-only-net-core-application.
49
+
With collector we're injected in test host through a in-proc collector that talk with vstest platform so we can signal when we end our work.
50
50
51
51
## 2) Upgrade `coverlet.collector` to version > 1.0.0
52
52
53
-
*Affected drivers*: vstest integration `dotnet test --collect:"XPlat Code Coverage"`
53
+
*Affected drivers*: vstest integration `dotnet test --collect:"XPlat Code Coverage"`
54
54
55
-
*Symptoms:* The same as known issue 1.
55
+
*Symptoms:* The same as known issue 1.
56
56
57
-
There is a bug inside vstest platform https://github.com/microsoft/vstest/issues/2205.
57
+
There is a bug inside vstest platform https://github.com/microsoft/vstest/issues/2205.
58
58
If you upgrade collector package with version greater than 1.0.0 in-proc collector won't be loaded so you could incur known issue number 1 and get zero coverage result
59
59
60
-
*Solutions:*
61
-
1) Reference `Mcrosoft.NET.Test.Sdk` with version *greater than* 16.4.0
60
+
*Solutions:*
61
+
1) Reference `Mcrosoft.NET.Test.Sdk` with version *greater than* 16.4.0
62
62
For instance
63
63
```xml
64
64
<ItemGroup>
@@ -126,7 +126,7 @@ dotnet test --settings runsetting
126
126
```bash
127
127
dotnet test /p:CollectCoverage=true /p:CopyLocalLockFileAssemblies=true
128
128
```
129
-
or adding the attribute `<CopyLocalLockFileAssemblies>` to project
129
+
or adding the attribute `<CopyLocalLockFileAssemblies>` to project
130
130
file
131
131
```xml
132
132
<PropertyGroup>
@@ -137,14 +137,14 @@ dotnet test --settings runsetting
137
137
```
138
138
NB. This **DOESN'T ALWAYS WORK**, for instance in case of shared framework https://github.com/dotnet/cli/issues/12705#issuecomment-536686785
139
139
140
-
We can do nothing at the moment this is a build behaviour out of our control.
141
-
This issue should not happen for .net runtime version >= 3.0 because the new default behavior is copy all assets to the build output https://github.com/dotnet/cli/issues/12705#issuecomment-535150372
140
+
We can do nothing at the moment this is a build behaviour out of our control.
141
+
This issue should not happen for .net runtime version >= 3.0 because the new default behavior is copy all assets to the build output https://github.com/dotnet/cli/issues/12705#issuecomment-535150372
142
142
143
143
In this case the only workaround for the moment is to *manually copy* missing dll to output folder https://github.com/tonerdo/coverlet/issues/560#issue-496440052 "The only reliable way to work around this problem is to drop the DLL in the unit tests project's bin\Release\netcoreapp2.2 directory."
144
144
145
145
## 5) Tests fail if assembly is strong named
146
146
147
-
*Affected drivers*: all drivers
147
+
*Affected drivers*: all drivers
148
148
149
149
*Symptoms:* Running coverage on .NET Framework runtime(i.e. .NET 4.6.1) and get error like:
150
150
```
@@ -163,5 +163,24 @@ Stack Trace:
163
163
164
164
NB. Workaround doesn't work if test method itself explicitly creates an appdomain and uses shadow copying in order to test that the assembly behaves properly in those conditions.
165
165
166
+
## 6) Code coverage returns NaN%
166
167
168
+
*Symptoms:* You are getting following result when running Coverlet within CI/CD pipeline:
167
169
170
+
```
171
+
+--------+------+--------+--------+
172
+
| Module | Line | Branch | Method |
173
+
+--------+------+--------+--------+
174
+
175
+
+---------+------+--------+--------+
176
+
| | Line | Branch | Method |
177
+
+---------+------+--------+--------+
178
+
| Total | 100% | 100% | 100% |
179
+
+---------+------+--------+--------+
180
+
| Average | NaN% | NaN% | NaN% |
181
+
+---------+------+--------+--------+
182
+
```
183
+
184
+
SUT(System Under Test) assembly is also not listed in MSBuild logs - "Instrumented module" is missing for your dll.
185
+
186
+
*Solution*: Check whether deterministic build is turned on for your solution, if so, follow instructions how to handle [Deterministic build](DeterministicBuild.md).
0 commit comments