Fix CS8632: remove nullable annotations from #nullable disable context in Element.cs#34751
Merged
StephaneDelcroix merged 1 commit intonet11.0from Mar 31, 2026
Merged
Conversation
Remove '?' from ElementEventArgs parameters in OnDescendantAddedCore and OnDescendantRemovedCore. The file has '#nullable disable' at the top, so nullable reference type annotations are invalid and cause CS8632 warnings which become errors when TreatWarningsAsErrors=true (e.g. in dotnet/android CI). Introduced in #34134. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 34751Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 34751" |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR removes nullable reference type annotations (?) from local-function parameters in Element.cs, which is compiled under #nullable disable, to avoid CS8632 warnings in consumers that treat warnings as errors.
Changes:
- Update
OnDescendantAddedCoreto takeElementEventArgsinstead ofElementEventArgs?. - Update
OnDescendantRemovedCoreto takeElementEventArgsinstead ofElementEventArgs?.
StephaneDelcroix
approved these changes
Mar 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!
Description
Removes
?nullable annotations fromElementEventArgsparameters inOnDescendantAddedCoreandOnDescendantRemovedCoreinElement.cs.The file starts with
#nullable disable, so nullable reference type annotations are invalid and produce CS8632 warnings. MAUI CI setsTreatWarningsAsErrors=falseso these pass silently, but downstream consumers like dotnet/android build withTreatWarningsAsErrors=true, causing build failures.Introduced in #34134.
Fix
Simply remove the
?from theElementEventArgsparameter types. Under#nullable disable, reference types are already implicitly nullable, so the behavior is unchanged.