3

Quite straighforward. This is generic code from some sandbox experiments. ExcludeFromCodeCoverage seems to be working properly for synchronhous methods. No runsettings or any configuration related to the coverage are in place.

[ExcludeFromCodeCoverage] // Still included in coverage report.
private async Task ExecuteRetryable(Func<Task> function)
{
    try
    {
        await retryPolicyAsync.ExecuteAsync(function);
    }
    catch (Exception exception)
    {
        LogException(exception);
    }
}

[ExcludeFromCodeCoverage] // Not included in coverage report as expected.
private void LogException(Exception exception)
{
    if (TelemetryClient == null)
        return;

    var telemetry = new ExceptionTelemetry(exception);
    telemetry.Properties.Add("typeCode", "ExceptionFromTheSandbox");
    TelemetryClient.TrackException(telemetry);
    }
}

Could this be a bug or am I missing something?

Yeray Cabello
  • 411
  • 3
  • 12

0 Answers0