Skip to content

StephenClearyExamples/XamarinRepro1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

122 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Xamarin bug repro #1

In some cases, an OnTouchListener used for swipe detection can cause an ObjectDisposedException for a GestureDetector instance.

This problem only shows up when using the Tarjan GC, both with and without concurrent GC. Setting MONO_GC_PARAMS=bridge-implementation=new prevents the exception.

This seems similar to several other bugs (this one in particular). However:

  • This repro is occurring on Xamarin.Android, not Xamarin.Forms.
  • This repro is using a RecyclerView of text views, not images and not ListView like many similar bugs.
  • This repro uses explicit GCs to encourage the bug to manifest quickly. Hundreds of swipes are not necessary to repro.

To repro:

  1. Start the project (on a device or emulator). You should see a list of numbers.
  2. Scroll the list.

You should see an exception:

System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'Android.Views.GestureDetector'.
  at Java.Interop.JniPeerMembers.AssertSelf (Java.Interop.IJavaPeerable self) [0x00029] in <e8c0e16a54534fa885244f0ad837c79e>:0 
  at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualBooleanMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x00000] in <e8c0e16a54534fa885244f0ad837c79e>:0 
  at Android.Views.GestureDetector.OnTouchEvent (Android.Views.MotionEvent ev) [0x00031] in <848bbd7c681a4975918c72f17d2f5144>:0 
  at PewBibleKjv.SwipeTouchListener.OnTouch (Android.Views.View v, Android.Views.MotionEvent e) [0x00002] in C:\\Work\\XamarinRepro1\\PewBibleKjv\\SwipeTouchListener.cs:24

About

Xamarin.Android RecyclerView with OnTouchListener can cause ObjectDisposedException for GestureDetector

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages