Skip to content

Enable nullable reference types in AndroidDiskInformation.cs#11813

Merged
simonrozsival merged 2 commits into
mainfrom
copilot/fix-finder-enable-nullable-reference-types-again
Jun 30, 2026
Merged

Enable nullable reference types in AndroidDiskInformation.cs#11813
simonrozsival merged 2 commits into
mainfrom
copilot/fix-finder-enable-nullable-reference-types-again

Conversation

Copilot AI commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

src/Mono.AndroidTools/AndroidDiskInformation.cs ships in the signed Mono.AndroidTools assembly but was nullable-oblivious. This opts the file into nullable reference types for compile-time null-safety with no runtime or API change.

Changes

  • Added #nullable enable to the top of the file.
  • Changed the s locals in ParseNewFormat and ParseOldFormat from string to string?, matching StringReader.ReadLine()'s string? return. Flow analysis already narrows s to non-null inside the while ((s = reader.ReadLine ()) != null) bodies.
string? s;
var reader = new StringReader (output);
while ((s = reader.ReadLine ()) != null) {
    // s is non-null here
}

Annotation-only: no ! operator, no ArgumentNullException.ThrowIfNull (the project targets netstandard2.0), and public signatures (FromDfOutput, InternalSpace, ExternalSpace) are unchanged.

Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
Copilot AI changed the title [WIP] Enable nullable reference types in AndroidDiskInformation.cs Enable nullable reference types in AndroidDiskInformation.cs Jun 30, 2026
Copilot AI requested a review from jonathanpeppers June 30, 2026 03:06
@simonrozsival simonrozsival marked this pull request as ready for review June 30, 2026 07:35
Copilot AI review requested due to automatic review settings June 30, 2026 07:35

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

This PR opts AndroidDiskInformation.cs into nullable reference types to improve compile-time null safety in the signed Mono.AndroidTools assembly, without changing runtime behavior.

Changes:

  • Enabled nullable annotations via #nullable enable.
  • Updated local variables that receive StringReader.ReadLine() results from string to string? in the parsing helpers.
Show a summary per file
File Description
src/Mono.AndroidTools/AndroidDiskInformation.cs Enables NRT and aligns ReadLine() locals with string? to avoid nullable warnings and improve flow analysis.

Copilot's findings

  • Files reviewed: 1/1 changed files
  • Comments generated: 1

Comment thread src/Mono.AndroidTools/AndroidDiskInformation.cs
@simonrozsival simonrozsival enabled auto-merge (squash) June 30, 2026 10:23
@simonrozsival simonrozsival merged commit ece14c8 into main Jun 30, 2026
41 checks passed
@simonrozsival simonrozsival deleted the copilot/fix-finder-enable-nullable-reference-types-again branch June 30, 2026 13:00
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.

5 participants