This behavior is not listed as a known memory leak for Rectangle or RoundRectangle in .NET MAUI. However, memory leak reports from tools often come from object graphs that are still referenced (and therefore correctly not collected), rather than from a true leak in the framework.
On Android, circular-reference issues described in the documentation for iOS and Mac Catalyst do not normally occur:
These circular reference issues are specific to iOS and Mac Catalyst. They do not normally occur on Android or Windows.
So if the leak is only observed on Android 14 with MAUI 9.0.40, it is more likely related to how the page, bindings, or events are wired than to a platform-wide known bug in the shape types themselves.
Recommended next steps before opening a GitHub issue:
- Verify event subscriptions
- Ensure that any events involving the page, view models, or long-lived services are unsubscribed when navigating away (for example, in
OnDisappearing or Dispose).
- The MAUI guidance for memory leaks explicitly calls out events as a common cause and recommends using
WeakEventManager or unsubscribing when objects are no longer needed.
- Use finalizers/logging to confirm collection
- Test in a minimal reproduction
- Create a new MAUI project with a single page containing only a
Border with a Rectangle or RoundRectangle stroke and simple navigation between two pages.
- If the minimal app shows the same behavior (page not collected, shapes retained) with no custom code, that is strong evidence for a framework issue and is appropriate for a GitHub bug.
- Consider platform-specific guidance
- The official guidance on memory leaks in MAUI focuses on:
- Avoiding strong circular references (especially on iOS/Mac Catalyst).
- Unsubscribing from events or using
WeakEventManager.
- Using finalizers and profiling to confirm leaks.
- Apply these patterns in the page that uses the shapes to rule out app-level leaks.
If, after these checks, a minimal sample still shows that Rectangle/RoundRectangle instances are retained after navigation and the page is otherwise collectible, raising a GitHub issue with that minimal reproduction is appropriate.
References: