Bug 22659 - Projects referencing Newtonsoft.Json.dll do not build from Visual Studio
Summary: Projects referencing Newtonsoft.Json.dll do not build from Visual Studio
Status: RESOLVED FIXED
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: iOS ()
Version: 3.5
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-09-04 16:10 UTC by cheyne
Modified: 2014-09-10 15:50 UTC (History)
3 users (show)

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


Attachments
project references Newtonsoft.json.dll, fails to build in VS succeeds in XS (6.71 MB, application/x-zip-compressed)
2014-09-04 16:10 UTC, cheyne
Details


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:
Status:
RESOLVED FIXED

Description cheyne 2014-09-04 16:10:18 UTC
Created attachment 7930 [details]
project references Newtonsoft.json.dll, fails to build in VS succeeds in XS

After updating Xamarin for Visual Studio to v3.5.55.0 and my Mac Build Host to: Xamarin Studio v. 5.3 (build 440) and Xamarin.iOS 7.4.0.108, my iOS projects fail to build with:

DEBUG error: C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(319,3): error : Could not AOT the assembly '…/Library/Caches/Xamarin/mtbs/builds/…/obj/iPhone/Debug/mtouch-cache/Build/System.Dynamic.dll'
DEBUG build output: Missing method System.Runtime.InteropServices.Marshal::GetNativeVariantForObject<[1]>(!!0,intptr) in assembly …/Library/Caches/Xamarin/mtbs/builds/…/obj/iPhone/Debug/mtouch-cache/Build/mscorlib.dll, referenced in assembly …/Library/Caches/Xamarin/mtbs/builds/…/obj/iPhone/Debug/mtouch-cache/Build/System.Dynamic.dll (TaskId:1983)

RELEASE error: C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(319,3): error : Failed to resolve "System.Reflection.Emit.ModuleBuilder" reference from "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"

I believe I have reduced (at least some component of) the issue to the reference to Newtonsoft.Json.dll. I am using the latest from NuGet: Newtonsoft.Json.6.0.4\lib\portable-net45+wp80+win8+wpa81.

Attached is a project that will fail with "Failed to resolve "System.Reflection.Emit.ModuleBuilder" reference from "mscorlib"" when build from VS, but succeeds to build from XS on Mac. Presumably this would have built on the previous VS version.

Related forum thread with other users hitting similar issues: http://forums.xamarin.com/discussion/comment/74319#Comment_74319
Comment 1 Arpit Jha 2014-09-08 07:24:32 UTC
I have checked this issue and able to reproduce it.

I have tried following steps to reproduce it.
1.Followed above bug description.
2.Build the solution.

I observed that when i build attached project throws an exception of System.Reflection.Emit.ModuleBuilder But issue was resolved when I followed following Steps

1. Go to "Configuration Manager" in bottom of drop down "Debug" 
2. Set Platform iphone to iphoneSimulator.
3. Go to properties of project by Rightclick of project then properties.
4.Select ios Application in LeftPane
5. Set Deployment target to 5.0
6.Save Project and build.

Screencast regarding same: http://screencast.com/t/Fx4mQoUC

Let me know if still you are facing this issue.

Environment Info: 
XVS :3.5.55.0 
VS Professional 2012
Comment 2 cheyne 2014-09-08 14:20:42 UTC
I have verified that I can build using your steps, but I don't understand how they could be considered a satisfactory solution. I target specific iOS versions and iPhone device for a reason, and building against those targets just stopped working due solely to the latest update.

This is a major wrench in my productivity - In the meantime are there supported options for me to revert back to an earlier build?
Comment 3 cheyne 2014-09-10 15:50:49 UTC
This problem disappeared for me when I updated to Xamarin Version 5.3 (build 441). I saw a release note that could have been involved, or perhaps this was some type of install issue with the previous update. I've seen many complaints about this issue, I'm assuming it is resolved.