Skip to main content
Source: Al0110TracedTagOnOutRefParameterAnalyzer.cs

Description

[TracedTag] captures the parameter value as a span attribute at call time. For out and ref parameters, the value is not available until after the method executes, making the tag capture meaningless or incorrect.

Bad Code

[Traced("MyApp")]
public bool TryParse(string input, [TracedTag] out int result)
{
    result = 0;
    return true;
}

Good Code

[Traced("MyApp")]
public bool TryParse([TracedTag] string input, out int result)
{
    result = 0;
    return true;
}

Properties

  • Category: OpenTelemetry
  • Severity: Error
  • Enabled by default: True
  • Code fix available: True

Configuration

dotnet_diagnostic.AL0110.severity = error