False coverage for C# fixed statement
The following code:
byte[] b = Encoding.GetBytes(s);
fixed (byte* pb = b) {
interop_call(pb, 4);
}
is cited as a 50% covered branch in the Cobertura.xml coverage results, on the line number of the fixed statement, and it shows yellow in the coverage margin.
FCC runs the coverage tools. We just surface the results. If you get the same results with RunMsCoverage No and Yes then the coverage will be correct.
Well that's kinda my point. The coverage is not correct, because that isn't a branch. So you're saying I should raise the issue with Microsoft?
If you are using RunMsCodeCoverage Yes. Although we use the cobertura format and not the binary format which account for what you see.
No issues https://github.com/microsoft/codecoverage/issues?q=is%3Aissue state%3Aopen fixed statement
https://github.com/coverlet-coverage/coverlet/issues/1016
https://chatgpt.com/c/68503cd8-2fdc-8003-aa54-d534b8932581
OK, so I gather that it is still an open issue in Coverlet, and that nobody has raised the issue with Microsoft. I'm away from that machine at the moment, but later today I'll double check that I have RunMsCodeCoverage Yes (I'm almost positive I do) and either raise the issue with Microsoft, or bump the one in Coverlet.
There should be two cobertura files - the one you see and the original that is passed to report generator. Please check the original in case there is an issue with report generator.
Definitely using ms code coverage, and both of the cobertura.xml files show the same error for what looks like every fixed statement in the code base.
OK, I have opened an issue with testfx at issue, so I'm closing this one.