Bug 51749 - Xamarin iOS crashes on ScrollToBottom
Summary: Xamarin iOS crashes on ScrollToBottom
Alias: None
Product: Forms
Classification: Xamarin
Component: iOS ()
Version: 2.3.4
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Paul DiPietro [MSFT]
Depends on:
Reported: 2017-01-25 00:39 UTC by Philipp Sumi
Modified: 2017-03-16 18:44 UTC (History)
4 users (show)

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

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:

Description Philipp Sumi 2017-01-25 00:39:07 UTC
I have ListView bound to an ObservableCollection. When I add an item to the collection, it crashes hard on iOS, Android is fine:

Application Specific Information:
*** Terminating app due to uncaught exception 'NSRangeException', reason: '-[UITableView _contentOffsetForScrollingToRowAtIndexPath:atScrollPosition:]: row (0) beyond bounds (0) for section (0).'

The reason seems to be that I invoke this here in the code-behind:

        private void ScrollToBottom()
            var lastItem = ChatViewModel.Messages.LastOrDefault();
            if (lastItem == null) return;
            MessageList.ScrollTo(lastItem, ScrollToPosition.MakeVisible, true);

That wasn't working very well anyway, but crashing the whole app is just rude ;)
Comment 1 Philipp Sumi 2017-01-25 09:53:52 UTC
Note: I removed the code in question, but if you can't verify, maybe visibility of the control plays into it, too.
Comment 2 Paul DiPietro [MSFT] 2017-02-27 18:59:56 UTC
Can you upload a reproduction for us to look at?
Comment 3 Philipp Sumi 2017-03-16 11:52:44 UTC
No repro here - I got rid of all the ListViews in my app and replaced them by a custom solution, sorry.
Comment 4 Samantha Houts [MSFT] 2017-03-16 18:44:07 UTC
@Philipp Sumi: Thank you for letting us know! I will close this report for now until we can get further information about it, since we can't know for sure if we've resolved it without a definitive test case to work against. Please feel free to reopen it later or submit another report if you encounter any further issues. Thank you again for your report!