Element.OnChildRemoved() - Incorrect variable used in function. #12633
Labels
fixed-in-7.0.58
Look for this fix in 7.0.58!
fixed-in-7.0.100
fixed-in-7.0.101
fixed-in-8.0.0-preview.1.7762
Look for this fix in 8.0.0-preview.1.7762!
t/bug
Something isn't working
Milestone
Wrong variable in function call prevents retrieving required information:
ChildRemoved?.Invoke(child, new ElementEventArgs(child));
The first parameter should be "this" not "child", as its already in the second parameters EventArgs and not the sender.
Here is the ChildAdded line for comparison, with the correct parameters:
ChildAdded?.Invoke(this, new ElementEventArgs(child));
Element.cs lines 344-370 :
`
The following call throws "Specified cast is not valid." error as the sender is incorrectly set.
childPage.ChildRemoved += (s, e) => System.Diagnostics.Debug.WriteLine(((NavigationPage)s).Height);
Element.cs Line 363 should be written as:
ChildRemoved?.Invoke(this, new ElementEventArgs(child));
The text was updated successfully, but these errors were encountered: