Skip to main content
Source: AL0052AotSafeCallsAotUnsafeAnalyzer.cs

Description

Code marked with [AotSafe] guarantees it will work correctly in AOT-compiled applications. Calling methods marked with [AotUnsafe] violates this guarantee because [AotUnsafe] code explicitly declares it requires JIT compilation. This analyzer complements AL0044 which checks for [RequiresDynamicCode] calls. While AL0044 catches BCL-annotated unsafe methods, this analyzer catches user-defined unsafe code marked with [AotUnsafe].

Bad Code

Good Code

Properties

  • Category: AOT Testing
  • Severity: Error
  • Enabled by default: True
  • Code fix available: False

Configuration

See Also