Skip to content

Enable nullable reference types in DetectIfAppWasUninstalled.cs#11599

Merged
jonathanpeppers merged 2 commits into
mainfrom
copilot/fix-finder-enable-nullable-reference-types
Jun 8, 2026
Merged

Enable nullable reference types in DetectIfAppWasUninstalled.cs#11599
jonathanpeppers merged 2 commits into
mainfrom
copilot/fix-finder-enable-nullable-reference-types

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jun 8, 2026

Enable #nullable enable in DetectIfAppWasUninstalled.cs and apply standard nullable conventions.

  • Non-required properties (AdbTarget, UserID) → string?
  • [Required] properties (PackageName, UploadFlagFile) → string with = "" default
  • QueryPackages return type → Task<List<AndroidInstalledPackage>?> (returns null in catch)

Project targets netstandard2.0, so no ArgumentNullException.ThrowIfNull usage.

Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
Copilot AI changed the title [WIP] Enable nullable reference types in DetectIfAppWasUninstalled Enable nullable reference types in DetectIfAppWasUninstalled.cs Jun 8, 2026
Copilot AI requested a review from jonathanpeppers June 8, 2026 02:55
@jonathanpeppers jonathanpeppers marked this pull request as ready for review June 8, 2026 15:48
Copilot AI review requested due to automatic review settings June 8, 2026 15:48
@jonathanpeppers jonathanpeppers merged commit 4d3c25e into main Jun 8, 2026
3 of 4 checks passed
@jonathanpeppers jonathanpeppers deleted the copilot/fix-finder-enable-nullable-reference-types branch June 8, 2026 15:49
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 enables nullable reference types in DetectIfAppWasUninstalled.cs (a debugging MSBuild task) and updates task properties/method signatures to follow the repo’s nullable conventions for netstandard2.0.

Changes:

  • Added #nullable enable to opt the file into nullable analysis.
  • Updated task properties: non-required inputs (AdbTarget, UserID) to string?, and [Required] inputs (PackageName, UploadFlagFile) to non-nullable string with = "" defaults.
  • Adjusted QueryPackages signature to return a nullable list (currently Task<List<AndroidInstalledPackage>?>).
Comments suppressed due to low confidence (1)

src/Xamarin.Android.Build.Debugging.Tasks/Tasks/DetectIfAppWasUninstalled.cs:65

  • ❌ Changing QueryPackages to return Task<List<AndroidInstalledPackage>?> breaks the registered task object type: WaitForAppDetection retrieves it as Task<List<AndroidInstalledPackage>> (see WaitForAppDetection.cs:16-21), so the lookup can fail due to the generic type mismatch and the wait will be skipped. Also, in nullable context User = UserID will produce a nullability warning because PmListPackagesCommand.User is a non-nullable string. Keep the return type non-nullable, coalesce UserID to "", and return an empty list on failure instead of null.
		async System.Threading.Tasks.Task<List<AndroidInstalledPackage>?> QueryPackages (AndroidDevice device, string uploadFlagFileFullPath)
		{
			// DO NOT use the Log.XXXX methods in this method.
			// Because this is running on a background thread they will
			// end up locking the UI in VS.

Comment on lines +26 to 28
public string? UserID { get; set; }

public CancellationToken Token { get { return tcs.Token; } }
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.

[fix-finder] Enable nullable reference types in DetectIfAppWasUninstalled.cs

3 participants