Bug 37372 - System.MissingMethodException while using the Xamarin.Forms V2
Summary: System.MissingMethodException while using the Xamarin.Forms V2
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.0.0
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-01-04 07:18 UTC by Harikrishnan
Modified: 2016-12-20 20:24 UTC (History)
7 users (show)

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


Attachments
Reproducible project for ImageSource error (305.30 KB, application/x-zip-compressed)
2016-01-04 07:18 UTC, Harikrishnan
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 FIXED

Description Harikrishnan 2016-01-04 07:18:32 UTC
Created attachment 14429 [details]
Reproducible project for ImageSource error

System.MissingMethodException: Method 'ImageSource.FromResource' not found.

Keeps throwing a build error of:

Error Failed to resolve "Xamarin.Forms.ImageSource Xamarin.Forms.ImageSource::FromResource(System.String)" reference from "Xamarin.Forms.Core, Version=1.5.0.0, Culture=neutral, PublicKeyToken=null" 

I could even reproduce it in a simple project. 

Create a ClassLibrary with Xamarin Nugets version 1.5.1.6471 or lesser and add some code accessing the ImageSource.FromResource method.

ImageSource.FromResource("ImageSourcePortable.Resources.xamarin.png");


Now create a sample with Xamarin.Forms nugets version 2.0.0.6482 or higher referring the previously created class library and run the sample. Note that the exception will be thrown.

I have added an attachment ImageSource_ErrorSample to reproduce this error. I have removed the packages as it consumes more memory. 

I could also see that this is already reported in the below thread, and the customer has resolved it only by updating the class library and sample both to version 2. 
https://bugzilla.xamarin.com/show_bug.cgi?id=36010
Comment 1 Paul DiPietro [MSFT] 2016-01-04 15:25:49 UTC
We suggest making sure that the versions of Forms are aligned correctly in order to avoid potential issues. Doing so resolves the issue here.
Comment 2 Harikrishnan 2016-01-06 05:01:01 UTC
Hi Paul,

Thanks for getting back on this. 
But I hope you are aware of the Layout Cycle detected exception and the cyclic layout passes that occurs when using Binding when we update to the Version 2.0

I have reported it in the below thread:
https://bugzilla.xamarin.com/show_bug.cgi?id=36328

Due to this exception reported in this bug, I have to update to 2.0. But if I update to 2.0 we are facing the "Layout cycle detected exception" as mentioned in the above thread.

No idea what to do now. Hope Xamarin could come up with a solution for us on this ASAP.
Comment 3 Stephane Delcroix 2016-12-20 20:24:34 UTC
should be fixed in 2.0 which you are using right now