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.
After upgrading to the latest Xamarin Studio (5.9.7), Xamarin.iOS (184.108.40.206), there is a problem where I am overriding UITableViewHeaderFooterView:-
public class AlterationHeaderFooterView : UITableViewHeaderFooterView
private readonly UILabel label;
public AlterationHeaderFooterView() : base()
this.label = new UILabel();
public override void LayoutSubviews()
this.label.Frame = new CGRect(15.0f, this.ContentView.Bounds.Height - 24.0f, this.ContentView.Bounds.Width, 24.0f);
The problem is that when I call:
LayoutSubviews is called BEFORE the code in the constructor runs and so "this.label" is null and crashes in LayoutSubviews
It looks like the call to base() constructor is doing something that means LayoutSubviews is called.
This didn't happen in the previous version I was using: Xamarin Studio 5.9.4, Xamarin.iOS 220.127.116.11
Created attachment 13927 [details]
Sample & Logs
I was able to reproduce the issue based on the information provided in the description and the following desk case: https://kb.xamarin.com/agent/case/232094.
Based on this, I've created a sample project containing the code snippet, as well as the logs from my reproduction of the issue.
This is just how it's implemented by Apple in iOS 9 (in earlier versions of iOS it's different).
The same thing happens in Objective-C: https://gist.github.com/rolfbjarne/d5cc9208c1df8e5d2841
Hi Rolf, I don’t think your test code is quite testing the exact issue.
You need to have a constructor for AlterationHeaderFooterView and log a message inside there.
Then check that that constructor message comes before the layoutSubviews one.
I've updated the Objective-C test case to show that a log message from layoutSubviews occur before a log message in the constructor with iOS 9.1 (but not iOS 8.2).
Interesting and a bit worrying in case Apple have introduced the same problem in any other classes...
Has Xamarin reported the bug to Apple?
No, we haven't reported anything to Apple (feel free to use my sample code if you wish to do so though).