Skip to content
This repository was archived by the owner on Jul 13, 2026. It is now read-only.
This repository was archived by the owner on Jul 13, 2026. It is now read-only.

Enable nullable reference types in Microsoft.Android.Build.BaseTasks #343

Description

@jonathanpeppers

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

  1. Add <Nullable>enable</Nullable> to Microsoft.Android.Build.BaseTasks.csproj (or add per-file #nullable enable incrementally).
  2. Resolve all resulting warnings — annotate parameters/returns with ? where null is valid, add guards where it isn't.
  3. Enable <WarningsAsErrors>nullable</WarningsAsErrors>
  4. 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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions