Bug 14284 - [VS2012] Using .NET 4.5 Tasks via a PCL project causes "System.Runtime" FileNotFoundException
Summary: [VS2012] Using .NET 4.5 Tasks via a PCL project causes "System.Runtime" FileN...
Status: RESOLVED FIXED
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: iOS ()
Version: 1.4.x
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Martin Baulig
URL:
Depends on:
Blocks:
 
Reported: 2013-08-27 16:40 UTC by Brendan Zagaeski (Xamarin Team, assistant)
Modified: 2013-11-01 12:54 UTC (History)
7 users (show)

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


Attachments
Test case (26.94 KB, application/zip)
2013-08-27 16:40 UTC, Brendan Zagaeski (Xamarin Team, assistant)
Details
Full Debug log (11.99 KB, text/plain)
2013-08-27 16:42 UTC, Brendan Zagaeski (Xamarin Team, assistant)
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 Brendan Zagaeski (Xamarin Team, assistant) 2013-08-27 16:40:45 UTC
Created attachment 4728 [details]
Test case

Summary:
Using the ".NET 4.5 + .NET for Windows Store + Xamarin" PCL profile (v4.5\Profile\Profile 7) with Tasks causes the following error when attempting to run an iOS project that references the PCL project in Visual Studio 2012:

C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.MonoTouch.Common.targets(110,3): error : Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Perhaps it doesn't exist in the MonoTouch profile?


Steps to reproduce:
1. Open attached project in VS 2012.
2. Attempt to run the iOS project.


Result:
The "FileNotFoundException" error message appears in the "Debug" Output, and the application fails to run.


Additional information:
- The example PCL project works fine with Xamarin.Android projects and Windows Console projects.

- Switching the PCL profile to ".NET 4.5 + Silverlight 5 + .NET for Windows Store" is a work-around when using the older `Task.Factory.StartNew()` method, but will not work with `Task.Run()`.

- The project runs fine using Xamarin Studio on Mac (no PCL profiles added).



Version information:
Xamarin.iOS 1.4.2
Windows 7
.NET 4.5.50709
VS 2012 11.0.50727.1 RTMREL
Comment 1 Brendan Zagaeski (Xamarin Team, assistant) 2013-08-27 16:42:16 UTC
Created attachment 4729 [details]
Full Debug log
Comment 2 Mikayla Hutchinson [MSFT] 2013-08-27 17:11:32 UTC

*** This bug has been marked as a duplicate of bug 13322 ***
Comment 3 Brendan Zagaeski (Xamarin Team, assistant) 2013-08-27 17:18:00 UTC
Just to be thorough, the test case for bug 13322 started on the emulator for me without complaint on Xamarin.iOS 1.4.2.
Comment 4 Brendan Zagaeski (Xamarin Team, assistant) 2013-08-27 20:49:47 UTC
Whoops. That is to say, the test case for bug 13322 *did* start on the emulator, but the test case attached to this case *did not* start. Interestingly, the error only appears during the "Remote Build" phase before running (like the "other" problem the user saw on bug 13481). "Build -> Build Solution" works just fine.

Probably all redundant information anyway :)
Comment 5 Brendan Zagaeski (Xamarin Team, assistant) 2013-09-10 15:51:15 UTC
Reopening after re-checking the test case with the recent builds. It still fails with the FileNotFoundException for "System.Runtime, Version=4.0.0.0". I think my initial description sounded too similar to bug 13322 and bug 13481. It seems to be a different problem after all.
Comment 7 Martin Baulig 2013-09-10 18:13:35 UTC
I'll have a look at this asap.
Comment 10 Alan McGovern 2013-10-31 14:41:05 UTC
This should work just fine as of the latest 1.8 builds. I am able to build PCL libraries exactly as expected now. Please re-open if there are cases where it does not work.
Comment 12 Geir Sagberg 2013-11-01 10:59:56 UTC
Any ETA on when the 1.8 builds are available in alpha channel?
Comment 13 Alan McGovern 2013-11-01 12:54:21 UTC
I can't give you an exact answer, but I think it should be available within a week or two. Keep an eye out on the updater channels and you'll see it when it is released!