Skip to content

[leak-scan] Fix: DependencyResolver.ResolveUsing — process-global resolver strongly retains its delegate target - #38289

Merged
kubaflo merged 17 commits into
dotnet:net11.0from
SubhikshaSf4851:Fix-37827
Sep 9, 2026
Merged

kubaflo merged 17 commits into
dotnet:net11.0from
SubhikshaSf4851:Fix-37827

Conversation

@SubhikshaSf4851

Copy link
Copy Markdown
Contributor

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 whether this change resolves your issue. Thank you!

This pull request introduces a new method to the DependencyResolver class to allow clearing the registered resolver, and adds comprehensive unit tests to verify memory management and prevent memory leaks. The main focus is to ensure that any objects captured by the resolver can be released when no longer needed, improving memory safety.

Description of Change

DependencyResolver API and Implementation:

  • Added a new static method ResetResolver() to DependencyResolver, which clears the currently registered resolver and releases any references it holds.
  • Exposed the new ResetResolver() method in the public API files for all supported platforms (net, netstandard, net-android, net-ios, net-maccatalyst, net-tizen, net-windows). [1] [2] [3] [4]

Testing and Validation:

  • Added a new test class DependencyResolverMemoryLeak with multiple test cases to ensure that the resolver does not cause memory leaks, and that ResetResolver() correctly releases captured targets. The tests use weak references and forced garbage collection to verify object lifetimes.

Issues Fixed

Fixes #37827

Tested the behavior in the following platforms

  • Windows
  • Android
  • iOS
  • Mac
Before Issue Fix After Issue Fix
BeforeFix37827.mov
Screen.Recording.2026-09-07.at.20.00.24.mov

dotnet-maestro Bot and others added 13 commits August 31, 2026 15:22
This pull request updates the following dependencies

