Open dhpanteon opened 5 years ago
I have a similar issue:
System.ArgumentException: An item with the same key has already been added. Key: 0
Dictionary`2[TKey,TValue].TryInsert (TKey key, TValue value, System.Collections.Generic.InsertionBehavior behavior)
Dictionary`2[TKey,TValue].Add (TKey key, TValue value)
TouchHandler.OnTouch (System.Object sender, Android.Views.View+TouchEventArgs args)
View+IOnTouchListenerImplementor.OnTouch (Android.Views.View v, Android.Views.MotionEvent e)
Platform+DefaultRenderer.DispatchTouchEvent (Android.Views.MotionEvent e)
View.n_DispatchTouchEvent_Landroid_view_MotionEvent_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_e)
I think this is duplicate of https://github.com/OndrejKunc/SkiaScene/issues/2
The problem occurs when your layout is nested inside ScrollViewer or another component which can cause touch conflicts, and we are not able to detect release finger events on iOS.
There is even a merge request attempting to solve it but I was not convinced it will solve the issue without introducing another problems like memory leaks or wrong behavior.
I may revisit the issue soon since there are still a lot of reports. But honestly, I still don't know the correct solution besides just not using this component inside a ScrollViewer. One possible way might be just print warning message and let the app run even though it may not work correctly.
This exception is not iOS only, it's reproducible on Android as well, I have similar issue in my android project:
System.ArgumentException: An item with the same key has already been added. Key: 1
TouchTracking.Droid.TouchHandler.OnTouch (System.Object sender, Android.Views.View+TouchEventArgs args)
Edit: If this can help, my project is Xamarin Native, and there's no scroll viewers wrapping the skiasharp canvas
System.Collections.Generic.KeyNotFoundException: The given key '0' was not present in the dictionary.
Can you pl fix this issue asap.?