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 10311 [details]
The lifecycle methods Awake and WillActivate are being called after the content of the first interface controller in an app is displayed on the simulator. This leads to controls that can be interacted with by the user before and controller is fully initialized. Apple says that the UI should not be displayed until after these methods have been called. See the thread I started in the Apple forums:
I included a trivial test case where the UI has only a button. You can see the UI displayed before the methods are called in the following screencast:
The above was run on a fresh simulator (meaning I reset the content of the sim prior to running the app)
Also, here's another screencast of the same app where I can tap on the button and it's code runs before WillActivate:
Let me know if you need any other info.
Curiously, I tried the test case again just to see if I can repro this every time, which I could, but in one case I got the iOS simulator to deadlock.
As you see in this screencast (I've been known to like screencasts ;) both the watch sim and the iPhone are deadlocked (can't click the watch app button and can't do anything on the iPhone sim):
This seems strange, because the UI in the watch simulator is one process (the watch app), and the code you're debugging is another process (the watch extension).
I'm not sure how Apple has synchronized the two, but it doesn't seem logical that the watch will hang until it has contacted the phone. Yet the deadlocked watch/sim seems to indicate that there is some synchronization going on.
@olf where you able to duplicate ?
IIRC that kind of situation can come up (outside of watchkit) if the .ctor calls some methods/properties that will trigger the rest of the initialization (part of why calling virtual methods from a .ctor is a bad idea ;-).
Empty constructor in this case (just what's added by the XS template):
public InterfaceController (IntPtr handle) : base (handle)
I can reproduce this, but if I set the button's Identity/Name to something in the designer I can't reproduce anymore, which means this is something iOS does and not a problem with Xamarin.iOS.
Weird, so basically creating an outlet to the button made the issue go away?
@Mike, my guess is that without the outlet iOS for some reason decides to display a static UI at first, then loads the extension and your code.