[marker]: <> (Begin:a71c12d9-5aa4-4b46-e2d6-08da0cf8cd95)
## From https://github.com/dotnet/xharness
- **Subscription**:
[a71c12d9-5aa4-4b46-e2d6-08da0cf8cd95](https://maestro.dot.net/subscriptions?search=a71c12d9-5aa4-4b46-e2d6-08da0cf8cd95)
- **Build**:
[20260828.1](https://dev.azure.com/dnceng/internal/_build/results?buildId=3060005)
([329158](https://maestro.dot.net/channel/2/github:dotnet:xharness/build/329158))
- **Date Produced**: August 28, 2026 2:17:22 PM UTC
- **Commit**:
[b355c0507b19670c2d386677d7f99260f07cefa5](dotnet/xharness@b355c05)
- **Branch**: [main](https://github.com/dotnet/xharness/tree/main)

[DependencyUpdate]: <> (Begin)

- **Dependency Updates**:
  - From [11.0.0-prerelease.26419.1 to 11.0.0-prerelease.26428.1][1]
     - Microsoft.DotNet.XHarness.CLI
     - Microsoft.DotNet.XHarness.TestRunners.Common
     - Microsoft.DotNet.XHarness.TestRunners.Xunit

[1]: dotnet/xharness@8dd9b8e...b355c05

[DependencyUpdate]: <> (End)


[marker]: <> (End:a71c12d9-5aa4-4b46-e2d6-08da0cf8cd95)

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
<!-- Please let the below note in for people that find this PR -->
> [!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](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

### Root Cause

The dedicated `ListView` test bucket still included unit tests, device
tests, issue-based UI tests, HostApp fixtures, and pipeline entries even
though some of the remaining UI scenarios are really covering other
features such as context actions, visibility, refresh, shadow, cells,
custom renderers, images, and progress bars.

### Description of Change

- removed the dedicated `ListView` unit test file and
`Controls.DeviceTests/Elements/ListView` coverage
- removed dedicated `UITestCategories.ListView` issue tests plus their
unreferenced HostApp fixtures and snapshot baselines
- reclassified non-ListView-primary UI tests into their actual
categories instead of deleting them
- removed the `ListView` UI-test pipeline bucket and the now-unused
`UITestCategories.ListView` / `TestCategory.ListView` constants
- removed the stale iOS and Mac Catalyst `Issue5503` app-delegate hook
that became unreferenced once that HostApp page was deleted

### Key Technical Details

Retained UI coverage was reclassified to these categories:
- `ContextActions`
- `IsEnabled`
- `CustomRenderers`
- `Image`
- `ProgressBar`
- `ToolbarItem`
- `Shadow`
- `IsVisible`
- `RefreshView`
- `Cells`

### Issues Fixed

N/A

### Validation

- `dotnet test
src/Controls/tests/Core.UnitTests/Controls.Core.UnitTests.csproj`
- hits an existing locale-sensitive failure in
`BindingUnitTests.TwoWayBindingToNullableDoublePropertyWithEmptyStringBecomesNull`
(`3.14` vs `3,14`)
- `dotnet test
src/Controls/tests/Core.UnitTests/Controls.Core.UnitTests.csproj
--no-restore --filter
"FullyQualifiedName!=Microsoft.Maui.Controls.Core.UnitTests.BindingUnitTests.TwoWayBindingToNullableDoublePropertyWithEmptyStringBecomesNull"`
- `dotnet build Microsoft.Maui.BuildTasks.slnf`
- `dotnet build
src/Controls/tests/DeviceTests/Controls.DeviceTests.csproj -f
net11.0-ios -p:BuildIpa=false -p:RuntimeIdentifier=iossimulator-arm64`
- `dotnet build
src/Controls/tests/DeviceTests/Controls.DeviceTests.csproj -f
net11.0-maccatalyst -p:RuntimeIdentifier=maccatalyst-arm64`
- `dotnet build
src/Controls/tests/TestCases.Android.Tests/Controls.TestCases.Android.Tests.csproj`
- `dotnet build
src/Controls/tests/TestCases.iOS.Tests/Controls.TestCases.iOS.Tests.csproj`
- `dotnet build
src/Controls/tests/TestCases.Mac.Tests/Controls.TestCases.Mac.Tests.csproj`
- `dotnet build
src/Controls/tests/TestCases.WinUI.Tests/Controls.TestCases.WinUI.Tests.csproj
-p:EnableWindowsTargeting=true`
- `dotnet build
src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj
-f net11.0-ios -p:BuildIpa=false
-p:RuntimeIdentifier=iossimulator-arm64`
- `dotnet build
src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj
-f net11.0-maccatalyst -p:RuntimeIdentifier=maccatalyst-arm64`
- `python3` + `yaml.safe_load` parse of
`eng/pipelines/common/ui-tests.yml`
…assOnAncestors failure on Mac (dotnet#38109)

### Root cause
App.WaitForElement("Stats") only waited for the existing element, not
for its asynchronously updated text. CI could therefore read stale
initialization/layout-pass values such as Lvl1[1/1], causing a flaky
failure.
 
### Description of change
Replaced the immediate text read with WaitForTextToBePresentInElement,
which polls for Lvl1[0/0] for up to 15 seconds before asserting success.
This allows the asynchronous counter reset and UI update to complete.



<!-- Enter description of the fix in this section -->

### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Fixes dotnet#36051
Updated [Magick.NET-Q8-AnyCPU](https://github.com/dlemstra/Magick.NET)
from 14.14.0 to 14.15.0.

<details>
<summary>Release notes</summary>

_Sourced from [Magick.NET-Q8-AnyCPU's
releases](https://github.com/dlemstra/Magick.NET/releases)._

## 14.15.0

### What's Changed
- Add `PingAsync` to `MagickImage` and `MagickImageCollection` (#​2032).
- Added `ImportIndexedPixels` to `MagickImage` (#​2040)

### Related changes in ImageMagick since the last release of Magick.NET:
- Stack Overflow in MVG decoder due to missing depth check
(GHSA-mx48-2qq3-23hf)
- Heap Buffer Overflow in ImageMagick MVG decoder (GHSA-wx47-rm3x-jx6p)
- Policy Bypass due to an incomplete fix of CVE-2026-49219
(GHSA-56m6-8q75-f2rw)
- Infinite Loop in connected-components when providing invalid arguments
(GHSA-qhmf-7fc4-8q3h)
- Heap Buffer Over-Write in JP2 encoder when due to incorrect handling
of arguments (GHSA-c4v7-w88g-m6c4)
- Policy Bypass in concatenate operation due to missing checks
(GHSA-82mp-vp5c-9pf7)
- Use-After-Free in crafted 8BIM when identifying an image
(GHSA-ff5c-8x9r-8qcw)
- Information Disclosure in MNG decoder because allocated memory is left
unchanged (GHSA-8g53-9m3c-69xg)
- Heap Buffer Over-Read in XCF decoder due to integer conversion
overflow (GHSA-pjxj-pchx-4c3m)
- Heap Buffer Over-Write in morphology operation when an invalid kernel
is provided (GHSA-f5m7-cqgw-8hm7)
- Heap Buffer Over-Read in BGR decoder due to mising end-of-file check
(GHSA-7rgw-xg25-prjm)
- Heap Buffer Over-Write in fx operation (GHSA-422r-8c97-xcg4)
- Integer Overflow in JNX decoder causes heap buffer over-write when
processing extremely large files on 32-bit builds (GHSA-h22j-f9xw-xjjm)

### Library updates:
- ImageMagick 7.1.2-27 (2026-07-05)
- libde265 1.1.1 (2026-06-03)
- openexr 3.4.13 (2026-06-19)
- libffi 3.6.0 (2026-06-20)
- fontconfig 2.18.1 (2026-06-02)
- gdk-pixbuf 2.44.7 (2026-06-27)
- harfbuzz 14.2.1 (2026-06-02)
- libheif 1.23.1 (2026-06-26)
- libjxl 0.12.0 (2026-07-01)
- openjph 0.30.1 (2026-06-22)
- libtiff 4.7.2 (2026-06-26)

**Full Changelog**:
dlemstra/Magick.NET@14.14.0...14.15.0

Commits viewable in [compare
view](dlemstra/Magick.NET@14.14.0...14.15.0).
</details>

[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=Magick.NET-Q8-AnyCPU&package-manager=nuget&previous-version=14.14.0&new-version=14.15.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts page](https://github.com/dotnet/maui/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
<!-- Please let the below note in for people that find this PR -->
> [!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](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

### Root Cause

PR dotnet#37995 was opened from a branch containing the `net11.0` branch
history. Although the PR targeted `main`, GitHub squashed all 100
commits in that branch into the merge commit, introducing changes across
3,272 files.

### Description of Change

- reverts the accidental `net11.0` payload from dotnet#37995
- preserves the intended dedicated ListView test cleanup from commit
`86ca3e5655`
- preserves legitimate `main` changes merged after dotnet#37995

### Validation

- compared the corrected tree with the parent of dotnet#37995; its 242 changed
paths exactly match the intended ListView cleanup plus the two
subsequent legitimate `main` commits
- confirmed no remaining `UITestCategories.ListView` or
`TestCategory.ListView` references
- parsed `eng/pipelines/common/ui-tests.yml` successfully

Copilot-Session: 3391bd85-62d2-4de0-84c7-5952156ea5bb
<!-- Please let the below note in for people that find this PR -->
> [!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](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

### Description of Change

Generalizes the existing Darc-based official release pipeline so it can
publish shipping NuGet packages from allowlisted non-workload
repositories, initially `dotnet/android-libraries`, while preserving the
existing MAUI workload-release path.

- Keeps the existing free-text repository and commit inputs.
- Infers workload behavior for `dotnet/android`, `dotnet/macios`, and
`dotnet/maui`.
- Preserves the existing first-match BAR resolution behavior for all
repositories, then validates the resolved repository and gathers using
the dynamically returned BAR build ID.
- Keeps workload gathering, workload-set promotion, pack-before-manifest
ordering, approvals, and publishing behavior isolated from the
non-workload path.
- Gathers only shipping NuGet assets and rejects malformed packages,
duplicate filenames, duplicate ID/version identities, unexpected
packages, and workload manifests on non-workload releases.
- Supports include/exclude package filters for both workload and
non-workload releases.
- Filters exact ID/version pairs already on NuGet.org during preparation
and again immediately before publishing, preventing reruns and packages
published between those phases from causing HTTP 409 conflicts.
- Supports repeating the same non-workload BAR release after partial
publication: Darc may no longer download assets whose BAR location moved
to NuGet.org, so missing selected assets are accepted only when their
exact identity is confirmed on NuGet.org. Other missing or unavailable
packages fail closed.
- Publishes the exact selected and staged package lists as the
`NuGetReleaseAudit` artifact before manual approval.
- Uses the existing `1ES.PublishNuget@1` task and `nuget.org
(dotnetframework)` service connection, then verifies every expected
package on NuGet.org.
- Supports a non-mutating dry run with `pushPackages: false`.

### Dry-run inputs

```yaml
ghOwner: dotnet
ghRepo: android-libraries
commitHash: <ANDROID_LIBRARIES_COMMIT_WITH_BAR_BUILD>
pushWorkloadSet: false
pushNugetOrg: true
pushPackages: false
```

Queue `dotnet-maui-release` against this PR branch after it appears in
the internal `dotnet-maui` mirror. The run performs BAR resolution,
gathering, package validation/filtering, and audit artifact publication
without promotion or NuGet publishing.

### External setup

Before enabling a real push, release owners must verify that the
existing `nuget.org (dotnetframework)` service connection owns every
package ID in the audit artifact and has sufficient scope/quota.
Android-libraries BAR builds contain per-build deltas rather than the
union of channel assets, so each pending BAR build must be released in
commit order.

### Validation

- [Successful `dotnet/android-libraries` NuGet.org release
run](https://dev.azure.com/dnceng/internal/_build/results?buildId=3063121&view=results):
BAR resolution, gathering, filtering, audit publication, package push,
and NuGet.org verification all succeeded.
- The overall build is `partiallySucceeded` only because 1ES production
branch/source validation reported non-blocking errors for running the
test from this PR branch instead of an approved production branch.
- Focused release pipeline and NuGet availability Pester suites.
- YAML parsing and whitespace validation.

### Issues Fixed

N/A

---------

Copilot-Session: 2933e733-3bed-4524-ae14-f7ad1c7959e6
<!-- Please let the below note in for people that find this PR -->
> [!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](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

## Summary

The main scanner recovered, but the net11 scanner has failed 13
consecutive scheduled runs since August 29. The two latest failures,
runs 33824526633 and 33757658045, are threat-detection false positives:
the scanner contract requests `## Recommended Action` with concrete
commands while its custom threat detector rejects instructions aimed at
downstream readers.

This changes both scanner twins to emit a declarative `## Investigation
Context` section. Its content is limited to suspected owning areas or
files, relevant evidence, and uncertainty, and explicitly forbids
commands, requests, second-person wording, imperative verbs, and
instructions directed at readers or agents.

Strict threat detection, trusted manifest validation, and publisher
logic remain unchanged. The latest failed net11 manifest independently
passed trusted validation for all 3 pipelines and 5 issue payloads, so
this removes the immediate publication blocker without weakening the
trust boundary.

dotnet#38163 and dotnet#38165 track related scanner behavior. Earlier failures had
additional recurrence/fingerprint instability causes; those remain
follow-up work and are not claimed as fixed here.

## Tests

- Scanner suites: 413 passed
- CI-fixer transport: 31 passed
- Pinned gh-aw v0.86.2 source-lock parity: passed

Co-authored-by: PureWeen <223556219+Copilot@users.noreply.github.com>
…ctMode UI Test in CI (dotnet#38192)

This PR addresses flaky UI test failures in CI and includes updates to
improve rendering and test stability across platforms. The main changes
are as follows:

UI component and test improvements:

* Replaced the `_primarySearchBar` initialization from `SearchBar` to
`UITestSearchBar` and set `IsCursorVisible` to `false` in
`Issue14708.cs`, likely to better control test conditions and prevent
cursor blinking during image verification.

Test verification adjustments:

* Updated the `VerifyScreenshot` call in the landscape search bar test
to use platform-specific cropping parameters, improving the reliability
of visual regression tests by accounting for differences in keyboard and
UI layout between Android and other platforms.

Test case:

- SearchBarLandscapeShowsInlineKeyboardNotExtractMode
…anup (dotnet#37278)

<!-- Please let the below note in for people that find this PR -->
> [!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](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

### Issue Details

After PR dotnet#35487 corrected `AssertionExtensions.WaitForGC`,
`MauiCALayerAutosizeToSuperLayerBehavior_DoesNotLeak` began failing on
Mac Catalyst for:

- `MauiCALayer`
- `StaticCALayer`
- `StaticCAGradientLayer`
- `StaticCAShapeLayer`

The production layer behavior was not leaking. The test called
`UIView.AttachAndRun` without awaiting its returned task, so `WaitForGC`
could run before `AttachAndRun` removed the view from the native visual
hierarchy in its `finally` block.

### Description of Change

- Changed the `InvokeOnMainThreadAsync` callback in
`MauiCALayerAutosizeToSuperLayerBehavior_DoesNotLeak` to an asynchronous
callback and awaited `view.AttachAndRun(...)` before the GC assertion.
- Re-enabled `MauiCALayerAutosizeToSuperLayerBehavior_DoesNotLeak`.
### Validation Status

- Mac Catalyst: the awaited `AttachAndRun` cleanup was tested.

### Issues Fixed

Fixes dotnet#36614

### Platforms Tested

- [ ] Android
- [x] Windows
- [ ] iOS
- [x] Mac Catalyst

| Before | After |
|---|---|
| **Mac Catalyst**<br><img
src="https://github.com/user-attachments/assets/c145e6b2-0823-4e7b-93fa-74c957e701e6"
width="600" height="300"> | **Mac Catalyst**<br><img
src="https://github.com/user-attachments/assets/af942f05-e9b7-436e-97fa-3b212d133c76"
width="600" height="300"> |
<!-- Please let the below note in for people that find this PR -->
> [!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](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

Tracker generation has been broken since dotnet#36760 merged on July 29, 2026.
The last scheduled success was run `30477430055` at 17:53 UTC on July
29; the first failing `main` run was `30483601642`, immediately after
dotnet#36760.

GitHub rejects the workflow before any jobs are created with `(Line:
464, Col: 14): Exceeded max expression length 21000`. The embedded
**Update or create tracker issue** lifecycle block grew from
approximately 15.5 KB to 27.3 KB, exceeding GitHub's current
21,000-character expression-template ceiling.

This change extracts that block to
`.github/skills/release-readiness/scripts/Update-TrackerIssue.sh`,
preserving Release Captain Notes splicing, duplicate closure, shipped
refresh-only behavior, hotfix generations, labels and milestones, and
semantic-hash no-op behavior. Repository identity is passed through the
trusted `GITHUB_REPOSITORY` environment variable instead of embedding
`${{ github.repository }}` in the moved shell program. The largest
remaining workflow `run:` block is 7,111 bytes.

Regression coverage now enforces a conservative `<20,000` UTF-8-byte
limit for workflow run blocks and validates the extracted script's
wiring, repository handling, shell syntax, and mocked
no-activity/no-write behavior.

Validation:
- Release readiness: 2,475 passed
- Release handoff: 87 passed
- `actionlint` passed with the pre-existing `SC2129` style warning
ignored
- `bash -n` passed
- `git diff --check` passed

The current detector matrix includes the `net10-sr10` shipped refresh,
`net10-sr11` candidate, `net11-preview7`, `net11-rc1`, and `net11-rc2`
candidate. New issue creation remains governed by the existing activity
and open-tracker gates.

This does not claim tracker automation is restored until the PR merges
and a subsequent manual dispatch or scheduled run completes
successfully.

Co-authored-by: PureWeen <223556219+Copilot@users.noreply.github.com>
…4833)

<!-- Please let the below note in for people that find this PR -->
> [!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](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

## Description

Migrate localization from the retired `handlers.yml` path to the
official Arcade OneLocBuild template in `ci-official.yml`. The official
pipeline now owns the localization handoff for branches selected by the
shared `isLocHandoffBranch` variable.

## Changes

- Rename `eng/automation/LocProject.json` to the Arcade-expected
`eng/Localize/LocProject.json` path without changing its contents.
- Add a `Localization` stage to `eng/pipelines/ci-official.yml` for
successful non-PR official builds. It runs independently, uses the
checked-in localization project, and derives `MirrorBranch` from
`Build.SourceBranch` so localization PRs target the branch that produced
the strings.
- Extend the shared Arcade OneLocBuild job with
`CeapexServiceConnection`. Supported `internal` and `DevDiv` projects
use a federated Entra token with the caller's 1ES context; other
projects and empty service-connection configurations retain PAT-based
authentication.
- Remove the legacy `eng/pipelines/common/localization.yml` stage and
its `handlers.yml` reference, preventing duplicate handoffs and leaving
one localization configuration source.

## Validation

- Parsed the modified YAML files successfully.
- Validated `eng/Localize/LocProject.json` and confirmed it is an exact
content-preserving rename.
- Confirmed no tracked pipeline still references the legacy localization
stage or old LocProject path.

### Issues Fixed

N/A

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Missy Messa <47990216+missymessa@users.noreply.github.com>
Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
Copilot-Session: e890b71a-c1aa-416c-a15c-be8da9fdd9b4
…ing (dotnet#35707)

<!-- Please let the below note in for people that find this PR -->
> [!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](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

## Description of Change

Replaces the `androidsdk.tool` (0.19.0) .NET tool with
[`Microsoft.Maui.Cli`
0.1.0-preview.10.26274.3](https://www.nuget.org/packages/Microsoft.Maui.Cli/0.1.0-preview.10.26274.3)
from [dotnet/maui-labs](https://github.com/dotnet/maui-labs) for Android
SDK, JDK, and emulator provisioning in CI.

The pinned CLI is restored from the public `dotnet10` Azure Artifacts
feed where its BAR build is published, avoiding a repository-wide
dependency on nuget.org.

## Changes

| File | Change |
|------|--------|
| `.config/dotnet-tools.json` | Replaces `androidsdk.tool` with the
pinned `Microsoft.Maui.Cli` tool. |
| `NuGet.config` | Adds the public `dotnet10` feed that contains the
pinned CLI package. |
| `eng/pipelines/common/provision.yml` | Reads the SDK path from the
CLI's `details.path` JSON field and fails immediately when the CLI does
not return a usable SDK. |
| `eng/Versions.props` | Removes the obsolete platform-tools version pin
because `sdkmanager` does not support versioned `platform-tools`
installs. |
| `src/Provisioning/Provisioning.csproj` | Migrates SDK, emulator, and
JDK commands; keeps AVD creation idempotent with `--force`; preserves
the required JDK `[17.0.12, 18.0)` range; re-detects the actual
cross-platform JDK home after installation; and validates it before
publishing `JAVA_HOME`. |

## Command Mapping

| Old (`dotnet android`) | New (`dotnet maui android`) |
|---|---|
| `dotnet android sdk install --package "X"` | `dotnet maui android sdk
install "X"` |
| `dotnet android sdk info --format=Json` | `dotnet maui android sdk
check --ci --json` |
| `dotnet android sdk list --installed` | `dotnet maui android sdk list`
|
| `dotnet android avd create --name X --sdk Y --device Z --force` |
`dotnet maui android emulator create X --package Y --device Z --force` |
| `dotnet android avd list` | `dotnet maui android emulator list` |
| `dotnet android jdk list` plus platform-specific installers | `dotnet
maui android jdk check/install` with validated JSON and Java version
output |

## Validation

- Restored all repository tools from a cold package directory using the
configured feeds.
- Built the `ProvisionJdk` target against an installed matching JDK.
- Verified JDK range detection rejects versions below the configured
minimum and accepts versions within the configured major-version range.
- Verified SDK JSON path extraction and emulator/JDK command-line
arguments against the pinned CLI.

### Issues Fixed

N/A

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
Copilot-Session: 413b6ccc-2114-4b7e-86d6-59140b3b416d
@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 38289

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 38289"

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
There may be pipelines that require an authorized user to comment /azp run to run.

@kubaflo

This comment has been minimized.

@github-actions github-actions Bot added the s/agent-review-in-progress AI review is currently running for this PR label Sep 7, 2026
@Tamilarasan-Paranthaman Tamilarasan-Paranthaman added community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration labels Sep 7, 2026
@MauiBot

This comment has been minimized.

@MauiBot MauiBot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

AI Review Summary

ℹ️ The review agent did not produce a full summary on this run (an infrastructure issue on the CI agent), but the deep UI tests completed — their results are below. Re-comment /review for a fresh full review.

📱 Deep UI Test Results — click to expand/collapse

❌ Deep UI tests — 354 passed, 1 failed, 8 skipped across 3 categories on platform-pool agent (replaces in-process counts above).

🧪 UI Test Execution Results (deep, platform pool)

Category Tests Snapshot diffs
Button 71/72 (1 skipped) ✓ —
Label 90/92 (2 skipped) ✓ —
Layout 193/199 (1 ❌, 5 skipped) —
🔍 AI analysis of failures — PR-related vs unrelated

🔍 AI-generated triage (GitHub Copilot CLI) — a heuristic judgement of whether each deep UI test failure is connected to this PR's changes. Verify before relying on it.

Likely unrelated: the failures appear pre-existing, flaky, or infrastructure.

  • ● Unrelated — iOS editor scrolling/layout element lookup (1 test): EditorsScrollingPageTest failed because Appium could not locate an element, while the PR only adds an otherwise-unused DependencyResolver.ResetResolver API and unit coverage without changing editor, scrolling, layout, or UI-test behavior.
❌ Layout — 1 failed test
EditorsScrollingPageTest
OpenQA.Selenium.NoSuchElementException : An element could not be located on the page using the given search parameters.; For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors#no-such-element-exception
at OpenQA.Selenium.WebDriver.UnpackAndThrowOnError(Response errorResponse, String commandToExecute)
   at OpenQA.Selenium.WebDriver.ExecuteAsync(String driverCommandToExecute, Dictionary`2 parameters)
   at OpenQA.Selenium.Appium.AppiumDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
   at OpenQA.Selenium.WebDriver.FindElement(String mechanism, String value)
   at OpenQA.Selenium.Appium.AppiumDriver.FindElement(String by, String value)
   at OpenQA.Selenium.Appium.MobileBy.FindElement(ISearchContext context)
   at OpenQA.Selenium.WebDriver.FindElement(By by)
   at OpenQA.Selenium.Appium.AppiumDriver.FindElement(By by)
   at Microsoft.Maui.TestCases.Tests.KeyboardScrolling.CloseiOSEditorKeyboard(AppiumDr
...

📎 Download drop-deep-uitests artifact (TRX + snapshot diffs)

@MauiBot MauiBot removed the s/agent-review-in-progress AI review is currently running for this PR label Sep 7, 2026
@vishnumenon2684

Copy link
Copy Markdown
Contributor

/azp run maui-pr-uitests , maui-pr-devicetests

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 2 pipeline(s).

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.

🟡 Changes recommended

The new leak test mutates a process-global static resolver without guaranteed cleanup on failure, which can leak memory and pollute subsequent tests.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 9/9 changed files
  • Comments generated: 1
  • Review effort level: Lite

Copilot AI review requested due to automatic review settings September 9, 2026 13:25

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.

🟢 Approval recommended

The new reset API correctly clears the static resolver reference and the added tests validate both the leak scenario and the mitigation without introducing conflicting state-management patterns.

Review details
  • Files reviewed: 9/9 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@kubaflo

This comment has been minimized.

@github-actions github-actions Bot added the s/agent-review-in-progress AI review is currently running for this PR label Sep 9, 2026

@MauiBot MauiBot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Expert Review — 1 findings

See inline comments for details.

~static readonly Microsoft.Maui.Controls.TabbedPage.BadgeTextColorProperty -> Microsoft.Maui.Controls.BindableProperty
~static readonly Microsoft.Maui.Controls.TabbedPage.BadgeTextProperty -> Microsoft.Maui.Controls.BindableProperty
static Microsoft.Maui.Controls.Shell.ResolveFlyoutItemTemplate(Microsoft.Maui.Controls.Shell? shell, Microsoft.Maui.Controls.BindableObject! flyoutItem) -> Microsoft.Maui.Controls.DataTemplate?
~static Microsoft.Maui.Controls.Internals.DependencyResolver.ResetResolver() -> void

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

🔍 AI-Generated Review (multi-model)

❌ Error: The leading ~ marks an API signature that contains nullable-oblivious reference types, but parameterless ResetResolver() returns void and has no reference-type position to mark. On the current PR head, maui-pr build 1589027 reports RS0036 from this declaration across the Windows, macOS, and Helix build legs. Remove ~ here and from the matching netstandard, net-android, net-ios, net-maccatalyst, net-tizen, and net-windows entries.

@MauiBot MauiBot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

AI Review Summary

@SubhikshaSf4851 — new AI review results are available based on commit 7386e36.

Gate Passed Confidence Low Platform iOS


🗂️ Review Sessions — click to expand
🚦 Gate — Test Before & After Fix

Gate Result: ✅ PASSED

Platform: IOS · Base: net11.0 · Merge base: 1c12f94d

✅ Verified (new API / feature) — this PR adds new API and a test that references it in the same project, so reverting the fix un-compiles the test: there is no valid "fails without the fix" baseline to establish (a compile-coupled baseline). The gate instead verified the fix by a clean build + pass with the fix, so this is a real PASS rather than a non-committal INCONCLUSIVE.

Test Without Fix (expect FAIL) With Fix (expect PASS)
🧪 DependencyResolverMemoryLeak DependencyResolverMemoryLeak 🛠️ BUILD ERROR ✅ PASS — 23s
🔴 Without fix — 🧪 DependencyResolverMemoryLeak: 🛠️ BUILD ERROR · 51s

Error-relevant lines (filtered from the build log):

/Users/cloudtest/vss/_work/1/s/src/Controls/tests/Core.UnitTests/DependencyResolverMemoryLeak.cs(17,28): error CS0117: 'DependencyResolver' does not contain a definition for 'ResetResolver' [/Users/cloudtest/vss/_work/1/s/src/Controls/tests/Core.UnitTests/Controls.Core.UnitTests.csproj]
/Users/cloudtest/vss/_work/1/s/src/Controls/tests/Core.UnitTests/DependencyResolverMemoryLeak.cs(37,32): error CS0117: 'DependencyResolver' does not contain a definition for 'ResetResolver' [/Users/cloudtest/vss/_work/1/s/src/Controls/tests/Core.UnitTests/Controls.Core.UnitTests.csproj]
/Users/cloudtest/vss/_work/1/s/src/Controls/tests/Core.UnitTests/DependencyResolverMemoryLeak.cs(44,28): error CS0117: 'DependencyResolver' does not contain a definition for 'ResetResolver' [/Users/cloudtest/vss/_work/1/s/src/Controls/tests/Core.UnitTests/Controls.Core.UnitTests.csproj]
/Users/cloudtest/vss/_work/1/s/src/Controls/tests/Core.UnitTests/DependencyResolverMemoryLeak.cs(57,32): error CS0117: 'DependencyResolver' does not contain a definition for 'ResetResolver' [/Users/cloudtest/vss/_work/1/s/src/Controls/tests/Core.UnitTests/Controls.Core.UnitTests.csproj]
/Users/cloudtest/vss/_work/1/s/src/Controls/tests/Core.UnitTests/DependencyResolverMemoryLeak.cs(67,28): error CS0117: 'DependencyResolver' does not contain a definition for 'ResetResolver' [/Users/cloudtest/vss/_work/1/s/src/Controls/tests/Core.UnitTests/Controls.Core.UnitTests.csproj]
🟢 With fix — 🧪 DependencyResolverMemoryLeak: PASS ✅ · 23s
  Determining projects to restore...
  All projects are up-to-date for restore.
Test run for /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.Core.UnitTests/Debug/net11.0/Microsoft.Maui.Controls.Core.UnitTests.dll (.NETCoreApp,Version=v11.0)
A total of 1 test files matched the specified pattern.
[xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v2.8.2+699d445a1a (64-bit .NET 11.0.0-rc.1.26420.103)
[xUnit.net 00:00:00.12]   Discovering: Microsoft.Maui.Controls.Core.UnitTests
[xUnit.net 00:00:00.88]   Discovered:  Microsoft.Maui.Controls.Core.UnitTests
[xUnit.net 00:00:00.89]   Starting:    Microsoft.Maui.Controls.Core.UnitTests
[xUnit.net 00:00:01.05]   Finished:    Microsoft.Maui.Controls.Core.UnitTests
  Passed DependencyResolver_ResolveUsing_Leaks [73 ms]
  Passed ResetResolver_ReleasesCapturedTarget [63 ms]
Test Run Successful.
Total tests: 2
     Passed: 2
 Total time: 1.3812 Seconds

⚠️ Failure Details

  • 🛠️ DependencyResolverMemoryLeak without fix: build failed before tests could run
    • /Users/cloudtest/vss/_work/1/s/src/Controls/tests/Core.UnitTests/DependencyResolverMemoryLeak.cs(17,28): error CS0117: 'DependencyResolver' does not contain a definition for 'ResetResolver' [/Users/cl...
📁 Fix files reverted (8 files)
  • src/Controls/src/Core/DependencyResolver.cs
  • src/Controls/src/Core/PublicAPI/net-android/PublicAPI.Unshipped.txt
  • src/Controls/src/Core/PublicAPI/net-ios/PublicAPI.Unshipped.txt
  • src/Controls/src/Core/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt
  • src/Controls/src/Core/PublicAPI/net-tizen/PublicAPI.Unshipped.txt
  • src/Controls/src/Core/PublicAPI/net-windows/PublicAPI.Unshipped.txt
  • src/Controls/src/Core/PublicAPI/net/PublicAPI.Unshipped.txt
  • src/Controls/src/Core/PublicAPI/netstandard/PublicAPI.Unshipped.txt

📋 Pre-Flight — Context & Validation

Pre-Flight: PR #38289

Context

  • Title: [leak-scan] Fix: DependencyResolver.ResolveUsing — process-global resolver strongly retains its delegate target
  • Base / head: net11.0 / Fix-37827
  • Issue: #37827
  • Platform requested for review: iOS. The changed implementation is managed, cross-platform code; the detected primary validation is a Core unit test and does not require an iOS device.
  • Gate: Passed previously. The gate must not be rerun or overwritten.

Problem

DependencyResolver.ResolveUsing assigns a supplied delegate to a process-global static property. An instance-targeted or capturing delegate therefore roots its target and the target's object graph until another resolver replaces it. Before this PR there was no explicit API for clearing the final registration.

Retention chain:

DependencyResolver static type -> Resolver static property -> delegate -> target/closure -> transient payload

The issue explicitly rejects a weak delegate as the default fix because silent collection of the resolver target would change dependency-resolution behavior.

Existing PR Approach

The PR adds DependencyResolver.ResetResolver(), implemented as Resolver = null, and records that public API for every target framework. Its new DependencyResolverMemoryLeak tests verify both the existing strong-retention semantics while a resolver remains registered and release after an explicit reset. The tests isolate the process-global state with try/finally.

Changed files:

  • src/Controls/src/Core/DependencyResolver.cs
  • src/Controls/src/Core/PublicAPI/net-android/PublicAPI.Unshipped.txt
  • src/Controls/src/Core/PublicAPI/net-ios/PublicAPI.Unshipped.txt
  • src/Controls/src/Core/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt
  • src/Controls/src/Core/PublicAPI/net-tizen/PublicAPI.Unshipped.txt
  • src/Controls/src/Core/PublicAPI/net-windows/PublicAPI.Unshipped.txt
  • src/Controls/src/Core/PublicAPI/net/PublicAPI.Unshipped.txt
  • src/Controls/src/Core/PublicAPI/netstandard/PublicAPI.Unshipped.txt
  • src/Controls/tests/Core.UnitTests/DependencyResolverMemoryLeak.cs (new test file)

The current public API entries correctly retain the nullable-oblivious ~ marker used by the shipped DependencyResolver APIs.

Existing Behavior and Compatibility

The two shipped ResolveUsing overloads return void. Existing call sites expect the registered resolver to remain usable process-wide. Any candidate must avoid silently losing a live registration and must not remove or change those shipped signatures. DependencyResolutionTests also installs an instance resolver in its fixture.

Bounded Validation

Run only the detected primary test:

dotnet test src/Controls/tests/Core.UnitTests/Controls.Core.UnitTests.csproj --filter "FullyQualifiedName~Microsoft.Maui.Controls.Core.UnitTests.DependencyResolverMemoryLeak"

No additional mandatory regression test was supplied for STEP 5a. Do not run the gate again, UI-test categories, an iOS device test, or the full test suite.

Attempt Constraints

  • One independent implementation/test pass per candidate, with at most one focused correction and retest.
  • Each candidate must differ at the mechanism/root-cause level from the PR and from earlier candidates.
  • Follow the try-fix baseline allow-list and restore protocol exactly; preserve all unrelated dirty-worktree changes.
  • Perform the skill's inline expert self-review only. Do not launch a separate reviewer.
  • Capture failed or blocked alternatives honestly; a candidate need not pass to be useful.

GitHub CLI authentication was unavailable, so pre-flight used the public GitHub API plus the locally materialized squashed PR commit 901941c141. No code was modified during pre-flight.


🔬 Code Review — Deep Analysis

Expert evaluation of the submitted PR fix

Independent assessment

The submitted change adds an explicit DependencyResolver.ResetResolver() API that clears the process-global resolver delegate, allowing its captured target graph to be collected. The implementation is a direct null assignment consistent with the existing two ResolveUsing overloads. The tests demonstrate strong retention while a resolver remains registered, the existing delegate-replacement mitigation, and collection after reset; try/finally restores global state on assertion failure.

The single MAUI expert-review pass initially returned no code-level findings. Required prior-review and current-head CI reconciliation then exposed a concrete API declaration error that the focused Gate did not catch.

❌ Error — invalid nullable-oblivious API marker

All seven new PublicAPI.Unshipped.txt entries prefix parameterless ResetResolver() -> void with ~. That marker is for signatures containing nullable-oblivious reference types; this method has no reference-type position. Current-head maui-pr build 1589027 fails its Windows, macOS, pack, and Helix build paths with RS0036 at DependencyResolver.cs:30.

The earlier automated suggestion to add ~ is not applicable to this parameterless void signature. Removing the marker in all seven target-framework files is the analyzer-consistent declaration.

Prior review reconciliation

The prior nullable-marker comments were applied on the current head, but the resulting ~ entries remain invalid as proven by current-head CI. The earlier test-cleanup concern is fixed by the submitted try/finally blocks. The unrelated iOS EditorsScrollingPageTest UI failure does not touch this managed API change.

Verdict: NEEDS_CHANGES

Confidence: low

The resolver lifetime mechanism and focused tests are sound, but the submitted API declarations break the main build. The RS0036 finding itself is conclusive and localized to a seven-line correction; overall confidence remains capped because the change governs process-global static state and current full CI is red.


🛠️ Try-Fix — Analysis & Comparison

STEP 5a Try-Fix Aggregate: PR #38289

Candidate 1 — Scoped Resolver Registration

  • Model: gpt-5.3-codex
  • Approach: Add a scoped registration API such as PushResolver(...) that returns an IDisposable token. The active resolver remains strongly rooted while the scope is alive, and disposing the token restores the prior resolver.
  • Prior approach avoided: The PR's standalone ResetResolver() requires a separate global cleanup call that callers can forget.
  • Mechanism-level difference: Resolver cleanup is coupled to lexical ownership (using/finally) rather than an unrelated later reset call.
  • Result: Blocked before implementation/testing.
  • Files changed: None.
  • Diff: Empty.
  • Test: Not run. EstablishBrokenBaseline.ps1 rejected the pre-existing dirty worktree before creating .github/.baseline-state.json; without a RevertedFiles allow-list, the try-fix protocol prohibited edits.
  • Self-review: 0 findings; there was no candidate diff.
  • Restore: The exact restore command ran and reported the expected no-state result (No baseline state found, Restored False) because no attempt edits occurred.
  • Detailed narrative: ../try-fix-1/content.md
  • Artifacts: attempt-1/

Candidate 1 is complete and will not be reopened or rerun.

Candidate 2 — Weakly Held Resolver Delegate

  • Model: gpt-5.6-sol
  • Approach: Replace the process-global strong delegate slot with WeakReference<Func<Type, object[], object>>. Promote the target to a strong local only while invoking it. An internal ResetResolver was retained only for compatibility with the fixed, read-only PR test source; it was not the retention mechanism.
  • Prior approaches avoided: This uses neither the PR's caller-managed global clear nor candidate 1's scoped disposable registration/token stack.
  • Mechanism-level difference: GC can break the static-to-delegate-to-target retention chain automatically, without a reset call or token disposal.
  • Files changed by the candidate: src/Controls/src/Core/DependencyResolver.cs (+11/-4). The first pass also added public API entries, but the one allowed correction removed them and made the test-only compatibility method internal after RS0036 blocked compilation.
  • Final candidate diff:
diff --git a/src/Controls/src/Core/DependencyResolver.cs b/src/Controls/src/Core/DependencyResolver.cs
index 2528645d0b..fedb9aad48 100644
--- a/src/Controls/src/Core/DependencyResolver.cs
+++ b/src/Controls/src/Core/DependencyResolver.cs
@@ -10,25 +10,32 @@ namespace Microsoft.Maui.Controls.Internals
 	public static class DependencyResolver
 	{
 		static Type _defaultVisualType = typeof(VisualMarker.DefaultVisual);
-		static Func<Type, object[], object> Resolver { get; set; }
+		static WeakReference<Func<Type, object[], object>> _resolver;
 
 		/// <summary>Sets a resolver function that takes a type and constructor arguments.</summary>
 		/// <param name="resolver">The resolver function.</param>
 		public static void ResolveUsing(Func<Type, object[], object> resolver)
 		{
-			Resolver = resolver;
+			_resolver = resolver is null ? null : new WeakReference<Func<Type, object[], object>>(resolver);
 		}
 
 		/// <summary>Sets a resolver function that takes only a type.</summary>
 		/// <param name="resolver">The resolver function.</param>
 		public static void ResolveUsing(Func<Type, object> resolver)
 		{
-			Resolver = (type, objects) => resolver.Invoke(type);
+			ResolveUsing((type, objects) => resolver.Invoke(type));
+		}
+
+		internal static void ResetResolver()
+		{
+			_resolver = null;
 		}
 
 		internal static object Resolve(Type type, params object[] args)
 		{
-			var result = Resolver?.Invoke(type, args);
+			Func<Type, object[], object> resolver = null;
+			_resolver?.TryGetTarget(out resolver);
+			var result = resolver?.Invoke(type, args);
  • Test command: dotnet test src/Controls/tests/Core.UnitTests/Controls.Core.UnitTests.csproj --filter "FullyQualifiedName~Microsoft.Maui.Controls.Core.UnitTests.DependencyResolverMemoryLeak"
  • Initial result: Fail — compile error. RS0036 rejected the public compatibility ResetResolver API shape, so no tests ran.
  • Focused correction/retest: Fail — behavioral regression. Build succeeded; 1 test passed and 1 failed. DependencyResolver_ResolveUsing_Leaks expected 30 live payloads but observed 0.
  • Failure analysis: Weak storage eliminates the reported retention only by allowing an active process-global resolver to disappear after unrelated GC. Existing callers expect registration to remain durable until replacement. The one-argument overload is worse: its adapter closure has no external strong owner even if the caller retains the original delegate. The targeted failure empirically rules this mechanism out.
  • Self-review: 3 major findings: silent loss of an active resolver, guaranteed fragility of the one-argument adapter closure, and unrelated generated HybridWebView.js drift from the test build.
  • Restore: The exact restore command reported Restored True for all eight baseline allow-listed files. The generated JavaScript drift was outside the allow-list and was preserved only in the isolated attempt snapshot.
  • Detailed narrative: ../try-fix-2/content.md
  • Artifacts: attempt-2/

Candidate 2 is complete. No further candidates, retries, cross-pollination, or audit passes were launched.

Aggregate Outcome

Candidate Mechanism Result Evidence
1 Scoped disposable registration restores the prior resolver at scope exit Blocked Original worktree was dirty before baseline state could be created; no edit or test occurred
2 Weak delegate lets GC sever the static retention chain Fail After one correction, targeted tests ran 2: 1 passed, 1 failed (Expected: 30; Actual: 0)

The bounded attempts reinforce the central design tradeoff: the active resolver must remain strongly rooted for compatibility, so lifetime release needs an explicit ownership signal. Candidate 1's scoped ownership API remains untested because of the baseline blocker; candidate 2 is empirically unsafe. The PR's explicit reset remains the only tested passing mechanism in the available gate evidence.


📝 PR Finalize — Recommended Title & Description

Assessment: ✏️ Recommend updating — the current title uses a non-component [leak-scan] prefix and describes the retention symptom more prominently than the actual cross-platform ResetResolver API added by the submitted diff.

Recommended title

[Core] DependencyResolver: Add ResetResolver to release registered delegate targets

Recommended description

### Description of Change

`DependencyResolver.ResolveUsing` stores the registered resolver delegate in a process-global static property. When that delegate captures an instance or closure, the registration strongly retains the delegate target and its object graph until the resolver is replaced.

This change adds `DependencyResolver.ResetResolver()`, which explicitly clears the registered resolver and releases the references it holds. The active resolver remains strongly retained until it is reset, preserving the existing dependency-resolution behavior while giving callers a clear lifetime-management API.

**DependencyResolver API and implementation:**
- Added the public static `DependencyResolver.ResetResolver()` method.
- Added the matching public API entry for `net`, `netstandard`, `net-android`, `net-ios`, `net-maccatalyst`, `net-tizen`, and `net-windows`.

**Testing and validation:**
- Added `DependencyResolverMemoryLeak` Core unit tests using weak references and forced garbage collection.
- Verified that a registered resolver continues to retain its captured target while active.
- Verified that replacing the resolver releases the previous target.
- Verified that `ResetResolver()` releases the captured target.

### Issues Fixed

Fixes #37827

### Tested the behavior in the following platforms

- [x] Windows
- [x] Android
- [x] iOS
- [x] Mac

| Before Issue Fix | After Issue Fix |
|----------|----------|
| <video src="https://github.com/user-attachments/assets/700f7717-ac92-4018-af75-902ac24e28bd"> | <video src="https://github.com/user-attachments/assets/2657eb9f-c036-40d2-bb69-1cfc411314ac"> |

🏁 Report — Final Recommendation

⚠️ Final Recommendation: REQUEST CHANGES

Winning candidate: pr-plus-reviewer

pr-plus-reviewer is the single winner. It preserves the submitted resolver lifetime design and tests while correcting the seven invalid nullable-oblivious API markers that currently break maui-pr with RS0036. Its one required focused validation built the corrected Controls.Core project without RS0036 and passed both DependencyResolverMemoryLeak tests.

Comparative ranking

Rank Candidate Implementation Validation Assessment
1 pr-plus-reviewer Keeps the PR fix and removes the invalid ~ marker from all seven parameterless void API entries Passed required focused validation: 2/2 tests; candidate build emitted no RS0036 Best candidate: fixes the current-head build break without changing runtime behavior
2 pr Adds public ResetResolver() and cross-target API entries; retains existing resolver behavior until explicit reset Focused Gate passed 2/2, but current-head maui-pr build 1589027 fails multiple legs with RS0036 Runtime approach is sound, but submitted API declarations do not build in full CI
3 try-fix-1 Proposed a scoped IDisposable registration that would restore the prior resolver Blocked before implementation and testing by the dirty-baseline guard Potentially useful ownership model, but no code, diff, or evidence exists to evaluate
4 try-fix-2 Stores the active resolver through WeakReference<Func<...>> Failed focused regression validation after its allowed correction: 1 passed, 1 failed (Expected: 30; Actual: 0) Rejected: unrelated GC can silently remove an active resolver; the one-argument adapter is especially vulnerable

Decision rationale

The tested failure of try-fix-2 confirms that weakening the global reference changes established dependency-resolution semantics rather than safely managing lifetime. try-fix-1 never produced an implementation and therefore cannot displace a passing candidate. The raw PR's runtime mechanism remains preferable to both alternatives, but its invalid API entries are a concrete build regression. The reviewer candidate makes the smallest correction and retains all passing behavioral evidence.

The Gate's without-fix side is compile-coupled because the tests call the new API, so it demonstrates API presence rather than a runtime failing assertion. The candidate's focused run is also bounded and does not replace a full CI rerun. Nevertheless, it compiles the corrected Controls.Core API declaration and passes both behavioral tests; no further refinement or retest was attempted.


📱 UI Tests — Button,Label,Layout

Detected UI test categories: Button,Label,Layout

⚠️ Deep UI tests — The build failed to compile for 3 categories (Button, Label, Layout), so those deep UI tests could not run. The compiler reported: error RS0036: Symbol 'static Microsoft.Maui.Controls.Internals.DependencyResolver.ResetResolver() -> void' is missing nullability annotations in the declared API (https://github.com/dotnet/roslyn/blob/main/src/RoslynAnalyzers/PublicApiAnaly…. This is a compile error introduced by this PR — src/Controls/src/Core/DependencyResolver.cs is one of the files this PR changes. Fix the build error, then re-comment /review to run the deep tests.


🧭 Next Steps — reviewer changes required

The reviewer-enhanced candidate identified changes that are not yet in the submitted PR.

Why: The reviewer candidate preserves the submitted resolver-lifetime fix while removing seven invalid nullable-oblivious API markers that make the current PR head fail full CI with RS0036. Its single focused validation built the corrected API and passed both targeted tests; try-fix-1 was blocked and try-fix-2 failed the regression test.

Address the actionable findings in this review before merging.

@MauiBot MauiBot added s/agent-changes-requested AI agent recommends changes - found a better alternative or issues s/agent-gate-passed AI verified tests catch the bug (fail without fix, pass with fix) s/agent-fix-win AI found a better alternative fix than the PR s/agent-reviewed PR was reviewed by AI agent workflow (full 4-phase review) and removed s/agent-review-in-progress AI review is currently running for this PR labels Sep 9, 2026
@kubaflo

kubaflo commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Requesting changes before merge: the current head (7386e36b) fails maui-pr build 1589027 with RS0036 across the Windows, macOS, and Helix compilation legs.

Please remove the leading ~ from the DependencyResolver.ResetResolver() -> void entry in all seven PublicAPI.Unshipped.txt files, then rerun CI. This parameterless void API has no nullable-oblivious reference-type position to annotate. The updated try/finally test cleanup looks good.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: ff3d39d6-64c1-4bfe-b4e0-e865b345aa34
Copilot AI review requested due to automatic review settings September 9, 2026 17:04

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.

🟡 Changes recommended

The PublicAPI.Unshipped entries for DependencyResolver.ResetResolver() are missing the leading ~ nullable-oblivious marker used by existing DependencyResolver entries in the corresponding PublicAPI.Shipped files, which is likely to break PublicApiAnalyzers.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (2)

Previously missed (2) — in code that hasn't changed since the last review.

src/Controls/tests/Core.UnitTests/DependencyResolverMemoryLeak.cs:12

  • Core.UnitTests naming is typically *Tests for test classes (e.g., SelectionListMemoryLeakTests, PathSharedResourcesMemoryLeakTests). Renaming this class to end with Tests would make it consistent and easier to discover (and the file can be renamed to match).
    src/Controls/tests/Core.UnitTests/DependencyResolverMemoryLeak.cs:16
  • This test is asserting the (expected) strong retention behavior while an instance-targeted resolver is registered; naming it ..._Leaks can read like a regression/bug is being asserted. Consider renaming to reflect the intended contract (retains delegate target while registered).
  • Files reviewed: 9/9 changed files
  • Comments generated: 7
  • Review effort level: Lite

@kubaflo
kubaflo merged commit 9576ae2 into dotnet:net11.0 Sep 9, 2026
14 of 22 checks passed
@github-actions github-actions Bot added this to the .NET 11.0-preview7 milestone Sep 9, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 10, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration s/agent-changes-requested AI agent recommends changes - found a better alternative or issues s/agent-fix-win AI found a better alternative fix than the PR s/agent-gate-passed AI verified tests catch the bug (fail without fix, pass with fix) s/agent-reviewed PR was reviewed by AI agent workflow (full 4-phase review)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[leak-scan] DependencyResolver.ResolveUsing — process-global resolver strongly retains its delegate target