Skip to content

Conversation

jonathanpeppers
Copy link
Member

Introduces the setting to Xamarin.Android.Build.Tasks.csproj:

<WarningsAsErrors>Nullable</WarningsAsErrors>

Then I fixed the existing warnings. Down the road this will make it easier to adopt #enable nullable, and eventually Nullable=enable the entire project. Trying to do that now results in 1,000+ warnings...

Most of these are types that could easily be null, and they weren't marked as nullable with ?. Luckily, the code appears to be checking for null in these places already.

Introduces the setting to `Xamarin.Android.Build.Tasks.csproj`:

    <WarningsAsErrors>Nullable</WarningsAsErrors>

Then I fixed the existing warnings. Down the road this will make it
easier to adopt `#enable nullable`, and eventually `Nullable=enable`
the entire project. Trying to do that now results in 1,000+ warnings...

Most of these are types that could easily be null, and they weren't
marked as nullable with `?`. Luckily, the code appears to be checking
for null in these places already.
@jonathanpeppers jonathanpeppers marked this pull request as ready for review November 4, 2024 16:21
@jpobst
Copy link
Contributor

jpobst commented Nov 19, 2024

As a further future step, we should also multitarget to net9.0 (even if only locally) and fix those warnings, as the netstandard2.0 BCL isn't fully annotated with nullable annotations.

@dellis1972
Copy link
Contributor

As a further future step, we should also multitarget to net9.0 (even if only locally) and fix those warnings, as the netstandard2.0 BCL isn't fully annotated with nullable annotations.

maybe upgrading to netstandard2.1 might be better?

@jonathanpeppers
Copy link
Member Author

The two test failures we can ignore:

image

image

@jonathanpeppers jonathanpeppers merged commit a1fab8b into main Nov 19, 2024
55 of 58 checks passed
@jonathanpeppers jonathanpeppers deleted the dev/peppers/nrt/warningsaserrors branch November 19, 2024 18:57
@github-actions github-actions bot locked and limited conversation to collaborators Dec 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants