Skip to main content
Source: Al0101AvoidActivatorCreateInstanceAnalyzer.cs

Description

Activator.CreateInstance() relies on reflection to create instances, which is not compatible with Native AOT trimming. Use direct construction or factory patterns.

Bad Code

Good Code

Properties

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

Configuration