Bug 999 - Fatal unhandled Exception occurred when user selects <projectname>ViewController as Main Interface and then run the script.
Summary: Fatal unhandled Exception occurred when user selects <projectname>ViewControl...
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: iOS add-in ()
Version: 2.8 Beta 2
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: ---
Assignee: Jeffrey Stedfast
: 6847 ()
Depends on:
Reported: 2011-09-22 12:26 UTC by narayanp
Modified: 2013-04-02 12:42 UTC (History)
5 users (show)

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

Image for the bug (159.70 KB, image/jpeg)
2011-09-22 12:26 UTC, narayanp

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 narayanp 2011-09-22 12:26:08 UTC
Created attachment 470 [details]
Image for the bug

Steps to reproduce:
1. Launch the MonoDevelop.
2. Create a solution of MonoTouch Single View application.
3. Double click on .xib file and add few buttons and label.
4. Add outlets and Actions.
5. Modify AppDelegate.cs file accordingly.
6. Run the application.
7. See application is running successfully.
8. Now open Info.plist.
9. Select <projectname>ViewController as Main Interface from the drop down list.
10. Now RUN the application.
11. See exception occurred.

Actual result:
Fatal exception is occurred when user selects <projectname>ViewController as Main Interface and then run the script. Refer the attached screenshot.

Expected result:
Fatal exception should not be occurred when user selects <projectname>ViewController as Main Interface and then run the script. Refer the attached screenshot.

VM: Parallel Desktop 
OS:  Lion 10.7 (Guest Operating System)
MonoTouch 4.9
MonoDevelop 2.8 beta 2
Mono Framework for MAC OS X Intel Runtime
Xcode 4.1
Comment 1 Miguel de Icaza [MSFT] 2011-09-27 11:32:52 UTC
Mike, how are we populating the list of valid classes for the "Main Interface" UI?

I suspect that this is not really a bug, but a user error.
Comment 2 Mikayla Hutchinson [MSFT] 2011-09-27 11:51:26 UTC
The Main Interface combo doesn't show classes, it shows all xib and storyboard files. If a Main Interface is specified, it will be loaded by UIApplicationMain. The File's Owner will be the NSApplication instance. A xib file used as a main Interface is expected to contain an app delegate object (an object with a custom class that adopts the NSApplicationDelegate protocol) that's connected to the File's owner delegate outlet.

We could filter the list to show only classes that are valid as main interface files, but it would be very expensive for very little gain. We'd have to inspect all xib files in the projects for objects that connect to a delegate outlet on File's Owner, resolve those objects' custom classes, and check whether they're valid app delegates.

Note that the default xib templates are designed not to use a Main Interface file. Instead they pass the app delegate class name to UIApplication.Main.
Comment 3 Jeffrey Stedfast 2012-11-15 12:55:53 UTC
*** Bug 6847 has been marked as a duplicate of this bug. ***
Comment 4 Jeffrey Stedfast 2013-04-02 12:42:21 UTC
closing as user error