From 7addd846a143779d0f2f68ab33040ac59e556154 Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Thu, 3 Dec 2026 10:00:36 -0500 Subject: [PATCH] fix(centralui): no timers/subscriptions created after a mid-load dispose (UI-4, WP5 task 5.3) A navigation while an awaited load was still running disposed the component first; the continuation then created a timer / added a singleton handler that nothing ever disposed, rooting the dead circuit for the life of the process. - Health: refresh timer created under _timerLock only if not disposed. - DataConnections: same for the health-poll timer; also stops before touching the disposed CTS when disposed during the first load. - Deployments: subscribe to IDeploymentStatusNotifier BEFORE the first load (the handler only schedules a reload; the generation guard orders flights). - PendingUpdatesHealthTiles: the Invalidated subscription and the poll timer are both created under a lifetime lock after a disposed check; Dispose unsubscribes only what was subscribed (covers a dispose during the auth-state await too). - AlarmSummary: StartTimer/StopTimer/Dispose atomic under _timerLock; StartTimer refuses after dispose (Topology.StartLiveUpdatesTimer idiom). Tests (each fails on the pre-fix component): HealthPageTests, DataConnectionsPageTests, DeploymentsPerFlightScopeTests, PendingUpdatesHealthTilesTests (x2), AlarmSummaryRenderTests - dispose mid-load, release the load, assert no timer and no handler left. --- .../Health/PendingUpdatesHealthTiles.razor | 35 ++++++++-- .../Pages/Deployment/Deployments.razor | 7 +- .../Pages/Design/DataConnections.razor | 22 +++++-- .../Pages/Monitoring/AlarmSummary.razor | 47 ++++++++++---- .../Components/Pages/Monitoring/Health.razor | 31 ++++++--- .../DataConnectionsPageTests.cs | 31 +++++++++ .../DeploymentsPerFlightScopeTests.cs | 48 ++++++++++++++ .../Monitoring/AlarmSummaryRenderTests.cs | 24 +++++++ .../PendingUpdatesHealthTilesTests.cs | 65 +++++++++++++++++++ .../Pages/HealthPageTests.cs | 35 ++++++++++ 10 files changed, 312 insertions(+), 33 deletions(-) diff --git a/src/ZB.MOM.WW.ScadaBridge.CentralUI/Components/Health/PendingUpdatesHealthTiles.razor b/src/ZB.MOM.WW.ScadaBridge.CentralUI/Components/Health/PendingUpdatesHealthTiles.razor index b8d5204e..11fb27a9 100644 --- a/src/ZB.MOM.WW.ScadaBridge.CentralUI/Components/Health/PendingUpdatesHealthTiles.razor +++ b/src/ZB.MOM.WW.ScadaBridge.CentralUI/Components/Health/PendingUpdatesHealthTiles.razor @@ -53,6 +53,8 @@ private Timer? _timer; private volatile bool _disposed; + private bool _subscribed; + private readonly object _lifetimeLock = new(); private bool _visible; private IReadOnlySet? _scopedSiteIds; private PendingUpdatesSnapshot? _snapshot; @@ -85,9 +87,23 @@ var (isSystemWide, sites) = SiteScopeService.Resolve(user); _scopedSiteIds = isSystemWide ? null : sites; - PendingUpdates.Invalidated += OnInvalidated; + // UI-4: the component may have been disposed during an await above or below; + // Dispose() has then already run and must not be followed by a subscription to the + // process-singleton cache or a new timer (both would root this dead component). + // Subscribe/create and dispose are atomic under _lifetimeLock. + lock (_lifetimeLock) + { + if (_disposed) return; + PendingUpdates.Invalidated += OnInvalidated; + _subscribed = true; + } + await LoadAsync(); - _timer = new Timer(_ => _ = ReloadAsync(), null, PollInterval, PollInterval); + lock (_lifetimeLock) + { + if (_disposed) return; + _timer = new Timer(_ => _ = ReloadAsync(), null, PollInterval, PollInterval); + } } private void OnInvalidated() => _ = ReloadAsync(); @@ -131,12 +147,17 @@ public void Dispose() { - _disposed = true; - if (_visible) + lock (_lifetimeLock) { - PendingUpdates.Invalidated -= OnInvalidated; - } + _disposed = true; + if (_subscribed) + { + PendingUpdates.Invalidated -= OnInvalidated; + _subscribed = false; + } - _timer?.Dispose(); + _timer?.Dispose(); + _timer = null; + } } } diff --git a/src/ZB.MOM.WW.ScadaBridge.CentralUI/Components/Pages/Deployment/Deployments.razor b/src/ZB.MOM.WW.ScadaBridge.CentralUI/Components/Pages/Deployment/Deployments.razor index dc541a89..04d3a50d 100644 --- a/src/ZB.MOM.WW.ScadaBridge.CentralUI/Components/Pages/Deployment/Deployments.razor +++ b/src/ZB.MOM.WW.ScadaBridge.CentralUI/Components/Pages/Deployment/Deployments.razor @@ -343,8 +343,13 @@ protected override async Task OnInitializedAsync() { - await LoadDataAsync(); + // UI-4: subscribe BEFORE the first load. Subscribing after it meant a navigation + // during the load ran Dispose() first (unsubscribing a handler that was not yet + // added), and the continuation then added a dead component to the process-singleton + // notifier's invocation list for good. A push during the initial load is harmless: + // the handler only schedules a reload, and the generation guard orders the flights. DeploymentStatusNotifier.StatusChanged += OnDeploymentStatusChanged; + await LoadDataAsync(); } // ── Push coalescing (arch-review WP2.4) ─────────────────────────────────── diff --git a/src/ZB.MOM.WW.ScadaBridge.CentralUI/Components/Pages/Design/DataConnections.razor b/src/ZB.MOM.WW.ScadaBridge.CentralUI/Components/Pages/Design/DataConnections.razor index aa222d27..c8ce37b4 100644 --- a/src/ZB.MOM.WW.ScadaBridge.CentralUI/Components/Pages/Design/DataConnections.razor +++ b/src/ZB.MOM.WW.ScadaBridge.CentralUI/Components/Pages/Design/DataConnections.razor @@ -233,6 +233,7 @@ // DebugView.razor. The CTS is used to cancel the in-flight health query when // the component is disposed. private volatile bool _disposed; + private readonly object _timerLock = new(); private bool _healthTickInFlight; private readonly CancellationTokenSource _disposeCts = new(); @@ -241,17 +242,24 @@ protected override async Task OnInitializedAsync() { await LoadDataAsync(); + if (_disposed) return; await LoadConnectionHealthAsync(_disposeCts.Token); // Poll the live health map on the same cadence as the Health dashboard. // Best-effort: a failed query leaves the prior map in place rather than // disturbing the tree. // CentralUI-022 pattern: guard against dispose race — see _disposed field. - _healthTimer = new Timer(_ => + // UI-4: a navigation during the loads above has already run Dispose(), which found + // no timer; create-vs-dispose is atomic under _timerLock so none is leaked. + lock (_timerLock) { if (_disposed) return; - _ = DispatchHealthTickAsync(); - }, null, TimeSpan.FromSeconds(HealthRefreshSeconds), TimeSpan.FromSeconds(HealthRefreshSeconds)); + _healthTimer = new Timer(_ => + { + if (_disposed) return; + _ = DispatchHealthTickAsync(); + }, null, TimeSpan.FromSeconds(HealthRefreshSeconds), TimeSpan.FromSeconds(HealthRefreshSeconds)); + } } /// @@ -479,9 +487,13 @@ // CentralUI-022 pattern: set the guard FIRST so any tick already in flight // on the thread-pool no-ops, then cancel the in-flight health query, then // stop the timer. Mirrors Deployments.razor and DebugView.razor. - _disposed = true; + lock (_timerLock) + { + _disposed = true; + _healthTimer?.Dispose(); + _healthTimer = null; + } _disposeCts.Cancel(); _disposeCts.Dispose(); - _healthTimer?.Dispose(); } } diff --git a/src/ZB.MOM.WW.ScadaBridge.CentralUI/Components/Pages/Monitoring/AlarmSummary.razor b/src/ZB.MOM.WW.ScadaBridge.CentralUI/Components/Pages/Monitoring/AlarmSummary.razor index 3c39c98f..274436b0 100644 --- a/src/ZB.MOM.WW.ScadaBridge.CentralUI/Components/Pages/Monitoring/AlarmSummary.razor +++ b/src/ZB.MOM.WW.ScadaBridge.CentralUI/Components/Pages/Monitoring/AlarmSummary.razor @@ -327,6 +327,7 @@ // seed-then-stream) starts warming while the initial poll runs. SubscribeLive(siteId); await RefreshAsync(); + if (_disposed) return; StartTimer(); // If another circuit already warmed the cache for this site, the initial // poll may be staler than what's live — apply the live snapshot on top. @@ -393,24 +394,45 @@ } } + // UI-4: StartTimer runs after OnSiteChangedAsync's awaited fan-out, which can take + // seconds against an unreachable site. If the operator navigated away meanwhile, + // Dispose() has already run; creating the timer then would leak it (rooting this dead + // component) for the life of the process. Create / stop / dispose are atomic under + // _timerLock and creation is refused once disposed. + private readonly object _timerLock = new(); + private void StartTimer() { - StopTimer(); - _refreshTimer = new Timer(_ => + Timer? old; + lock (_timerLock) { - _ = _pollGate.RunAsync(() => InvokeAsync(async () => + old = _refreshTimer; + _refreshTimer = null; + if (!_disposed) { - if (_disposed) return; - await RefreshAsync(); - StateHasChanged(); - }), error => System.Diagnostics.Trace.TraceWarning("AlarmSummary refresh failed: {0}", error)); - }, null, TimeSpan.FromSeconds(_autoRefreshSeconds), TimeSpan.FromSeconds(_autoRefreshSeconds)); + _refreshTimer = new Timer(_ => + { + _ = _pollGate.RunAsync(() => InvokeAsync(async () => + { + if (_disposed) return; + await RefreshAsync(); + StateHasChanged(); + }), error => System.Diagnostics.Trace.TraceWarning("AlarmSummary refresh failed: {0}", error)); + }, null, TimeSpan.FromSeconds(_autoRefreshSeconds), TimeSpan.FromSeconds(_autoRefreshSeconds)); + } + } + old?.Dispose(); } private void StopTimer() { - _refreshTimer?.Dispose(); - _refreshTimer = null; + Timer? old; + lock (_timerLock) + { + old = _refreshTimer; + _refreshTimer = null; + } + old?.Dispose(); } // ── Live cache (plan #10, Task 5) ────────────────────────────────────────── @@ -606,7 +628,10 @@ public void Dispose() { - _disposed = true; + lock (_timerLock) + { + _disposed = true; + } StopTimer(); DisposeLiveSubscription(); } diff --git a/src/ZB.MOM.WW.ScadaBridge.CentralUI/Components/Pages/Monitoring/Health.razor b/src/ZB.MOM.WW.ScadaBridge.CentralUI/Components/Pages/Monitoring/Health.razor index 65f34d77..0eeb89e8 100644 --- a/src/ZB.MOM.WW.ScadaBridge.CentralUI/Components/Pages/Monitoring/Health.razor +++ b/src/ZB.MOM.WW.ScadaBridge.CentralUI/Components/Pages/Monitoring/Health.razor @@ -767,15 +767,23 @@ // and query the default site. await LoadSiteHealthTrendsAsync(); - _refreshTimer = new Timer(_ => + // UI-4: the operator may have navigated away during the loads above. Dispose() + // has then already run and found no timer, so creating one now would leak it + // (and root this dead component) for the life of the process. Create-vs-dispose + // is atomic under _timerLock. + lock (_timerLock) { - _ = _pollGate.RunAsync(() => InvokeAsync(async () => + if (_disposed) return; + _refreshTimer = new Timer(_ => { - if (_disposed) return; - await RefreshAllAsync(forceRefresh: false); - StateHasChanged(); - }), error => System.Diagnostics.Trace.TraceWarning("Health refresh failed: {0}", error)); - }, null, TimeSpan.FromSeconds(_autoRefreshSeconds), TimeSpan.FromSeconds(_autoRefreshSeconds)); + _ = _pollGate.RunAsync(() => InvokeAsync(async () => + { + if (_disposed) return; + await RefreshAllAsync(forceRefresh: false); + StateHasChanged(); + }), error => System.Diagnostics.Trace.TraceWarning("Health refresh failed: {0}", error)); + }, null, TimeSpan.FromSeconds(_autoRefreshSeconds), TimeSpan.FromSeconds(_autoRefreshSeconds)); + } } // Re-query when the operator picks a different site. Best-effort: the load @@ -1041,10 +1049,15 @@ }; private volatile bool _disposed; + private readonly object _timerLock = new(); public void Dispose() { - _disposed = true; - _refreshTimer?.Dispose(); + lock (_timerLock) + { + _disposed = true; + _refreshTimer?.Dispose(); + _refreshTimer = null; + } } } diff --git a/tests/ZB.MOM.WW.ScadaBridge.CentralUI.Tests/DataConnectionsPageTests.cs b/tests/ZB.MOM.WW.ScadaBridge.CentralUI.Tests/DataConnectionsPageTests.cs index 3d8e75be..23b1a219 100644 --- a/tests/ZB.MOM.WW.ScadaBridge.CentralUI.Tests/DataConnectionsPageTests.cs +++ b/tests/ZB.MOM.WW.ScadaBridge.CentralUI.Tests/DataConnectionsPageTests.cs @@ -358,4 +358,35 @@ public class DataConnectionsPageTests : BunitContext Assert.Contains("PLC-A", cut.Markup); Assert.Contains("PLC-B", cut.Markup); } + + /// + /// Code review 2026-12-02 UI-4: a navigation during the initial loads disposes the page + /// first; the continuation must not then start the 10 s health poll timer. + /// + /// A task that represents the asynchronous operation. + [Fact] + public async Task DisposedDuringInitialLoad_CreatesNoHealthTimer() + { + SeedRepos(); + // Hold the SECOND initial load (the health map) open: the timer is created right + // after it, so a dispose while it is in flight is the leak window. + var entered = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); + var gate = new TaskCompletionSource>( + TaskCreationOptions.RunContinuationsAsynchronously); + _healthQuery.GetConnectionHealthAsync(Arg.Any()) + .Returns(_ => { entered.TrySetResult(); return gate.Task; }); + + var cut = Render(); + await entered.Task.WaitAsync(TimeSpan.FromSeconds(10)); + var page = cut.Instance; + await cut.InvokeAsync(page.Dispose); + + gate.SetResult(new Dictionary()); + await cut.InvokeAsync(() => { }); + await cut.InvokeAsync(() => { }); + + Assert.Null(typeof(DataConnectionsPage) + .GetField("_healthTimer", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic)! + .GetValue(page)); + } } diff --git a/tests/ZB.MOM.WW.ScadaBridge.CentralUI.Tests/Deployment/DeploymentsPerFlightScopeTests.cs b/tests/ZB.MOM.WW.ScadaBridge.CentralUI.Tests/Deployment/DeploymentsPerFlightScopeTests.cs index 71f4eae1..b28fd1a0 100644 --- a/tests/ZB.MOM.WW.ScadaBridge.CentralUI.Tests/Deployment/DeploymentsPerFlightScopeTests.cs +++ b/tests/ZB.MOM.WW.ScadaBridge.CentralUI.Tests/Deployment/DeploymentsPerFlightScopeTests.cs @@ -105,4 +105,52 @@ public class DeploymentsPerFlightScopeTests : BunitContext (string?)typeof(DeploymentsPage) .GetField("_errorMessage", BindingFlags.Instance | BindingFlags.NonPublic)! .GetValue(page); + + private sealed class CountingNotifier : IDeploymentStatusNotifier + { + private Action? _handlers; + + /// Handlers currently on the invocation list (removing an absent one is a no-op, as for a real event). + public int Subscribers => _handlers?.GetInvocationList().Length ?? 0; + + public event Action? StatusChanged + { + add => _handlers += value; + remove => _handlers -= value; + } + + public void NotifyStatusChanged(DeploymentStatusChange change) { } + } + + /// + /// Code review 2026-12-02 UI-4: disposed while the first load is in flight, the page must + /// leave no handler on the process-singleton status notifier (it used to subscribe after + /// the load, i.e. after Dispose had already unsubscribed nothing). + /// + /// A task that represents the asynchronous operation. + [Fact] + public async Task DisposedDuringFirstLoad_LeavesNoNotifierSubscription() + { + var factory = new SingleOperationRepositoryFactory(); + Services.AddScoped(_ => factory.Create()); + var notifier = new CountingNotifier(); + Services.AddSingleton(notifier); + var auth = new StubAuthStateProvider(new AuthenticationState(new ClaimsPrincipal( + new ClaimsIdentity(new[] { new Claim(ClaimTypes.Name, "deployer") }, "TestCookie")))); + Services.AddSingleton(auth); + Services.AddScoped(_ => new SiteScopeService(auth)); + + var cut = Render(); // first load held open + var page = cut.Instance; + await cut.InvokeAsync(page.Dispose); + + factory.ReleaseFirstCall(); + // The first load has finished once _loading drops; OnInitializedAsync's tail runs in + // the same dispatcher step. + cut.WaitForAssertion(() => Assert.False((bool)typeof(DeploymentsPage) + .GetField("_loading", BindingFlags.Instance | BindingFlags.NonPublic)!.GetValue(page)!)); + await cut.InvokeAsync(() => { }); + + Assert.Equal(0, notifier.Subscribers); + } } diff --git a/tests/ZB.MOM.WW.ScadaBridge.CentralUI.Tests/Monitoring/AlarmSummaryRenderTests.cs b/tests/ZB.MOM.WW.ScadaBridge.CentralUI.Tests/Monitoring/AlarmSummaryRenderTests.cs index f3c476eb..51314fe7 100644 --- a/tests/ZB.MOM.WW.ScadaBridge.CentralUI.Tests/Monitoring/AlarmSummaryRenderTests.cs +++ b/tests/ZB.MOM.WW.ScadaBridge.CentralUI.Tests/Monitoring/AlarmSummaryRenderTests.cs @@ -439,4 +439,28 @@ public class AlarmSummaryRenderTests : BunitContext } } } + + /// + /// Code review 2026-12-02 UI-4: picking a site runs a fan-out that can take seconds; if the + /// page is disposed meanwhile, the continuation must not start the 15 s poll timer. + /// + /// A task that represents the asynchronous operation. + [Fact] + public async Task DisposedDuringSiteFanOut_CreatesNoPollTimer() + { + var gate = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); + _summary.GetSiteAlarmsAsync(Arg.Any(), Arg.Any()).Returns(gate.Task); + + var cut = Render(); + var page = cut.Instance; + var change = cut.Find("[data-test='alarm-summary-site']").ChangeAsync(new() { Value = "1" }); + await cut.InvokeAsync(page.Dispose); + + gate.SetResult(new AlarmSummaryResult(new List(), Array.Empty())); + await change.WaitAsync(TimeSpan.FromSeconds(10)); + + Assert.Null(typeof(AlarmSummaryPage) + .GetField("_refreshTimer", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic)! + .GetValue(page)); + } } diff --git a/tests/ZB.MOM.WW.ScadaBridge.CentralUI.Tests/Monitoring/PendingUpdatesHealthTilesTests.cs b/tests/ZB.MOM.WW.ScadaBridge.CentralUI.Tests/Monitoring/PendingUpdatesHealthTilesTests.cs index 03eac36a..684e4d9b 100644 --- a/tests/ZB.MOM.WW.ScadaBridge.CentralUI.Tests/Monitoring/PendingUpdatesHealthTilesTests.cs +++ b/tests/ZB.MOM.WW.ScadaBridge.CentralUI.Tests/Monitoring/PendingUpdatesHealthTilesTests.cs @@ -106,4 +106,69 @@ public class PendingUpdatesHealthTilesTests : BunitContext cut.WaitForAssertion(() => Assert.Equal("0", cut.Find("[data-test='pending-updates-instances'] h3").TextContent.Trim())); } + + /// Counts subscriptions so a test can see a leaked handler on the singleton cache. + private sealed class CountingCache : IPendingUpdatesCache + { + public TaskCompletionSource Gate { get; } = + new(TaskCreationOptions.RunContinuationsAsynchronously); + private Action? _handlers; + + /// Handlers currently on the invocation list (removing an absent one is a no-op, as for a real event). + public int Subscribers => _handlers?.GetInvocationList().Length ?? 0; + + public Task GetAsync(bool forceRefresh = false, CancellationToken cancellationToken = default) + => Gate.Task; + + public event Action? Invalidated + { + add => _handlers += value; + remove => _handlers -= value; + } + + } + + /// + /// Code review 2026-12-02 UI-4: disposed while the first snapshot load is in flight, the + /// tiles must not start their poll timer, and must leave no handler on the singleton cache. + /// + /// A task that represents the asynchronous operation. + [Fact] + public async Task DisposedDuringFirstLoad_CreatesNoTimer_AndLeavesNoSubscription() + { + var cache = new CountingCache(); + var cut = RenderFor(cache, Role(Roles.Deployer)); + var tiles = cut.Instance; + await cut.InvokeAsync(tiles.Dispose); + + cache.Gate.SetResult(new PendingUpdatesSnapshot(DateTimeOffset.UtcNow, Array.Empty())); + await cut.InvokeAsync(() => { }); + await cut.InvokeAsync(() => { }); + + Assert.Null(typeof(PendingUpdatesHealthTiles) + .GetField("_timer", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic)! + .GetValue(tiles)); + Assert.Equal(0, cache.Subscribers); + } + + /// Disposed while the cascaded auth state is still pending, the tiles never subscribe. + /// A task that represents the asynchronous operation. + [Fact] + public async Task DisposedBeforeAuthResolves_NeverSubscribes() + { + var cache = new CountingCache(); + var auth = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); + Services.AddScoped(); + Services.AddSingleton(cache); + var cut = Render(ps => ps.AddCascadingValue(auth.Task)); + var tiles = cut.Instance; + await cut.InvokeAsync(tiles.Dispose); + + auth.SetResult(new AuthenticationState(new ClaimsPrincipal( + new ClaimsIdentity(new[] { Role(Roles.Deployer) }, "TestAuth")))); + await cut.InvokeAsync(() => { }); + await cut.InvokeAsync(() => { }); + + Assert.Equal(0, cache.Subscribers); + } } diff --git a/tests/ZB.MOM.WW.ScadaBridge.CentralUI.Tests/Pages/HealthPageTests.cs b/tests/ZB.MOM.WW.ScadaBridge.CentralUI.Tests/Pages/HealthPageTests.cs index 99669941..0385a7a2 100644 --- a/tests/ZB.MOM.WW.ScadaBridge.CentralUI.Tests/Pages/HealthPageTests.cs +++ b/tests/ZB.MOM.WW.ScadaBridge.CentralUI.Tests/Pages/HealthPageTests.cs @@ -894,4 +894,39 @@ public class HealthPageTests : BunitContext Nodes: Array.Empty()))); } } + + /// + /// Code review 2026-12-02 UI-4: navigating away while the initial loads are still running + /// disposes the page first; the load's continuation must then not create the 10 s refresh + /// timer (it would never be disposed and would root the dead circuit). + /// + /// A task that represents the asynchronous operation. + [Fact] + public async Task DisposedDuringInitialLoad_CreatesNoRefreshTimer() + { + SeedSites("site-a"); + var entered = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); + var gate = new TaskCompletionSource>(TaskCreationOptions.RunContinuationsAsynchronously); + var kpiHistory = Substitute.For(); + kpiHistory.GetSeriesAsync( + Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), + Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()) + .Returns(_ => { entered.TrySetResult(); return gate.Task; }); + Services.AddSingleton(kpiHistory); + + var host = RenderHealthPage(); + await entered.Task.WaitAsync(TimeSpan.FromSeconds(10)); // the last load phase is in flight + var page = host.Instance; + await host.InvokeAsync(page.Dispose); + + gate.SetResult(SampleSeries()); + host.WaitForAssertion(() => Assert.False((bool)typeof(HealthPage) + .GetField("_trendsLoading", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic)! + .GetValue(page)!)); + await host.InvokeAsync(() => { }); + + Assert.Null(typeof(HealthPage) + .GetField("_refreshTimer", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic)! + .GetValue(page)); + } }