Bug 10593 - NullReferenceException when compiling to native code for iOS
Summary: NullReferenceException when compiling to native code for iOS
Alias: None
Product: iOS
Classification: Xamarin
Component: Tools ()
Version: 6.2.x
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Sebastien Pouliot
Depends on:
Reported: 2013-02-22 17:12 UTC by Doug Moore
Modified: 2013-02-23 18:49 UTC (History)
3 users (show)

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

Newtonsoft.Json.dll that caused failed compilation (346.50 KB, application/x-msdownload)
2013-02-23 18:49 UTC, Doug Moore

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:

Comment 1 Doug Moore 2013-02-22 17:13:37 UTC
Xamarin Studio
Version 4.0 (build 2003)
Installation UUID: db5f13c0-b528-4152-b4ca-59f176d3e244
	Mono 2.10.11 (mono-2-10/2baeee2)
	GTK 2.24.14
	GTK# (
	Package version: 210110000

Apple Developer Tools
Xcode 4.6 (2066)
Build 4H127

Xamarin.Mac: Not Installed

Version: 4.6.0 (Starter Edition)
Android SDK: /Users/lordscarlet/Library/Developer/Xamarin/android-sdk-mac_x86
	Supported Android versions:
		2.1 (API level 7)
		2.2 (API level 8)
		2.3 (API level 10)
		3.1 (API level 12)
		4.0 (API level 14)
Java SDK: /usr

Version: (Trial Edition)

Build Information
Git revision: Release ID: 400002003
Build date: 2013-02-20 00:32:59+0000
Xamarin addins: b7a7aff09b352c13ded8a27439fd6d2250361511

Operating System
Mac OS X 10.7.5
Darwin USSFlagg.local 11.4.2 Darwin Kernel Version 11.4.2
    Thu Aug 23 16:25:48 PDT 2012
    root:xnu-1699.32.7~1/RELEASE_X86_64 x86_64
Comment 2 Sebastien Pouliot 2013-02-22 20:34:10 UTC
I'm not 100% positive but many versions of Newtonsoft.Json.dll are not compatible with Xamarin.iOS because they refer to types only available in .NET 4 (and the product is still, mostly, based on the 2.1 profile - similar to Silverlight).

I see you have references to both Newtonsoft.Json.dll and Newtonsoft.Json.MonoTouch.dll.

Could you add "-v -v -v" to the "Additional mtouch arguments" of your project options. This will augment the verbosity of the build and might tell us more about the source of the exception.

It would also be helpful (if only to confirm the fix) if you could zip all .dll/exe in that your application builds or reference (except the one shipped with the product). That way we'll be able to duplicate the same crash locally. Thanks
Comment 3 Doug Moore 2013-02-22 23:31:31 UTC
I removed the errant Newtonsoft.Json.dll and replaced it with Newtonsoft.Json.MonoTouch.dll and the above error went away. I am getting other errors, but they are probably solvable and unrelated to this bug report.
Comment 4 Sebastien Pouliot 2013-02-23 11:06:37 UTC
I'm glad this worked out :-)

If you still have the assembly could you attach* it ? since the tool should _not_ fail like this. Thanks

* I can try to download it, but it could be a different one
Comment 5 Doug Moore 2013-02-23 18:49:07 UTC
Created attachment 3467 [details]
Newtonsoft.Json.dll that caused failed compilation