Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

25421- ListViewRenderer Crash in HostApp and BindingError was occured in windows platforms #25440

Closed
wants to merge 2 commits into from
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -802,6 +802,9 @@ void OnListItemClicked(object sender, ItemClickEventArgs e)

void OnControlSelectionChanged(object sender, WSelectionChangedEventArgs e)
Copy link
Member

Choose a reason for hiding this comment

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

Did we validate if this subscription needs to be removed?

List.SelectionChanged += OnControlSelectionChanged;

I'm still wondering if the handler is getting disconnected and we're not disconnecting all the proper events

Choose a reason for hiding this comment

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

@PureWeen In Windows, the view renderer is not being disconnected properly. Currently, all events are only disconnected in the Dispose() method. We should override DisconnectHandlerCore(like below code) for all view renderers and ensure all events are properly disconnected. As a short-term fix to resolve the UI test case issue, we added a null check for Element
private protected override void DisconnectHandlerCore()
{
// disconnect all the events.
}

{
if (Element is null)
return;

bool areEqual = false;

if (Element.SelectedItem != null && Element.SelectedItem.GetType().IsValueType)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ public CorePageView(Page rootPage)
template.SetBinding(TextCell.TextProperty, "Title");
template.SetBinding(TextCell.AutomationIdProperty, "TitleAutomationId");

BindingContext = _pages;
ItemTemplate = template;
ItemsSource = _pages;

Expand Down
Loading