Bug 42330 - ListView RefreshCommand CanExecute causes Attempting to change the refresh control while it is not idle is strongly discouraged and probably won't work properly
Summary: ListView RefreshCommand CanExecute causes Attempting to change the refresh co...
Alias: None
Product: Forms
Classification: Xamarin
Component: iOS ()
Version: 2.3.1
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2016-07-01 19:18 UTC by John Miller [MSFT]
Modified: 2017-03-29 12:43 UTC (History)
5 users (show)

Tags: AC
Is this bug a regression?: ---
Last known good build:

Sample Project (15.69 KB, application/zip)
2016-07-01 19:18 UTC, John Miller [MSFT]

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report for Bug 42330 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description John Miller [MSFT] 2016-07-01 19:18:36 UTC
Created attachment 16554 [details]
Sample Project


   ListView.RefreshCommand obeys the CanExecute method and removes the UIRefreshControl when CanExecute is false. When this happens, the UIRefreshControl is removed which causes a warning and undesired behavior. 

**Steps to Reproduce:**

   1. Run the attached sample on an iOS simulator
   2. Pull down to refresh on the ListView

**Actual Results:**

   The UIRefreshControl disappears as soon as the command starts, and a warning is outputted: 

> Attempting to change the refresh control while it is not idle is strongly discouraged and probably won't work properly.

**Expected Results:**

   It's more desirable that the UIRefreshControl does not get removed from the UITableView. Instead, it could just not execute the command if it's CanExecute is false. We don't want the control to disappear while a RefreshCommand is executing. Instead, we may want to handle some logic in the ViewModel when CanExecute is false. 

**Build Date & Platform:**

   XF 2.3
   iOS 9.X

**Additional Information:**

   This really affects ReactiveCommand in ReactiveUI because it automatically changes the CanExecute as soon as you Execute the ReactiveCommand. This means that every time you Refresh with the ListView, the indicator disappears and the warning is outputted. However, the attached sample reproduces the same behavior in a realistic scenario without using ReactiveUI or ReactiveCommand.

This is very similar to https://bugzilla.xamarin.com/show_bug.cgi?id=32858, except it does look like the code calls EndRefreshing: https://github.com/xamarin/Xamarin.Forms/blob/2.3.0/Xamarin.Forms.Platform.iOS/Renderers/ListViewRenderer.cs#L1058

Related code:

Comment 2 Erlend Angelsen 2017-03-29 12:43:29 UTC
I'm experiencing the same problem with ReactiveCommand and pull to refresh in Xamarin Forms