Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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 47748 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
In special cases on GitHub you might also want the comments:
GitHub Markdown with public comments
Created attachment 18622 [details]
Project to demonstrate the bug
I have been wrestling with an issue that I finally isolated to being related to Presenting a VC from RowSelected vs. other places like a button hit.
I see this on a device running iOS 9.2.1 but not in the iOS10 simulator. My hands are tied testing on other platforms.
When I present a view controller from the RowSelected override in my table source, I see a delay of 5 to 10 seconds before the view controller is loaded and displayed. After the initial presentation, it is usually faster but still sometimes very slow.
After much trial and error and just plain trying stuff, I found that if I presented the ViewController inside a BeginInvokeOnMainThread() handler the delay goes away.
Here is what I had to do. I worked this in a test project that really was not doing anything else. (i.e. - no data retrieval and only UI for test)
public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
var item1VC = new Item1XibController();
vc.PresentViewController(item1VC, true, null);
I have attached source code. I setup the table so that even rows do not call BeginInvokeOnMainThread so are slow and the odds rows do. and are always fast . The button in the header presents the vc without BeginOnvokeOnMainThread and is always fast.
Some logging spits out the time it takes for the vc to appear.
See RowSelected in BrowseTableSource and ItemSelected in BrowseViewController for pertinent code.
First of all thanks for providing a good test case.
For me, time to ViewDidAppear varies from 1478ms (no BeginInvokeOnMainThread) and 575ms when BeginInvokeOnMainThread is called (using the iOS 10 sim though).
Now looking at the current threads and call stack it does not seem the code is running from a background thread so `BeginInvokeOnMainThread` should, technically, not make a difference and yet it does.
We'll have to investigate a bit more, I'm marking this bug as confirmed.