Skip to main content
Source: Al0108RedundantNoTraceAnalyzer.cs

Description

[NoTrace] excludes a method from automatic span creation when the class has [Traced]. Without [Traced] on the class or any base class, [NoTrace] is redundant.

Bad Code

// No [Traced] on class — [NoTrace] is redundant
public class OrderService
{
    [NoTrace]
    public void HelperMethod() { }
}

Good Code

[Traced("MyApp")]
public class OrderService
{
    [NoTrace]  // Meaningful: excludes this method from tracing
    public void HelperMethod() { }
}

Properties

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

Configuration

dotnet_diagnostic.AL0108.severity = suggestion