Bug 15014 - UITableViewController: Constructor of sub class is being ignored when the base class constructor accesses TableView
Summary: UITableViewController: Constructor of sub class is being ignored when the bas...
Alias: None
Product: iOS
Classification: Xamarin
Component: Debugger ()
Version: 7.0.0.x
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2013-09-26 09:16 UTC by asp_net
Modified: 2013-09-27 06:13 UTC (History)
2 users (show)

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

Failing Test (1.43 MB, application/zip)
2013-09-26 09:16 UTC, asp_net

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 asp_net 2013-09-26 09:16:04 UTC
Created attachment 4994 [details]
Failing Test

I am currently porting an existing iOS 6 app to iOS 7 and am facing some strange behaviour when values passed to a new instance of a view controller by constructor are not available on ViewDidLoad().

This seems only to happen when the controller called is a sub class of another controller which accesses the TableView in its own constructor.

See a failing test attached.

I am currently on (Hash: 4cfca2f, Build date: 2013-20-09 23:14:32-0400).
Comment 1 Rolf Bjarne Kvinge [MSFT] 2013-09-26 09:28:58 UTC
This is normal.

Accessing TableView in DetailBaseDialog.ctor will end up calling ViewDidLoad, so you end up in DetailDialog's ViewDidLoad method before its ctor has been executed.
Comment 2 asp_net 2013-09-26 09:33:40 UTC
That's not the behaviour I would expect here. But ok.
Comment 3 Rolf Bjarne Kvinge [MSFT] 2013-09-27 03:22:09 UTC
Conceptually it's the equivalent to this: https://gist.github.com/rolfbjarne/8c9d4598d8e9ec2c511e, since Objective-C calls ViewDidLoad when you fetch the TableView property.
Comment 4 asp_net 2013-09-27 06:03:07 UTC
Okay. The strange thing about that is, that it worked until I switched to iOS 7.
Comment 5 Rolf Bjarne Kvinge [MSFT] 2013-09-27 06:13:19 UTC
What probably happened is that iOS doesn't call ViewDidLoad when fetching the TableView property in previous versions.