Bug 15002 - Unhandled NSUnknownKeyException after adding outlet in storyboard editor
Summary: Unhandled NSUnknownKeyException after adding outlet in storyboard editor
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: iOS ()
Version: 3.7
Hardware: PC Mac OS
: High major
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2013-09-25 20:53 UTC by Peter Huene
Modified: 2015-01-07 05:24 UTC (History)
13 users (show)

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

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 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 Peter Huene 2013-09-25 20:53:17 UTC
Platform: OSX 10.8.5
Product: Xamarin Studio
Version: 4.1.12 (not yet in version dropdown)

Unhandled exception having to do with an outlet generated by the storyboard editor.

Steps to reproduce:
1. Create a new solution (iOS -> iPhone Storyboard -> Single View Application).
2. Run the application on a physical device.
3. Open MainStoryboard.storyboard in the storyboard editor.
4. Select the UIView.
5. Give the UIView a name in the identity properties in the storyboard editor (e.g. "foo").
6. Save the storyboard.
7. Open the view controller's designer file to confirm that the outlet was added as a property with the given name.
8. Run the application on the device again.

The application runs and displays the initial view.

Objective-C exception thrown.  Name: NSUnknownKeyException Reason: [<ReproViewController 0x1ed85250> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key foo.

Rebuilding the solution (or clean and then build) causes the application to run without issue.

Additional information:
I suspect this is a deployment issue to a physical device because the controller has the expected outlet property in the generated IL and native assembly and I can't reproduce it with the iOS simulator.
Comment 1 Alexandre Rocha Lima e Marcondes 2014-01-22 21:11:19 UTC
I have the same problem reported here: http://stackoverflow.com/questions/21256818/monotouch-key-value-coding-compliant-crashes-on-running-a-storyboard-project/21274766#21274766

We have a repository on github with code to reproduce this problem: https://github.com/arlm/StoryboardTables
Comment 2 Alan McGovern 2014-01-23 00:29:56 UTC
Jeff, this sounds like its related to the iOS build/deploy logic as opposed to the iOS designer itself. Would you mind taking a look?
Comment 3 Jeffrey Stedfast 2014-01-23 06:46:09 UTC
It isn't a problem with building/deploying.

I forget what that exception means, but likely the class is missing an attribute or perhaps the storyboard file isn't correct?

Adding Sebastien to the Cc, maybe he has some ideas.
Comment 4 Alan McGovern 2014-01-23 08:19:13 UTC
Since a clean and rebuild fixes the issue, it sounds like it must have something to do with build/deploy as opposed to a broken storyboard or generated class.
Comment 5 Alan McGovern 2014-03-03 23:05:47 UTC
Closing this as it's not an ios designer bug and we have no repro for it. If there is a simple way to repro the bug do let us know and we will reopen and reassign this appropriately.
Comment 6 Alexandre Rocha Lima e Marcondes 2014-03-03 23:38:09 UTC
Alan, have you tried to reproduce using an iOS device as stated on this repository: https://github.com/arlm/StoryboardTables ?
Comment 7 Alan McGovern 2014-03-04 00:08:58 UTC
Oh, my mistake. I didn't realise there was a repro available.

Reassigning this to Jeff so he can investigate why it fails for devices and not sims.
Comment 8 Jeffrey Stedfast 2014-03-13 12:34:13 UTC
reassigning to the Xamarin.iOS team - this doesn't seem to have anything to do with Xamarin Studio
Comment 9 Stuart Lodge 2014-10-23 06:26:27 UTC
This is still very much present in the latest tools and it's a really poor first user experience.

I tried a clean install (new VM) for Windows with VS2013 and Xam stable installed - ios

I then built a single view project and tested it was working.

I then added a label in the storyboard.

Try to run it - get the fatal key-value compliant error.

Eventually found that "clean" and "rebuild" clears the error.
Comment 10 Alan McGovern 2014-10-23 09:03:06 UTC
I presume you are using the VS product so I'll reassign the bug there. If that's not the case then do let me know.

Also, as this bug is being fixed by a clean + rebuild then it is likely to be an issue with the build system. Re-assigning to the iOS extension so they can diagnose it issue.
Comment 11 Stuart Lodge 2014-10-24 07:32:52 UTC

Yes, I'm using Xam.iOS inside Visual Studio

I'm seeing several problems that require clean+rebuild at the moment, plus I see "Debugging session ended" far too often for my (already limited) sanity :)

I'm not sure all emails from bugzilla are getting through - so please email me directly (me@slodge.com) if there's follow-up info needed.
Comment 12 Daniel Cazzulino 2014-12-01 08:10:47 UTC
As noted by the first report, this also applies to XS:

Platform: OSX 10.8.5
Product: Xamarin Studio
Version: 4.1.12 (not yet in version dropdown)

Hence, I don't think it's a VS-specific issue. It looks like the codegen trigger from the designer isn't generating the right output or something like that? Maybe it's generating outdated .cs? Maybe the file isn't saved yet when the build triggers?
Comment 13 Alan McGovern 2014-12-01 08:31:51 UTC
This workflow is heavily tested by unit tests and QA. If there is a reliable way to reproduce the issue we might be able to make progress by examining the MSBuild output to see if the build actually executed or not.

For this to be a designer bug we would need a repro where a change was made to the storyboard file and then the corresponding .designer.cs was not rewritten. No-one has found such a repro yet so it still looks like 'not a designer bug'. If that repro can be found, then please reassign to me.
Comment 14 Alan McGovern 2015-01-07 05:24:44 UTC
As there have been no further reports of this, i'll just close the bug. Whatever this was, it seems to be gone.