Skip to content
NLNuvyntra Labs
All packages

Observability

Plugin.Maui.LeakAnalyser

Detect visual-tree leaks and tear down finished views

Current NuGet 1.0.1

A liveness test for .NET MAUI pages and views: WeakReference plus forced GC after navigation, with optional handler disconnect or compartmentalize. Not a profiler — it reports that something is still alive, not why.

Install

dotnet add package Plugin.Maui.LeakAnalyser

Package ID: Plugin.Maui.LeakAnalyser

Overview

Plugin.Maui.LeakAnalyser watches MAUI visual-tree objects after they look finished — typically a page popped from NavigationPage — then forces GC and reports anything still rooted. Detection stays in Debug. Teardown can stay in Release: DisconnectHandlers walks children and calls DisconnectHandler(), while Compartmentalize also clears BindingContext, Content, and other managed references. It will not give you a retain path. Use Instruments, dotMemory, or Visual Studio diagnostics for that. Inspired by AdamE.MemoryToolkit.Maui; the API is UseLeakAnalyser, LeakMonitor, TearDown, and LeakGraph — not a drop-in fork.

Current release

  • 1.0.1. No API change.

Full upgrade map for the 3 September 2026 hardening wave: Hardened plugin releases.

Capabilities

  • WeakReference + forced GC liveness test after a view looks finished.
  • LeakMonitor.Cascade snapshots the tree; OnLeaked / OnCollected callbacks and ILogger.
  • TearDown.DisconnectHandlers — safe child walk that honors HandlerDisconnectPolicy.Manual and Suppress.
  • TearDown.Compartmentalize — clears BindingContext, Content, items sources, gestures, then disconnects.
  • Best-effort 'done with' lifecycle: popped pages, detached templates, skipped Shell/Tab/cached hosts.
  • Android, iOS, Mac Catalyst, and Windows. Detection is Debug-only; teardown may stay in Release.

Documentation

Related in Observability