FFImageLoading does not work with Xamarin.Forms Previewer

Created on 1 Apr 2018  路  10Comments  路  Source: luberda-molinet/FFImageLoading

Description

I am struggling to see FFImageLoading output to Xamarin.Froms Previewer.
Although I works well when I run on simulator or on a device.
It shows exception message on Xamarin.Forms Previewer (Please call CachedImageRenderer.Init method in a platform specific project).
I have already configured both android and iOS startup classes correctly as shown in examples.

Steps to Reproduce

  • Create a blank xamarin.forms project
  • install "Xamarin.FFImageLoading.Forms" nuget package
  • Open "AppDelegate" class from iOS project and add "CachedImageRenderer.Init();" method
  • Do the same with Android, open MainActivity.cs and add "CachedImageRenderer.Init(true);" method
  • Now open MainPage.xaml project from shared project and add a FFImageLoading namespace as belos
    xmlns:ffimageloading="clr-namespace:FFImageLoading.Forms;assembly=FFImageLoading.Forms"

Try to load image using below xaml tag:

Expected Behavior

After building project (both iOS and Android) it should show preview in the Xamarin.Forms Previewer.

Actual Behavior

It throws exception in Xamarin.Forms Previewer as "Please call CachedImageRenderer.Init method in a platform specific project"

Basic Information

  • Version with issue: 2.3.6
  • Last known good version:
  • Platform:

Screenshots

Reproduction Link / Code

help wanted up-for-grabs

Most helpful comment

I can confirm that 2.4.0-pre-755 appears to fix this issue for me. (tested with xamarin.forms 2.5.1)

Thanks. 馃榾

All 10 comments

I'll need some help with this. Do you have any ideas?

Seeing the same thing. It seems the FFimageLoading library doesn't think it's been initialized. Other custom renderers are handling this ok, so it should be fixable.

In my current project, I'm also using ImageCirlce (https://github.com/jamesmontemagno/ImageCirclePlugin), so maybe we can look at how it's handling it?

I've confirmed that downgrading to v2.3.5 of just the FFimageLoading.Forms libraries has fixed the Xaml previewer for me. It seems throwing the Init() exception needs some additional consideration for this case. I'm not 100% sure how best to detect if its the xaml previewer that's running, but hopefully that helps.

@BenReierson Could you test 2.4.0-pre-755?

I can confirm that 2.4.0-pre-755 appears to fix this issue for me. (tested with xamarin.forms 2.5.1)

Thanks. 馃榾

I'll close this then. Thanks.

unfortunately, still not working for in 2.4.0-pre-75
xamarin.forms 2.5.1

here's the screenshot
https://www.screencast.com/t/BfGnmD5qFqdn

Happens in the 3.1.0 version as well

@Nullstr1ng @godrose
Xamarin.Forms previewer has many issues. It would be great if you could provide any stack trace.

For me is not working too.
FFImageLoading Version: 2.4.3.840
Xamarin Forms Version: 3.2.0.839982

