Bug 203 - InstallApplication throwing NullReferenceException
Summary: InstallApplication throwing NullReferenceException
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: 4.x
Hardware: Macintosh Mac OS
: --- blocker
Target Milestone: Untriaged
Assignee: Sebastien Pouliot
Depends on:
Reported: 2011-08-05 15:00 UTC by Ken Budris
Modified: 2011-08-05 17:18 UTC (History)
2 users (show)

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

Zipped MonoTouch solution folder (6.23 MB, application/x-zip-compressed)
2011-08-05 15:00 UTC, Ken Budris

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 Ken Budris 2011-08-05 15:00:27 UTC
Created attachment 74 [details]
Zipped MonoTouch solution folder

Please type your reply at the top of the email... 
Miguel de Icaza 
AUG 05, 2011  |  02:24PM EDT
Sadly, the support system stripped the attachment out.

Would you mind opening a bug report at http://bugzilla.xamarin.com and attaching the test case there? Also, make sure you click "Private" when you attach the sample, so only we can look at it. 
AUG 05, 2011  |  01:50PM EDT 
I attempted to send an e-mail with a 6MB attachment and it bounced back. Do you have an FTP site?

From: Ken Budris
Sent: Friday, August 05, 2011 1:40 PM
To: 'support@xamarin.com'
Subject: RE: InstallApplication throwing NullReferenceException


Attached (if it doesn’t get blocked due to 6MB size) please find the stripped-down solution that you requested. There are two interesting things about this solution:

1. If I attempt to deploy it to a device I get the exception I originally noted below. (Note: Using a different provisioning profile and the same developer certificate I’m able to deploy a different app from the same system to the same device.)

2. If I delete either ImageList.cs or ImageElement.cs I’m unable to launch the app in the simulator.
Any help you can offer would be much appreciated.

Ken Budris

From: Xamarin Support [mailto:support@xamarin.com]
Sent: Thursday, August 04, 2011 5:33 PM
To: Ken Budris
Subject: Re: InstallApplication throwing NullReferenceException 
Miguel de Icaza 
AUG 04, 2011  |  05:33PM EDT
Perhaps the developer certificates are invalid?

Can you trim down the solution to the bare bones and send us the skeleton that still fails? 
AUG 04, 2011  |  05:23PM EDT 

Thanks for the quick response. I hope all is going well at Xamarin. I’m thrilled you guys were able to obtain the necessary rights to the current MonoTouch code and that you’ve taken over support.

I have another app that I’m able to successfully deploy to the device. The app that I’m having trouble with was developed elsewhere—this is the first time I’m trying to deploy this app to a device from my system.


From: Xamarin Support [mailto:support@xamarin.com]
Sent: Thursday, August 04, 2011 4:14 PM
To: Ken Budris
Subject: Re: InstallApplication throwing NullReferenceException 
Miguel de Icaza 
AUG 04, 2011  |  04:14PM EDT
Is this the first time that you deploy to the device? Or is this a new problem?

If this is the first time, perhaps you have not provisioned the device for development. This needs to be done from XCode. Launch XCode, and on the Organizer Window, select the device, right click and use "Add Device to Provisioning Portal" 
AUG 03, 2011  |  03:29PM EDT 
Original message 
When attempting to install my MonoTouch app onto a device from MonoDevelop 2.4.2, I'm getting the following in the output window:

/Developer/MonoTouch/usr/bin/mtouch -installdev="/Users/administrator/Projects/dermscope v1.4/canfield-dermscope/trunk/DermScope/DermScope/bin/iPhone/Debug/DermScope.app"
Please ensure your device is connected...
Connected to: CIS Development iPod1
Initializing file service...
Uploading application
Finalizing file service...
Connected to: CIS Development iPod1
Installing application

Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object
at MonoTouch.Installation.Installer.InstallApplication (object,System.EventArgs) <0x001b6>
at MonoTouch.Installation.Device.NotificationCallback (MonoTouch.Installation.Device/am_device_notification_callback_info&) <0x0006e>
at (wrapper native-to-managed) MonoTouch.Installation.Device.NotificationCallback (MonoTouch.Installation.Device/am_device_notification_callback_info&) <0x0003d>
at (wrapper managed-to-native) MonoTouch.CoreFoundation.CFRunLoop.CFRunLoopRun () <0x00003>
at MonoTouch.CoreFoundation.CFRunLoop.Run () <0x0000d>
at MonoTouch.Installation.Installer.InstallApplication (string) <0x00151>
at MTouch.Main (string[]) <0x032d1>

The application was terminated by a signal: SIGHUP

Console output from the device:

Aug 3 14:40:45 CIS-Development-iPod1 lockdownd[17] <Error>: 001ca000 handle_connection: Could not receive USB message #7 from mtouch. Killing connection

Aug 3 14:40:45 CIS-Development-iPod1 lockdownd[17] <Error>: 2ff6b000 handle_connection: Could not receive USB message #21 from mtouch. Killing connection

Aug 3 14:40:45 CIS-Development-iPod1 com.apple.mobile.lockdown[17] <Notice>: Could not receive size of messageCould not receive size of message

Aug 3 14:40:45 CIS-Development-iPod1 mobile_installation_proxy[251] <Error>: main: Could not receive request from host.

What's the best way to debug this?

Ken Budris
Canfield Scientific, Inc. 
For your reference this is Case #: 954 
Support powered by Assistly 
Comment 1 Sebastien Pouliot 2011-08-05 16:17:10 UTC
I can duplicate the NRE, I'll have a look into this.
Thanks for the test case!
Comment 2 Sebastien Pouliot 2011-08-05 16:50:27 UTC
The NRE happens because we cannot create a CFUrl from the string "file://localhost/Users/sebastienpouliot/Downloads/DermScope - stripped down/DermScope/bin/iPhone/Release/DermScope.app/".

I'll look if we can url-encode the spaces and make this work properly.

In the mean time the workaround is to remove the spaces from your solution path.
Comment 3 Sebastien Pouliot 2011-08-05 17:09:49 UTC
Fixed. Spaces will be welcome back in the next release :)
Comment 4 Ken Budris 2011-08-05 17:18:58 UTC
Yes, removing spaces from the solution folder name fixed the problem. Thank you!