Bug 31762 - [Xamarin.Forms + Windows Phone] Xamarin.Forms.Maps 1.3.4 wont build in Windows Phone when using Xamarin.Forms 1.3.5
Summary: [Xamarin.Forms + Windows Phone] Xamarin.Forms.Maps 1.3.4 wont build in Window...
Status: RESOLVED ANSWERED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.3.5
Hardware: PC Windows
: Normal major
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-07-08 16:17 UTC by Matthew Regul
Modified: 2015-07-10 15:00 UTC (History)
7 users (show)

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


Attachments
Patched WP80 Xamarin.Forms 1.3.5.6335 assemblies (357.15 KB, application/zip)
2015-07-10 14:59 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 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:
Status:
RESOLVED ANSWERED

Description Matthew Regul 2015-07-08 16:17:30 UTC
**Overview:**
Xamarin.Forms.Maps 1.3.4 wont build in Windows Phone when using Xamarin.Forms 1.3.5. 
- It complains that its missing a dependency of Xamarin.Forms 1.3.4.
- This works fine on Android & iOS, since 1.3.5 is >= 1.3.4.
- The latest versions of Xamarin.Forms and Xamarin.Forms.Maps work fine together on a Windows Phone.


**Steps to Reproduce:**
Create a blank project with Xamarin Forms 1.3.5, add a small feature which uses Xamarin.Forms.Maps with version 1.3.4 and WindowsPhone will fail to compile with above error.


**Actual Results:**
"Cannot resolve dependency to assembly"

Error 18 Cannot resolve reference assemblies. Please check the reference assemblies. Cannot resolve dependency to assembly 'Xamarin.Forms.Core, Version=1.3.4.0, Culture=neutral, PublicKeyToken=null' because it has not been preloaded. When using the ReflectionOnly APIs, dependent assemblies must be pre-loaded or loaded on demand through the ReflectionOnlyAssemblyResolve event. F:\test\MobileAdmin\Admin\O365Admin.WinPhone\MainPage.xaml O365Admin.WinPhone
Error 19 Cannot resolve reference assemblies. Please check the reference assemblies. Cannot resolve dependency to assembly 'Xamarin.Forms.Core, Version=1.3.4.0, Culture=neutral, PublicKeyToken=null' because it has not been preloaded. When using the ReflectionOnly APIs, dependent assemblies must be pre-loaded or loaded on demand through the ReflectionOnlyAssemblyResolve event. F:\test\MobileAdmin\Admin\O365Admin.WinPhone\App.xaml O365Admin.WinPhone


**Expected Results:**
When working with Windows Phone, allow Xamarin.Forms 1.3.5 to use Xamarin.Forms.Maps 1.3.4


**Build Date & Platform:**
- Xamarin.Forms 1.3.5
- Xamarin.Forms.Maps 1.3.4


**Additional Information:**

(see private note)
Comment 5 Parmendra Kumar 2015-07-09 06:32:48 UTC
I have checked this issue and observed that Xamarin.Forms.Maps 1.3.4 getting build error in Windows Phone when using Xamarin.Forms 1.3.5.
And Its working fine if I have used Xamarin.Forms.Maps 1.4.2 in Windows Phone when using Xamarin.Forms 1.4.3.

Screencast: http://www.screencast.com/t/nUUmO565mI3A

Environment info:

Microsoft Visual Studio Professional 2013
Version 12.0.30723.00 Update 3
Microsoft .NET Framework
Version 4.5.51641
Installed Version: Professional
Xamarin   3.11.666.0 (ebae43a)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android   5.1.4.16 (5f55a9ef61c11b6ce0890bc91e4c71b1b92be214)
Visual Studio plugin to enable development for Xamarin.Android.

Xamarin.Forms Intellisense   1.0
Provides intellisense for Xamarin.Forms in the XML editor.

Xamarin.iOS   8.10.2.0 (67b390d0d1bd741582cf7b7fd3ffea08583a3f83)
Visual Studio extension to enable development for Xamarin.iOS.

Xamarin.iOS Unified Migration   1.0
Automated migration for Xamarin iOS Classic projects to Unified

Xamarin.TestCloud.Integration   1.0
Early preview of Xamarin Test Cloud integration
Comment 6 Brendan Zagaeski (Xamarin Team, assistant) 2015-07-10 14:59:14 UTC
Created attachment 11982 [details]
Patched WP80 Xamarin.Forms 1.3.5.6335 assemblies

## Primary problem

It turns out the core of the problem here is that Windows Phone's `CompileXaml` task [1] apparently uses different logic than the normal `csc` compile task to determine which assemblies are compatible with which other assemblies. That is why the problem only affects Windows Phone.

> [1] C:\Program Files (x86)\MSBuild\Microsoft\WindowsPhone\v8.0\Microsoft.Silverlight.WindowsPhone.Build.Tasks.dll




## Why does Xamarin.Forms.Maps 1.4.2 work with Xamarin.Forms 1.4.3?


- Xamarin.Forms.Core 1.4.3.6376 has an `AssemblyVersion` of "1.4.0.0"

- Xamarin.Forms.Maps 1.4.2.6359 references Xamarin.Forms.Core version "1.4.0.0"


- Xamarin.Forms.Core 1.3.5.6335 has an `AssemblyVersion` of "1.3.5.0"

- Xamarin.Forms.Maps 1.3.4.6332 references Xamarin.Forms.Core version "1.3.4.0"



In other words, Xamarin.Forms 1.4.x uses a less strict assembly versioning scheme than Xamarin.Forms 1.3.x.




## "Workaround"

In order to make Xamarin.Forms.Core 1.3.5 backwards compatible with Xamarin.Forms.Maps 1.3.4, we would need to change the `AssemblyVersion` and the reference so that they matched. As a "quick hack" to verify this, I used `ildasm` and `ilasm` to change the `AssemblyVersion` on all of the Xamarin.Forms 1.3.5 WP8 assemblies to "1.3.4.0".

I have attached the modified assemblies corresponding to Xamarin.Forms 1.3.5.6335 on this comment. They solve the problem in my tests.

You can unzip this folder and use it to replace `packages\Xamarin.Forms.1.3.5.6335\lib\WP80` to test the workaround.




## Additional notes


Setting aside the backwards compatibility question for a moment, I had no problem building the Windows Phone app using:

Xamarin.Forms.Maps 1.3.5.6335 + Xamarin.Forms 1.3.5.6335



I also did not have any trouble building with:

Xamarin.Forms.Maps 1.3.5.6337 + Xamarin.Forms 1.3.5.6337



I am still unclear on: why did the original customer want to use Xamarin.Forms.Maps 1.3.4.6332 rather than either of these Xamarin.Forms.Maps 1.3.5.x versions?
Comment 7 Brendan Zagaeski (Xamarin Team, assistant) 2015-07-10 15:00:47 UTC
Resolving as answered for now, per comment 6. If needed we can discuss further and reopen the bug if appropriate.