Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 0 additions & 50 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue14364.cs

This file was deleted.

This file was deleted.

18 changes: 2 additions & 16 deletions src/Core/src/Platform/Android/ViewExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -649,23 +649,9 @@ internal static IDisposable OnLoaded(this View view, Action action)
return;
}

// Store local reference to allow cancellation inside the Post callback
var localDisposable = disposable;
disposable?.Dispose();
disposable = null;
view.Post(() =>
{
if (view.IsAttachedToWindow && localDisposable is not null)
{
action();
localDisposable.Dispose();
}
else if (localDisposable is not null)
{
// View was detached before Post ran (e.g., ViewPager2 detach/re-attach cycle).
// Restore disposable so the next ViewAttachedToWindow can retry.
disposable = localDisposable;
}
});
action();

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)

[major] Logic and Correctness Verification — Calling action() synchronously on ViewAttachedToWindow reintroduces pre-layout Loaded timing, so size-dependent logic can observe invalid dimensions. Concrete scenario: a control reads Width/Height in Loaded before the first Android layout pass and receives unset/-1 values (the Issue14364 reproduction that this PR also deletes).

};

view.ViewAttachedToWindow += routedEventHandler;
Expand Down
Loading