Skip to content

[Mono.Android.Export] Enable nullable reference types and remove MONOTOUCH guard in CodeWhen.cs#11695

Open
Copilot wants to merge 3 commits into
mainfrom
copilot/fix-finder-enable-nrt-codewhen
Open

[Mono.Android.Export] Enable nullable reference types and remove MONOTOUCH guard in CodeWhen.cs#11695
Copilot wants to merge 3 commits into
mainfrom
copilot/fix-finder-enable-nrt-codewhen

Conversation

Copilot AI commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

CodeWhen.cs ships in Mono.Android.Export.dll but was compiled in a nullable-oblivious context, getting no compile-time null-safety checks. The class is already null-correct, making it a low-risk opt-in candidate.

Changes

  • Added #nullable enable to src/Mono.Android.Export/Mono.CodeGeneration/CodeWhen.cs.
  • Removed the legacy #if !MONOTOUCH / #endif wrapper around the file so the nullable context is applied unconditionally.
#nullable enable

using System;

Directive/preprocessor-only change — no logic modifications. All three reference-type fields (condition, trueBlock, falseBlock) are unconditionally assigned in the single constructor, and methods dereference only non-null fields/parameters, so no nullable warnings are produced and no ! null-forgiving operator was needed.

Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
Copilot AI changed the title [WIP] Enable nullable reference types in CodeWhen.cs [Mono.Android.Export] Enable nullable reference types in CodeWhen.cs Jun 18, 2026
Copilot AI requested a review from jonathanpeppers June 18, 2026 03:05
@jonathanpeppers jonathanpeppers marked this pull request as ready for review June 18, 2026 20:21
Copilot AI review requested due to automatic review settings June 18, 2026 20:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Enables nullable reference types for CodeWhen.cs in Mono.Android.Export so the file participates in compile-time null-safety analysis without changing runtime behavior.

Changes:

  • Added #nullable enable inside the existing #if !MONOTOUCH guard at the top of src/Mono.Android.Export/Mono.CodeGeneration/CodeWhen.cs.

@@ -22,6 +22,8 @@
//

#if !MONOTOUCH

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot can we remove the stupid #if !MONOTOUCH as well?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in d5a3641 — I removed the #if !MONOTOUCH / #endif wrapper from CodeWhen.cs and kept #nullable enable in place.

Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
Copilot AI changed the title [Mono.Android.Export] Enable nullable reference types in CodeWhen.cs [Mono.Android.Export] Enable nullable reference types and remove MONOTOUCH guard in CodeWhen.cs Jun 18, 2026
Copilot AI requested a review from jonathanpeppers June 18, 2026 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants