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 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.
Created attachment 1128 [details]
MonoTouch project repoducing the issue
See question here on stackoverflow: http://stackoverflow.com/questions/8738013/monotouch-asynchronous-uisearchbar
Basically I'm getting this crash when creating an asynchronous UISearchBar:
2012-01-04 23:05:11.589 myApp[98047:2407] -[MainController tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0xb0ea840
at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication.UIApplicationMain (int,string,intptr,intptr) <IL 0x0009f, 0xffffffff>
at MonoTouch.UIKit.UIApplication.Main (string,string,string) [0x00042] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:29
at MyApp.Application.Main (string) [0x00000] in /Users/jonathanpeppers/Projects/MyApp/Main.cs:13
at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) <IL 0x00050, 0xffffffff>
I attached a repro.
To reproduce, search something, then hit cancel or select a search. Search again, after typing the first letter, the crash occurs.
- override `WillBeginSearch` in `UISearchDisplayDelegate`
- set `_searchController.SearchResultsTableView.Source` to null
- when you have results to display, set `_searchController.SearchResultsTableView.Source` to the table view source
Does this still seem to be a bug?
Thanks for providing the test case. I can duplicate the issue and will look into it.
A simpler workaround is adding:
_searchController.SearchResultsSource = _tableSource;
before the line:
It looks like the managed code knows the _tableSource (it's there while debugging) but the objectiveC side does not (anymore). I'll keep digging inside this.
This is not a binding bug (I checked them to be sure). In ViewDidLoad replace
SearchDisplayController.SearchResultsTableView.Source = _tableSource;
SearchDisplayController.SearchResultsSource = _tableSource;
and this will fix your issue. It's weird (and badly documented IMO) but accessing the SearchResultsTableView.Source seems to mess with the internal controller state (it has it's own stuff).