非常直截了当。这是一些沙盒实验的通用代码。 ExcludeFromCodeCoverage似乎适用于同步方法。没有任何runsettings或任何与覆盖相关的配置。
[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);
}
}
这可能是一个错误,还是我错过了什么?