This repository has been archived by the owner on May 1, 2024. It is now read-only.
[Bug] [iOS] NRE on grouped ListView when removing cells with gesture recognizers #11381
Labels
e/2 🕑
2
i/high
Completely doesn't work, crashes, or is unusably slow, has no obvious workaround; occurs less often
in-progress
This issue has an associated pull request that may resolve it!
p/iOS 🍎
t/bug 🐛
Projects
Description
When working with a grouped list, if you add a gesture recognizer which handler ends modifying bound collection, a NRE is raised.
To reproduce the issue, I just modified public grouped ListView sample. Template was changed to include an Image with a
TapGestureRecognizer, which removes tapped cell and its group, if that group is no longer containing elements.
NRE is produced in iOS EventTracker.
Stack trace:
2020-07-09 17:17:46.650135+0200 groupingSampleListViewiOS[2527:32870]
Unhandled Exception:
System.NullReferenceException: Object reference not set to an instance of an object
at Xamarin.Forms.Platform.iOS.EventTracker.LoadRecognizers () [0x00059] in D:\a\1\s\Xamarin.Forms.Platform.iOS\EventTracker.cs:576
at Xamarin.Forms.Platform.iOS.EventTracker.OnElementChanged (System.Object sender, Xamarin.Forms.Platform.iOS.VisualElementChangedEventArgs e) [0x0004e] in D:\a\1\s\Xamarin.Forms.Platform.iOS\EventTracker.cs:644
at Xamarin.Forms.Platform.iOS.VisualElementRenderer
1[TElement].OnElementChanged (Xamarin.Forms.Platform.iOS.ElementChangedEventArgs
1[TElement] e) [0x00020] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementRenderer.cs:384at Xamarin.Forms.Platform.iOS.ViewRenderer
2[TView,TNativeView].OnElementChanged (Xamarin.Forms.Platform.iOS.ElementChangedEventArgs
1[TElement] e) [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.iOS\ViewRenderer.cs:129at Xamarin.Forms.Platform.iOS.ImageRenderer.<>n_
_0 (Xamarin.Forms.Platform.iOS.ElementChangedEventArgs
1[TElement] e) <0x117289fa0 + 0x0005a> in <b4a6bff6d9dc43cf83129db67d9306c1>:0 at Xamarin.Forms.Platform.iOS.ImageRenderer.OnElementChanged (Xamarin.Forms.Platform.iOS.ElementChangedEventArgs
1[TElement] e) [0x000a8] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\ImageRenderer.cs:77at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.b__7_0 (System.Object state) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1021
at Foundation.NSAsyncSynchronizationContextDispatcher.Apply () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.16.0.13/src/Xamarin.iOS/Foundation/NSAction.cs:178
--- End of stack trace from previous location where exception was thrown ---
at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
at UIKit.UIApplication.Main
(System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.16.0.13/src/Xamarin.iOS/UIKit/UIApplication.cs:86
at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0000e] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.16.0.13/src/Xamarin.iOS/UIKit/UIApplication.cs:65
at GroupingSampleListView.Application.Main (System.String[] args) [0x00001] in D:\repos\Samples\Xamarin_Forms___ListView_Grouping\groupingSampleListView\iOS\Main.cs:17
2020-07-09 17:17:46.651465+0200 groupingSampleListViewiOS[2527:32870] Unhandled managed exception: Object reference not set to an instance of an object (System.NullReferenceException)
at Xamarin.Forms.Platform.iOS.EventTracker.LoadRecognizers () [0x00059] in D:\a\1\s\Xamarin.Forms.Platform.iOS\EventTracker.cs:576
at Xamarin.Forms.Platform.iOS.EventTracker.OnElementChanged (System.Object sender, Xamarin.Forms.Platform.
iOS.VisualElementChangedEventArgs e) [0x0004e] in D:\a\1\s\Xamarin.Forms.Platform.iOS\EventTracker.cs:644
at Xamarin.Forms.Platform.iOS.VisualElementRenderer
1[TElement].OnElementChanged (Xamarin.Forms.Platform.iOS.ElementChangedEventArgs
1[TElement] e) [0x00020] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementRenderer.cs:384at Xamarin.Forms.Platform.iOS.ViewRenderer
2[TView,TNativeView].OnElementChanged (Xamarin.Forms.Platform.iOS.ElementChangedEventArgs
1[TElement] e) [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.iOS\ViewRenderer.cs:129at Xamarin.Forms.Platform.iOS.ImageRenderer.<>n__0 (Xamarin.Forms.Platform.iOS.ElementChangedEventArgs
1[TElement] e) <0x117289fa0 + 0x0005a> in <b4a6bff6d9dc43cf83129db67d9306c1>:0 at Xamarin.Forms.Platform.iOS.ImageRenderer.OnElementChanged (Xamarin.Forms.Platform.iOS.ElementChangedEventArgs
1[TElement] e) [0x000a8] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\ImageRenderer.cs:77at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.b__7_0 (System.Object state) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1021
at Foundation.NSAsyncSynchronizationContextDispatcher.Apply () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.16.0.13/src/Xamarin.iOS/Foundation/NSAction.cs:178
--- End of stack trace from previous location where exception was thrown ---
at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.16.0.13/src/Xamarin.iOS/UIKit/UIApplication.cs:86
at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0000e] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.16.0.13/src/Xamarin.iOS/UIKit/UIApplicati
on.cs:65
at GroupingSampleListView.Application.Main (System.String[] args) [0x00001] in D:\repos\Samples\Xamarin_Forms___ListView_Grouping\groupingSampleListView\iOS\Main.cs:17
Steps to Reproduce
I was able to reproduce it on every run using iPhone 11 simulator from Windows.
Expected Behavior
Not having a NRE.
Actual Behavior
NRE is raised.
Basic Information
Screenshots
Reproduction Link
Xamarin_Forms___ListView_Grouping.zip
Workaround
Instead of using Image + Recognizer you can try with a button with opacity.
The text was updated successfully, but these errors were encountered: