Comments (5)
The BranchPoint
record is one of the more kitchen-sink parts of the OpenCover format, which I have faithfully reproduced in AltCover. The offset
is the location of the branch instruction, relative to the start of the method; offsetend
is the instruction where that particular option from the branch leads, possibly via intermediate unconditional branch instructions (noted in the offsetchain
property, if that is set).
Building the sample code and decompiling, we see for the net48
code
that the interpolation is a simple String.Format
call using a compile-time generated format string, but for the net7.0
code
there is a lot more code involved, where the output strung is stitched together in-line.
For this not-really-the-same-assembly merging, the better way to match up branch points would be just to compare sl
- the source line at which the branch begins - and path
- which option was chosen. That would be robust against most cases of different compiler-inlined logic, which might also include branches.
from altcover.
Certainly, whatever you end up doing here is going to involve heuristics of some sort, since they aren't quite the same assembly due to such compiler differences.
Of the other attributes, uspid
is a count (from zero) of the branch points in that assembly; ordinal
is a similar per-method count. Those would not be robust against a compiler inserted extra branch, should such a thing arise (e.g. potentially different IL from compiling a switch
statement, especially one switching on string values).
In the general case, things are of course complicated by possible #if NET70
or #if NET48
blocks. These sorts of issues are why the Merge-OpenCover
cmdlet and API match on assembly hash first.
from altcover.
Thanks for the answer; very insightful!
The problem with looking at path
only is that, in some cases, the path is duplicated in the same report (particularly if you have two separate if
statements on the same line).
Right now, I'm looking at uspid
. While it is not perfect either, it seems more robust than relying on offset
and offsetend
.
from altcover.
Taking no news as good news, and closing.
from altcover.
Ah, sorry, I forgot to reply. Indeed, your in-depth posts helped us find an acceptable solution. Thanks a lot!
from altcover.
Related Issues (20)
- Path.GetFullPath no longer resolves long file paths HOT 7
- Could not find coverage.xml.zip when running Instrumented binaries HOT 5
- Adding AltCover to projects results in dotnet test running against all projects in solution HOT 6
- Running AltCover Runner in parallel mode HOT 2
- Question about cyclomatic complexity for pattern match HOT 2
- Changes so AltCover will run when FIPS compliance is required HOT 13
- .../Temp/tmp###.altcover.runsettings not found Intermittent tests ignored. HOT 2
- Question Regarding assemblies being added to code coverage result HOT 2
- Command vstest.console.exe not started. Why? HOT 3
- altcover runner --OutputFile gives incorrect summary output HOT 8
- ERROR *** Instrumentation phase failed - Failed to resolve assembly: System.Data.Common HOT 8
- Generic methods share the same name and signature HOT 5
- Collection phase failed with an Error HOT 9
- Per-test level code coverage HOT 2
- Coverage collection requires instrumented code in same location until collection is not completed causing service downtime HOT 4
- Question : Codecov says braces are not covered HOT 2
- test run duration degredation when upgrading from 8.8.74 to 8.8.165? HOT 11
- Changed source paths/filenames in 8.8.173 in combination with reportgenerator HOT 5
- COM Server C# Code Coverage HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from altcover.