Bug 13481 - PCL and System.Runtime
Summary: PCL and System.Runtime
Status: RESOLVED DUPLICATE of bug 13322
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: iOS ()
Version: 1.3.x
Hardware: PC Windows
: High major
Target Milestone: ---
Assignee: dean.ellis
Depends on:
Reported: 2013-07-25 15:16 UTC by Brian Chance
Modified: 2013-08-26 20:04 UTC (History)
8 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 Brian Chance 2013-07-25 15:16:39 UTC
I have a portable library (.net 4.5, Windows 8 - I have tried profile 7,49 and 78) that declares an interface that takes a System.Action (void Go(Action where). I then try to implement the interface in a Monotouch iOS project, and get: The type 'System.Action' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'

Implementing an interface in a normal v4.5 Console App compiles fine.

The PCL sees System.Action in System.Runtime.dll (right-click go to declaration), Monotouch thinks it is in mscorlib (so does the console app). I am guessing some compiler magic happens with the console app to route System.Runtime.dll to mscorlib.

Is this supported yet or do I need to stick with the .net 40 portable libraries?
Comment 1 Mikayla Hutchinson [MSFT] 2013-07-25 16:03:46 UTC
This is because the Facades assemblies were accidentally omitted from the Xamarin.iOS Windows installer. A fix is in progress.

You should be able to work around it by copying /Developer/MonoTouch/usr/lib/mono/2.1/Facades folder from MacOS to C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoTouch\v4.0\Facades on Windows.

*** This bug has been marked as a duplicate of bug 13322 ***
Comment 2 Brian Chance 2013-07-25 16:14:47 UTC
That did not solve the issue. Do I need to add a reference to the Facades\System.Runtime.dll?
Comment 3 Mikayla Hutchinson [MSFT] 2013-07-25 16:17:09 UTC
You shouldn't need to, the MSBuild targets are supposed to reference every assembly in that directory automatically.
Comment 4 Brian Chance 2013-07-25 16:20:25 UTC
Do I need an updated MSBuild targets? My project is currently pointed at <Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.MonoTouch.CSharp.targets" />

I tried restarting vs.
Comment 5 Mikayla Hutchinson [MSFT] 2013-07-25 16:29:51 UTC
It was my understanding that this behavior came from the Microsoft.Common.targets that are imported by Xamarin.MonoTouch.CSharp.targets, but it may be that the Xamarin.MonoTouch.CSharp.targets need fixes too.

Sorry, I don't know much about the Xamarin.iOS build on Windows, but the bug I marked dup is definitely the same issue, so this *will* be fixed.
Comment 6 Brian Chance 2013-07-25 16:32:08 UTC
Thanks for the update. Will this thread get updated when it is?
Comment 7 Brian Chance 2013-07-26 11:38:28 UTC
After a reboot, I can no longer compile at all (using a v4.0 profile). Any thoughts?

"C:\code\StoreFinancial\Dev\Dev\Src\Mobile\CardSpotMobile.Touch\CardSpotMobile.Touch.csproj" (_RemoteBuild target) (1) ->
(_ResolveAssemblies target) -> 
  C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.MonoTouch.Common.targets(74,3): error : Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'System.Runtime, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Perhaps it doesn't exist in the MonoTouch profile? [C:\code\StoreFinancial\Dev\Dev\Src\Mobile\CardSpotMobile.Touch\CardSpotMobile.Touch.csproj]
C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.MonoTouch.Common.targets(74,3): error : File name: 'System.Runtime.dll' [C:\code\StoreFinancial\Dev\Dev\Src\Mobile\CardSpotMobile.Touch\CardSpotMobile.Touch.csproj]
C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.MonoTouch.Common.targets(74,3): error :    at Xamarin.MonoTouch.Build.Tasks.Utilities.MonoTouchResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters) [C:\code\StoreFinancial\Dev\Dev\Src\Mobile\CardSpotMobile.Touch\CardSpotMobile.Touch.csproj]
C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.MonoTouch.Common.targets(74,3): error :    at Xamarin.MonoTouch.Build.Tasks.ResolveAssemblies.AddAssemblyReferences(List`1 assemblies, AssemblyDefinition assembly) [C:\code\StoreFinancial\Dev\Dev\Src\Mobile\CardSpotMobile.Touch\CardSpotMobile.Touch.csproj]
C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.MonoTouch.Common.targets(74,3): error :    at Xamarin.MonoTouch.Build.Tasks.ResolveAssemblies.AddAssemblyReferences(List`1 assemblies, AssemblyDefinition assembly) [C:\code\StoreFinancial\Dev\Dev\Src\Mobile\CardSpotMobile.Touch\CardSpotMobile.Touch.csproj]
C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.MonoTouch.Common.targets(74,3): error :    at Xamarin.MonoTouch.Build.Tasks.ResolveAssemblies.AddAssemblyReferences(List`1 assemblies, AssemblyDefinition assembly) [C:\code\StoreFinancial\Dev\Dev\Src\Mobile\CardSpotMobile.Touch\CardSpotMobile.Touch.csproj]
C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.MonoTouch.Common.targets(74,3): error :    at Xamarin.MonoTouch.Build.Tasks.ResolveAssemblies.Execute() [C:\code\StoreFinancial\Dev\Dev\Src\Mobile\CardSpotMobile.Touch\CardSpotMobile.Touch.csproj]
Comment 8 Brian Chance 2013-07-26 11:40:28 UTC
I forgot to mention, it "builds" fine in VS2012, it is only when trying to debug using the iOS Simulator.
Comment 9 Brian Chance 2013-07-26 17:36:12 UTC
I figured out my second issue with the remote build, another project ran just fine, so I deconstructed my project down until it ran.

My PCL project included a reference the Newtonsoft.Json.5.0.6, the portable-net40+sl4+wp7+win8 version.

My Touch project included a reference to portable-net45+wp80+win8.

The original issue with System.Runtime and System.Action still persists.

Comment 10 Brian Chance 2013-08-06 09:42:04 UTC
Anyway to get the status of this bug? I am not authorized to view 13322.

Comment 11 Brendan Zagaeski (Xamarin Team, assistant) 2013-08-26 18:33:51 UTC
@Brian, in case it's helpful, the current Alpha channel version of Xamarin.iOS removes these error messages for some recent samples I was testing.