Thanks for sending through the details. I've examined the export file in the context of the source it was generated from. To my knowledge, the export file appears to be correct and without problems. I note the following sequence points that are shown in the file for the source file triggering the error:
Code:
<SequencePoints>
<SequencePoint vc="1" uspid="8501" ordinal="0" offset="0" sl="8" sc="3" el="8" ec="39" bec="0" bev="0" fileid="615" />
<SequencePoint vc="1" uspid="8502" ordinal="1" offset="7" sl="9" sc="3" el="9" ec="4" bec="0" bev="0" fileid="615" />
<SequencePoint vc="1" uspid="8503" ordinal="2" offset="8" sl="10" sc="4" el="11" ec="17" bec="0" bev="0" fileid="615" />
<SequencePoint vc="1" uspid="8504" ordinal="3" offset="77" sl="13" sc="4" el="16" ec="81" bec="0" bev="0" fileid="615" />
<SequencePoint vc="1" uspid="8505" ordinal="4" offset="166" sl="18" sc="4" el="19" ec="17" bec="0" bev="0" fileid="615" />
<SequencePoint vc="1" uspid="8506" ordinal="5" offset="235" sl="20" sc="3" el="20" ec="4" bec="0" bev="0" fileid="615" />
</SequencePoints>
Note the 'sl' and 'el' (start line and end line) do not include line 23, which is specified in the error given by SonarScanner. NCrunch makes no reference to this line. However, I did notice something else interesting.
There is another method defined in the export file which has a sequence point ID that is equal to the file ID of the source file mentioned by the error message:
Code:
<SequencePoint vc="0" uspid="615" ordinal="1" offset="1" sl="23" sc="4" el="23" ec="38" bec="0" bev="0" fileid="200" />
This method makes reference to line 23, which is perfectly valid for the method in which it refers. But it makes me suspect that there may be an issue here with how SonarScanner is parsing these IDs.
The root problem here is that the partcover export file format isn't really a published format or standard - it's just a file that gets output from another tool. We have to guess at what these fields mean, and I suppose for the developers of SonarScanner, it's the same.
My understanding is that the 'uspid' field represents the sequence point ID as specified in the assembly's PDB file. I recommend raising a support request with the developers of SonarScanner to establish their thoughts on this.