[2018-09-27 19:02:32.4] ERROR: : iOSXamlRenderer had a rendering error: System.Exception: Please call CachedImageRenderer.Init method in a platform specific project to use FFImageLoading!
FFImageLoading.Forms.CachedImage.OnSourcePropertyChanged (Xamarin.Forms.BindableObject bindable, System.Object oldValue, System.Object newValue) in C:\projectsffimageloading\source\FFImageLoading.Forms\CachedImage.cs:112
Xamarin.Forms.BindableObject.SetValueActual (Xamarin.Forms.BindableProperty property, Xamarin.Forms.BindableObject+BindablePropertyContext context, System.Object value, System.Boolean currentlyApplying, Xamarin.Forms.Internals.SetValueFlags attributes, System.Boolean silent) in D:a\1\s\Xamarin.Forms.CoreBindableObject.cs:625
Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.Internals.SetValueFlags attributes, Xamarin.Forms.BindableObject+SetValuePrivateFlags privateAttributes) in D:a\1\s\Xamarin.Forms.CoreBindableObject.cs:417
Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value, System.Boolean fromStyle, System.Boolean checkAccess) in D:a\1\s\Xamarin.Forms.CoreBindableObject.cs:573
Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value) in D:a\1\s\Xamarin.Forms.CoreBindableObject.cs:99
Xamarin.Forms.Xaml.ApplyPropertiesVisitor.TrySetValue (System.Object element, Xamarin.Forms.BindableProperty property, System.Boolean attached, System.Object value, System.Xml.IXmlLineInfo lineInfo, Xamarin.Forms.Xaml.Internals.XamlServiceProvider serviceProvider, System.Exception& exception) in D:a\1\s\Xamarin.Forms.Xaml\ApplyPropertiesVisitor.cs:487
Xamarin.Forms.Xaml.ApplyPropertiesVisitor.SetPropertyValue (System.Object xamlelement, Xamarin.Forms.Xaml.XmlName propertyName, System.Object value, System.Object rootElement, Xamarin.Forms.Xaml.INode node, Xamarin.Forms.Xaml.HydrationContext context, System.Xml.IXmlLineInfo lineInfo) in D:a\1\s\Xamarin.Forms.Xaml\ApplyPropertiesVisitor.cs:335
Xamarin.Forms.Xaml.ApplyPropertiesVisitor.Visit (Xamarin.Forms.Xaml.ValueNode node, Xamarin.Forms.Xaml.INode parentNode) in D:a\1\s\Xamarin.Forms.Xaml\ApplyPropertiesVisitor.cs:57
Xamarin.Forms.Xaml.ValueNode.Accept (Xamarin.Forms.Xaml.IXamlNodeVisitor visitor, Xamarin.Forms.Xaml.INode parentNode) in D:a\1\s\Xamarin.Forms.Xaml\XamlNode.cs:86
Xamarin.Forms.Xaml.ElementNode.Accept (Xamarin.Forms.Xaml.IXamlNodeVisitor visitor, Xamarin.Forms.Xaml.INode parentNode) in D:a\1\s\Xamarin.Forms.Xaml\XamlNode.cs:143
Xamarin.Forms.Xaml.ElementNode.Accept (Xamarin.Forms.Xaml.IXamlNodeVisitor visitor, Xamarin.Forms.Xaml.INode parentNode) in D:a\1\s\Xamarin.Forms.Xaml\XamlNode.cs:145
Xamarin.Forms.Xaml.RootNode.Accept (Xamarin.Forms.Xaml.IXamlNodeVisitor visitor, Xamarin.Forms.Xaml.INode parentNode) in D:a\1\s\Xamarin.Forms.Xaml\XamlNode.cs:202
Xamarin.Forms.Xaml.XamlLoader.Visit (Xamarin.Forms.Xaml.RootNode rootnode, Xamarin.Forms.Xaml.HydrationContext visitorContext) in D:a\1\s\Xamarin.Forms.Xaml\XamlLoader.cs:143
Xamarin.Forms.Xaml.XamlLoader.Load (System.Object view, System.String xaml) in D:a\1\s\Xamarin.Forms.Xaml\XamlLoader.cs:89
Xamarin.Forms.Xaml.XamlLoader.Load (System.Object view, System.Type callingType) in D:a\1\s\Xamarin.Forms.Xaml\XamlLoader.cs:67
Xamarin.Forms.Xaml.Extensions.LoadFromXaml[TXaml] (TXaml view, System.Type callingType) in D:a\1\s\Xamarin.Forms.Xaml\ViewExtensions.cs:36
com.mycompany.mysolution.myapp.LoginPage.__InitComponentRuntime ()
com.mycompany.mysolution.myapp.LoginPage.InitializeComponent () in /Users/Lucas/Desktop/Lucas/Projetos/Xamarin/MyApp/src/trunk/MySolution.MyApp/Forms/obj/Debug/Views/LoginPage.xaml.g.cs:29
com.mycompany.mysolution.myapp.LoginPage..ctor () in /Users/Lucas/Desktop/Lucas/Projetos/Xamarin/MyApp/src/trunk/MySolution.MyApp/Forms/Views/LoginPage.xaml.cs:20

System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.0.0.15/src/Xamarin.iOS/mcs/class/corlib/System.Reflection/MonoMethod.cs:661

Was this page helpful?
0 / 5 - 0 ratings