Ferrous API Reference

All Types / Ferrous.Concurrency.Analyzers

class ConcurrencyAnalyzer

public sealed class ConcurrencyAnalyzer : DiagnosticAnalyzer

Roslyn analyzer enforcing Rust-inspired concurrency safety: FE0500: Thread-confined (!Send) value captured across a thread boundary. FE0501: Unsynchronized mutable static field (static mut).

Fields

public static readonly DiagnosticDescriptor ThreadConfinedCaptureRule = new(
        id: "FE0500",
        title: "Thread-confined value captured across thread boundary",
        messageFormat: "cannot send thread-confined value '{0}' of type '{1}' across thread boundary '{2}'; help: wrap it in 'Mutex<T>' / 'AsyncMutex<T>', use a thread-safe collection, or copy immutable data before dispatching",
        category: "Concurrency",
        defaultSeverity: DiagnosticSeverity.Warning,
        isEnabledByDefault: true,
        helpLinkUri: HelpUri)

FE0500: Thread-confined value captured across a thread boundary.

public static readonly DiagnosticDescriptor MutableStaticFieldRule = new(
        id: "FE0501",
        title: "Mutable static field is not thread-safe",
        messageFormat: "mutable static field '{0}' of type '{1}' is not thread-safe; help: make it 'readonly' with an immutable type, wrap it in 'Mutex<T>' / 'Concurrent*', or mark it '[ThreadStatic]'",
        category: "Concurrency",
        defaultSeverity: DiagnosticSeverity.Warning,
        isEnabledByDefault: true,
        helpLinkUri: HelpUri)

FE0501: Unsynchronized mutable static field.

Properties

public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics

Methods

public override void Initialize(AnalysisContext context)