Failed to get coverage result: Unable to read beyond the end of the stream
See original GitHub issueDespite following the recommendation of using the following command:
dotnet test --collect:"XPlat Code Coverage"
Because of this known issue https://github.com/tonerdo/coverlet/blob/master/Documentation/KnowIssues.md#1-vstest-stops-process-execution-earlydotnet-test
I still seem to be getting the same issue.
Data collector 'XPlat code coverage' message: [coverlet]Coverlet.Collector.Utilities.CoverletDataCollectorException: CoverletCoverageDataCollector: Failed to get coverage result
---> System.IO.EndOfStreamException: Unable to read beyond the end of the stream.
at System.IO.BinaryReader.InternalRead(Int32 numBytes)
at Coverlet.Core.Coverage.CalculateCoverage() in D:\git\coverletToRelease\src\coverlet.core\Coverage.cs:line 363
at Coverlet.Core.Coverage.GetCoverageResult() in D:\git\coverletToRelease\src\coverlet.core\Coverage.cs:line 137
at Coverlet.Collector.DataCollection.CoverageWrapper.GetCoverageResult(Coverage coverage) in D:\git\coverletToRelease\src\coverlet.collector\DataCollection\CoverageWrapper.cs:line 44
at Coverlet.Collector.DataCollection.CoverageManager.GetCoverageResult() in D:\git\coverletToRelease\src\coverlet.collector\DataCollection\CoverageManager.cs:line 91
--- End of inner exception stack trace ---
at Coverlet.Collector.DataCollection.CoverageManager.GetCoverageResult() in D:\git\coverletToRelease\src\coverlet.collector\DataCollection\CoverageManager.cs:line 96
at Coverlet.Collector.DataCollection.CoverletCoverageCollector.OnSessionEnd(Object sender, SessionEndEventArgs e) in D:\git\coverletToRelease\src\coverlet.collector\DataCollection\CoverletCoverageCollector.cs:line 148.
Is it expected that by using this method I should never get the Unable to read beyond the end of the stream
error?
Issue Analytics
- State:
- Created 4 years ago
- Comments:17 (1 by maintainers)
Top Results From Across the Web
Unable to read beyond the end of the stream · Issue #865
We have a solution with multiple projects, but this happens not always at the same project. Coverlet version: coverlet.msbuild:2.8.1. Test SDK ...
Read more >Error 'Unable to read beyond the end of the stream. ' in CL ...
Hello,. starting from yesterday we are encountering the following error during build test and collecting test results. Calculating coverage ...
Read more >Error running unit tests on azure devops with nugget ...
1.Clean the package cache, delete the bin and obj folder and run the dotnet test command again. 2.Update coverlet.msbuild package from 2.3.1 to ......
Read more >Unable to read beyond the end of the stream
Unable to read beyond the end of the stream - I have NCover generating two code coverage files, merging them and creating a...
Read more >Developers - Unable to read beyond the end of the stream -
I use the latest versions but still have this error. cmd. dotnet.exe test --logger trx --results-directory .
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Please reopen. Getting the same error. dotnet version: 3.1.302
Command:
bat "${env.DOTNET_EXE} test MyTestProject.csproj --no-restore -c Release /p:CollectCoverage=true /p:CoverletOutput=${env.WORKSPACE}/${env.UT_RESULTS} /p:CoverletOutputFormat=opencover /p:Threshold=50 /p:ThresholdType=branch /p:ThresholdStat=Average /p:Exclude=[*Test*]*"
Hello, I wanted to reopen this issue as we are experiencing the same problem using the collectors. Our package version are the following:
We run the tests by running
dotnet test {CS Project} --no-build --no-restore --logger trx --collect "XPlat Code Coverage"
.The error we receive is:
The test projects are being run one by one. This does not happen all the time, hence our coverage is inconsistent.