Skip to content

[PR-Reviewer] Add null safety check to Android inset dispatch fix and correct test naming#19

Draft
Copilot wants to merge 4 commits intomainfrom
copilot/review-maui-pull-request-32537
Draft

[PR-Reviewer] Add null safety check to Android inset dispatch fix and correct test naming#19
Copilot wants to merge 4 commits intomainfrom
copilot/review-maui-pull-request-32537

Conversation

Copy link
Copy Markdown

Copilot AI commented Nov 16, 2025

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 of Change

This PR addresses two issues found during review of PR dotnet#32537:

1. Critical Null Safety Issue

The ViewGroupCompat.InstallCompatInsetsDispatch(_rootView) call in NavigationRootManager.cs can throw NullReferenceException when the IFlyoutView code path doesn't set _rootView. Specifically:

if (view is IFlyoutView)
{
    var containerView = view.ToContainerView(mauiContext);
    // Neither condition sets _rootView if containerView.MainView is not DrawerLayout
    if (containerView is DrawerLayout dl) { _rootView = dl; }
    else if (containerView is ContainerView cv && cv.MainView is DrawerLayout dlc) { _rootView = cv; }
    // _rootView remains null here in edge case
}

if(!OperatingSystem.IsAndroidVersionAtLeast(30))
{
    ViewGroupCompat.InstallCompatInsetsDispatch(_rootView);  // NullReferenceException
}

Fix: Add null check before calling the method.

2. Test Naming Mismatch

Test files are named Issue32278.* but PR dotnet#32537 fixes issue dotnet#32526. Issue dotnet#32278 is a different, already-merged PR about WindowInsetListener refactoring.

Fix: Rename all test files from Issue32278 to Issue32526 and update internal references.

Changes Made

  • NavigationRootManager.cs: Add && _rootView is not null null safety check
  • Test files: Rename Issue32278.*Issue32526.* and update class names, attributes, and references

Issues Fixed

Fixes critical null safety bug in dotnet#32537
Fixes test naming mismatch in dotnet#32537

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/dotnet/maui/pulls/32537/comments
    • Triggering command: curl -s -H Accept: application/vnd.github.v3+json REDACTED (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

please review dotnet#32537

Custom agent used: pr-reviewer
Specialized agent for conducting thorough, constructive code reviews of .NET MAUI pull requests


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

rmarinho and others added 3 commits November 17, 2025 00:12
### Description of Change

These integration tests are failing

```
Failed to boot simulator with UDID '\u001b[41m\u001b[30mfail\u001b[39m\u001b[22m\u001b[49m: Microsoft.DotNet.XHarness.Common.CLI.NoDeviceFoundException: Failed to find/create suitable simulator
---> Microsoft.DotNet.XHarness.Common.CLI.NoDeviceFoundException: Could not create device
runtime: com.apple.CoreSimulator.SimRuntime.iOS-18-0
device type: com.apple.CoreSimulator.SimDeviceType.iPhone-XS
at Microsoft.DotNet.XHarness.iOS.Shared.Hardware.SimulatorLoader.FindOrCreateDevicesAsync(ILog log, String runtime, String devicetype, Boolean force, CancellationToken cancellationToken) in //src/Microsoft.DotNet.XHarness.iOS.Shared/Hardware/SimulatorLoader.cs:line 232
at Microsoft.DotNet.XHarness.iOS.Shared.Hardware.SimulatorLoader.FindSimulators(TestTargetOs target, ILog log, Boolean createIfNeeded, Boolean minVersion, CancellationToken cancellationToken) in //src/Microsoft.DotNet.XHarness.iOS.Shared/Hardware/SimulatorLoader.cs:line 412
at Microsoft.DotNet.XHarness.iOS.Shared.Hardware.SimulatorLoader.FindSimulators(TestTargetOs target, ILog log, Int32 retryCount, Boolean createIfNeeded, Boolean minVersion, CancellationToken cancellationToken) in //src/Microsoft.DotNet.XHarness.iOS.Shared/Hardware/SimulatorLoader.cs:line 517
--- End of inner exception stack trace ---
at Microsoft.DotNet.XHarness.iOS.Shared.Hardware.SimulatorLoader.FindSimulators(TestTargetOs target, ILog log, Int32 retryCount, Boolean createIfNeeded, Boolean minVersion, CancellationToken cancellationToken) in //src/Microsoft.DotNet.XHarness.iOS.Shared/Hardware/SimulatorLoader.cs:line 525
at Microsoft.DotNet.XHarness.Apple.DeviceFinder.FindDevice(TestTargetOs target, String deviceName, ILog log, Boolean includeWirelessDevices, Boolean pairedDevicesOnly, CancellationToken cancellationToken) in //src/Microsoft.DotNet.XHarness.Apple/DeviceFinder.cs:line 60
at Microsoft.DotNet.XHarness.CLI.Commands.Apple.AppleDeviceCommand.Invoke(ILogger logger) in //src/Microsoft.DotNet.XHarness.CLI/Commands/Apple/AppleDeviceCommand.cs:line 59'.
Expected: True
But was:  False
```

Co-Authored-By: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-Authored-By: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
Co-Authored-By: Rui Marinho <me@ruimarinho.net>
Condensed and reorganized .github/agents/pr-reviewer.md to reference new modular instruction files for PR review workflow. Added core guidelines and supporting documents under .github/instructions/pr-reviewer-agent/ for time management, edge cases, error handling, output format, safe area testing, sandbox setup, and testing procedures. This improves maintainability and clarity for PR reviewer agent processes.
Co-authored-by: kubaflo <42434498+kubaflo@users.noreply.github.com>
Copilot AI changed the title [WIP] Review changes in Maui pull request 32537 [PR-Reviewer] Add null safety check to Android inset dispatch fix and correct test naming Nov 16, 2025
Copilot AI requested a review from kubaflo November 16, 2025 23:42
@kubaflo kubaflo force-pushed the main branch 4 times, most recently from 790e973 to 971e326 Compare November 22, 2025 14:01
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