Anonymous method not ignored from code coverage

Using SonarQube Enterprise Edition Version 9.2.4 (build 50792)

The following block of code is showing as not covered by unit tests on the anonymous function line of code

[ExcludeFromCodeCoverage]
private static RemoteCertificateValidationCallback SetCertValidationCallBack() =>
  (sender, certificate, chain, errors) => SetServerCertificateValidationCallback(sender, certificate, chain, errors);

Hey there.

See this thread:

other methods and classes which also have this attribute are ignored though

After some reading I understand now that SonarQube doesnt actually check the unit test code coverage and just takes the report generated by a 3rd party. We are using opencover so this actually isnt a SonarQube issue

1 Like