Bug 26176 - ListView binding and SelectedItem cause an exception
Summary: ListView binding and SelectedItem cause an exception
Status: VERIFIED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.3.1
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-01-19 16:57 UTC by Kevin.Murray
Modified: 2015-02-19 06:01 UTC (History)
5 users (show)

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


Attachments
Sample project illustrating the exception. (4.20 MB, application/x-zip-compressed)
2015-01-19 16:57 UTC, Kevin.Murray
Details


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 on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
VERIFIED FIXED

Description Kevin.Murray 2015-01-19 16:57:18 UTC
Created attachment 9403 [details]
Sample project illustrating the exception.

iOS only, seems to work fine on Android.

I have attached a sample project illustrating the problem.  There are, in the sample, a few async/await calls to mimic what I am doing in my main project -- which gets the list items from a web service. Nevertheless, the call stack is mostly the same.  From one page you navigate to the second page (in the sample, click the "List..." button on the main page).  The second page loads, then an "InitializeData" call is made and awaited to set up the items in the list.  In my sample, this just runs a loop and sets a bunch of strings.  Then, an attempt is made to select one of the items in the list. 

This selection attempt will cause an exception in iOS:

NSRange Exception
Reason: -[UITableView _contentOffsetForScrollingToRowAtIndexPath:atScrollPosition:]: row (xx) beyond bounds (0) for section (0).
Comment 1 Naqeeb 2015-01-20 05:49:13 UTC
I am also able to reproduce this issue with the help of attached sample project in bug description, we are getting exception when we click on 'List' button. Hence marking this as Confirmed.

Supplement info:
Screencast: http://www.screencast.com/t/YVsq5qw1  
Xamarin log: https://gist.github.com/saurabh360/935d23d8c014fd05e273
Debug log: https://gist.github.com/saurabh360/815ef8d6f41b026f5d33
mtb server log: https://gist.github.com/Mohit-Kheterpal/226edb6d87df7b3f4239

Environment info:
Microsoft Visual Studio Professional 2013
Version 12.0.31101.00 Update 4
Microsoft .NET Framework
Version 4.5.50938
Xamarin   3.9.236.0 (d6a2cae)
Xamarin.Android   4.20.0.34 (49a04b966feb40dfdba49d57ba16249b66d606a6)
Xamarin.iOS   8.6.0.0 (eb24bdcf5cba2c12b673a07e0a8cce368b9563b3)
Xamarin.iOS Unified Migration   1.0
Xcode 5.1.1(5085)
Comment 2 Eric Maupin 2015-01-30 13:28:06 UTC
This should be fixed in 1.3.2-pre2
Comment 3 Naqeeb 2015-02-19 06:01:06 UTC
I have checked this issue with Xamarin.Forms 1.3.5.6333-pre1 and now its working fine. if I click the 'List' button then it shows items list correctly without any exception.

Screencast: http://www.screencast.com/t/KSt6KZPof

Hence closing this issue.

Environment info:
Microsoft Visual Studio Professional 2013
Version 12.0.31101.00 Update 4
Microsoft .NET Framework
Version 4.5.50938

Xamarin   3.9.325.0 (96e7814)
Xamarin.Android   4.20.0.34 (49a04b966feb40dfdba49d57ba16249b66d606a6)
Xamarin.iOS   8.6.2.0 (09ae75f83eafce1bdc3fa067f281cbdf1ca7b893)
Xamarin.iOS Unified Migration   1.0