Migrating a Codebase to NRT
Apply a phased migration strategy: enable warnings, annotate APIs, fix issues, and avoid false-positives.
The Migration Challenge
Enabling NRT on an existing codebase typically produces hundreds of warnings. A big-bang approach is risky. Instead, use a phased migration: enable warnings incrementally, fix them file by file, and never lose momentum.
Step 1: Enable Warnings Only
Start with <Nullable>warnings</Nullable> instead of enable. This activates warnings without treating non-annotated code as errors — a safe starting point.
<!-- Phase 1: warnings only, no breaking change -->
<PropertyGroup>
<Nullable>warnings</Nullable>
</PropertyGroup>
<!-- Phase 2: full enable per file as you migrate -->
<!-- Phase 3: switch to enable globally when done -->