The Microsoft.Android.Build.BaseTasks project does not enable nullable reference types (no <Nullable>enable</Nullable> in the .csproj and no per-file #nullable enable directives). This means the compiler cannot catch null dereference bugs at compile time — for example, the bug fixed in #342 where an as cast was dereferenced without a null check.
Proposed work
- Add
<Nullable>enable</Nullable> to Microsoft.Android.Build.BaseTasks.csproj (or add per-file #nullable enable incrementally).
- Resolve all resulting warnings — annotate parameters/returns with
? where null is valid, add guards where it isn't.
- Enable
<WarningsAsErrors>nullable</WarningsAsErrors>
- Verify build and tests pass clean.
Context
Adding #nullable enable to just Files.cs produces ~12 warnings (CS8600, CS8603, CS8625) across the file, so this should be done as a dedicated cleanup pass rather than piecemeal.
The
Microsoft.Android.Build.BaseTasksproject does not enable nullable reference types (no<Nullable>enable</Nullable>in the.csprojand no per-file#nullable enabledirectives). This means the compiler cannot catch null dereference bugs at compile time — for example, the bug fixed in #342 where anascast was dereferenced without a null check.Proposed work
<Nullable>enable</Nullable>toMicrosoft.Android.Build.BaseTasks.csproj(or add per-file#nullable enableincrementally).?where null is valid, add guards where it isn't.<WarningsAsErrors>nullable</WarningsAsErrors>Context
Adding
#nullable enableto justFiles.csproduces ~12 warnings (CS8600, CS8603, CS8625) across the file, so this should be done as a dedicated cleanup pass rather than piecemeal.