Xamarin.forms: Android crash: InvalidCastException when ListView item is tapped under RecycleElement strategy

Created on 17 Jan 2018  路  2Comments  路  Source: xamarin/Xamarin.Forms

_Migrated from https://bugzilla.xamarin.com/show_bug.cgi?id=51648_

Description

Tapping a ListView item under some situations causes an InvalidCastException crash.

Original bug report says "list item", but I've only been able to reproduce it with a header.

The ListView's ListViewCachingStrategy must be RecycleElement or RecycleElementAndDataTemplate, and items must be added to the ListView after the page has loaded.

Steps to Reproduce

  1. Run the attached project on Android (tested on Android 6.0 in the simulator)
  2. Tap the list header

Expected Behavior

Nothing should happen

Actual Behavior

App crashes with InvalidCastException

Basic Information

  • Version with issue: 2.5.0.122203
  • Last known good version: unknown
  • IDE: VS for Mac 7.3
  • Platform Target Frameworks:

    • Android: 7.1

Reproduction Link

Android bug

Most helpful comment

@rmarinho could you specify which version of Xamarin.Forms contains the fix? Thank you.

All 2 comments

I got this exception when Calypso AppCrawler ran my app, maybe it will be helpful

@rmarinho could you specify which version of Xamarin.Forms contains the fix? Thank you.

Was this page helpful?
0 / 5 - 0 ratings