Skip to content

Commit dd2237a

Browse files
authored
Add known issue caused by deterministic build (#948)
Add known issue caused by deterministic build
1 parent 521f3d3 commit dd2237a

File tree

1 file changed

+37
-18
lines changed

1 file changed

+37
-18
lines changed

Documentation/KnownIssues.md

Lines changed: 37 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
# Known Issues
22

3-
## 1) VSTest stops process execution early(`dotnet test`)
3+
## 1) VSTest stops process execution early(`dotnet test`)
44

5-
*Affected drivers*: msbuild(`dotnet test`) , dotnet tool(if you're using ` --targetargs "test ... --no-build"`)
5+
*Affected drivers*: msbuild(`dotnet test`) , dotnet tool(if you're using ` --targetargs "test ... --no-build"`)
66

7-
*Symptoms:*
7+
*Symptoms:*
88
* warning or error like
99

10-
`Unable to read beyond end of stream`
10+
`Unable to read beyond end of stream`
1111

1212
`warning : [coverlet] Hits file:'C:\Users\REDACTED\AppData\Local\Temp\testApp_ac32258b-fd4a-4bb4-824c-a79061e97c31' not found for module: 'testApp'`
1313

14-
* zero coverage result (often only on CI but not on local)
14+
* zero coverage result (often only on CI but not on local)
1515
```
1616
Calculating coverage result...
1717
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]
@@ -35,7 +35,7 @@ C:\Users\REDACTED\.nuget\packages\coverlet.msbuild\2.6.0\build\netstandard2.0\co
3535
+---------+------+--------+--------+
3636
```
3737

38-
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
3939
```
4040
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.
4141
```
@@ -44,21 +44,21 @@ Coverlet collect and write hits data on process exist, if for some reason proces
4444
This happen also if there are other "piece of code" during testing that slow down process exit.
4545
We found problem for instance with test that uses RabbitMQ.
4646

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.
5050

5151
## 2) Upgrade `coverlet.collector` to version > 1.0.0
5252

53-
*Affected drivers*: vstest integration `dotnet test --collect:"XPlat Code Coverage"`
53+
*Affected drivers*: vstest integration `dotnet test --collect:"XPlat Code Coverage"`
5454

55-
*Symptoms:* The same as known issue 1.
55+
*Symptoms:* The same as known issue 1.
5656

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.
5858
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
5959

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
6262
For instance
6363
```xml
6464
<ItemGroup>
@@ -126,7 +126,7 @@ dotnet test --settings runsetting
126126
```bash
127127
dotnet test /p:CollectCoverage=true /p:CopyLocalLockFileAssemblies=true
128128
```
129-
or adding the attribute `<CopyLocalLockFileAssemblies>` to project
129+
or adding the attribute `<CopyLocalLockFileAssemblies>` to project
130130
file
131131
```xml
132132
<PropertyGroup>
@@ -137,14 +137,14 @@ dotnet test --settings runsetting
137137
```
138138
NB. This **DOESN'T ALWAYS WORK**, for instance in case of shared framework https://github.com/dotnet/cli/issues/12705#issuecomment-536686785
139139

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
142142

143143
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."
144144

145145
## 5) Tests fail if assembly is strong named
146146

147-
*Affected drivers*: all drivers
147+
*Affected drivers*: all drivers
148148

149149
*Symptoms:* Running coverage on .NET Framework runtime(i.e. .NET 4.6.1) and get error like:
150150
```
@@ -163,5 +163,24 @@ Stack Trace:
163163

164164
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.
165165

166+
## 6) Code coverage returns NaN%
166167

168+
*Symptoms:* You are getting following result when running Coverlet within CI/CD pipeline:
167169

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

Comments
 (0)