Closed vlkam closed 6 years ago
XAML Previewer is a Prerelease. I don't have any informations about supporting custom renderers in it (which CachedImage
is). If someone has any info about that, please let me know. Meanwhile, you can use Image
and then after prototyping replace it with CachedImage
which has the same basic properties.
BTW: I think Gorilla Player supports FFImageLoading, see this: https://github.com/UXDivers/Gorilla-Player-Support/issues/105
Thanks a lot for answer and the excellent library!
Yes, alfa version Previewer supports custom renderers.
But when I try to use FFImageCache in XAML, for example
Invalid XAML The type initializer for FFImageLoading.Forms.CachedImage threw an exception.
Unfortunately, logs do not show any problem. I'm trying to find problem in constructor of CachedImage, but it is very simple an clear.
@vlkam Thanks.
Did you try to check /Users/username/Library/Logs/Xamarin-Studio
folder? Maybe those logs would give some more informations.
Did you try to check /Users/username/Library/Logs folder?
It's FFImageLoading's folder ? I cannot found it.
I created an empty solution, ran it and made a snapshot of logs from C:\Users\username\AppData\Local\Xamarin\Logs\14.0 then I added ffimageloading:CachedImage into XAML, caught error and again made the snapshot, compared these snapshots and I found no significant differences
It seems The Previewer uses only PCL part of solution and custom renders from platform specific part. Previewer does not create the AppDelegate. May be problem is that ?
sorry for my english, I'm working on it :-)
Ohh.... I'm so sorry, I don tell you, I work in Visual Studio (windows)
I have checked, double checked and triple checked the CachedImage class code, removed all suspicious fragments, tried to create a very simple instance of it but got an exception every time.
I have no idea what it could be.
Hi @vlkam
If it's Windows, you could use VS help menu, Xamarin > Logs. Open the last .svclog file. There should be some log entry about your issue.
@vlkam Do you have news on this topic?
This is the exception that occurs on a Windows machine:
2017-05-22 11:06:12.3] INFO: : Initializing the previewer with Android API level 25.
Xamarin.Designer|Information|0|
[2017-05-22 11:06:41.2] ERROR: : The renderer encountered an error while rendering this file: System.TypeInitializationException: The type initializer for 'FFImageLoading.Forms.CachedImage' threw an exception.
at MyProject.Pages.User.UserProfile..ctor () in D:\MyProjects\MyProject_git\MyProject\MyProject\Pages\User\UserProfile.xaml.cs:21
at MyProject.Pages.Navigation.UserMenuMasterDetailPage..ctor () in D:\MyProjects\MyProject_git\MyProject\MyProject\Pages\Navigation\UserMenuMasterDetailPage.cs:15
at MyProject.Phone.App..ctor () in D:\MyProjects\test\MyProject\MyProject\App.cs:54
at
and my setup is:
Microsoft Visual Studio Enterprise 2015 Version 14.0.25431.01 Update 3 Microsoft .NET Framework Version 4.6.01586
Installed Version: Enterprise
Xamarin 4.4.0.34 (3f99c5a) Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.
Xamarin Inspector Support 1.0.0.0 (1f3067d) Adds support for inspecting Xamarin and WPF apps.
Xamarin.Android 7.2.0.7 (b16fb82) Visual Studio extension to enable development for Xamarin.Android.
Xamarin.iOS 10.8.0.174 (7656cc6) Visual Studio extension to enable development for Xamarin.iOS.
I have already changed my code if I am running in Previewer ... and FFimage should be able to have a method in the PCL to disable the render for Android ... or render itself like a simple image.
I am thinking to workaround made from a component ... with 2 DataTemplates .... but I think it's too hacky
Does anyone from the FFImage library has any idea why this is happening ? I assume that Xamarin Previwer does not load the Android Render .... but is there any way to disable this ?
TypeInitializationException is usualy thrown when the static constructor can not be able to initialize. However I don't see any code in the CachedImage class in the static constructor except the dependancy properties
Finally I was able to get a full stacktrace of the exception. The error is a ObjectNullReferenceException and the stack trace is:
at FFImageLoading.PlatformPerformance..ctor () [0x00011] in C:\projects\ffimageloading\source\FFImageLoading.Droid\Helpers\PlatformPerformance.cs:17 at FFImageLoading.ImageService.InitializeIfNeeded (FFImageLoading.Config.Configuration userDefinedConfig) [0x000a3] in C:\projects\ffimageloading\source\FFImageLoading.Shared\ImageService.cs:125 at FFImageLoading.ImageService.get_Config () [0x00000] in C:\projects\ffimageloading\source\FFImageLoading.Shared\ImageService.cs:41 at FFImageLoading.Forms.CachedImage..cctor () [0x00229] in C:\projects\ffimageloading\source\FFImageLoading.Forms\CachedImage.cs:269
I need to mention that I am using the 2.2.9 version
The reason is crashing is because of this: public PlatformPerformance() { this._runtime = Runtime.GetRuntime(); this._activityManager = (ActivityManager)Application.get_Context().GetSystemService("activity"); this._memoryInfo = new ActivityManager.MemoryInfo(); }
Ideally probably the IPlatformPerformance should be allowed to be passed as a Configuration parameter
It's fixed in the latest prerelease nuget :) Thanks @tilutza for https://github.com/luberda-molinet/FFImageLoading/pull/612
Hi, have somebody did make it work using xaml previwer? I'm trying to use an SvgCachedImage on my app but I'm getting this exception:
ERROR: : The renderer encountered an error while rendering this file: System.TypeInitializationException: The type initializer for 'FFImageLoading.Forms.CachedImage' threw an exception.
at FFImageLoading.Svg.Forms.SvgCachedImage.set_DownsampleUseDipUnits (System.Boolean value) in C:\projects\ffimageloading\source\FFImageLoading.Svg.Forms.Shared\SvgCachedImage.cs:15
at
And when I run the app, the image is not visible.
I'm using the latest nuget packages.
Any ideas about what I'm doing wrong?
We seem to be observing an issue with Xamarin Previewer with the latest FFImageLoading package. We first observed this on the previewer for both Android and iOS however after updating to latest FFImageLoading release, we only observe this on iOS. Getting an error:
An exception occurred while rendering the control. System.TypeInitializationException was thrown. The Type Initializer for "FFImageLoading.Forms.CachedImage" threw an exception.
=== Visual Studio Enterprise 2017 for Mac ===
Version 7.0.1 (build 24) Installation UUID: 294bd613-94d8-444e-8fd2-8714ab8fb459 Runtime: Mono 5.0.1.1 (2017-02/5077205) (64-bit) GTK+ 2.24.23 (Raleigh theme) Package version: 500010001
=== NuGet ===
Version: 4.0.0.2323
=== Apple Developer Tools ===
Xcode 8.3.3 (12175.1) Build 8E3004b
=== Xamarin.Mac ===
Version: 3.4.0.36 (Visual Studio Enterprise)
=== Xamarin.Android ===
Version: 7.3.1.2 (Visual Studio Enterprise) Android SDK: /Users/joseluizlacerdasoares/Library/Developer/Xamarin/android-sdk-macosx Supported Android versions: 6.0 (API level 23) 7.0 (API level 24) 7.1 (API level 25)
SDK Tools Version: 25.2.5 SDK Platform Tools Version: 25.0.5 SDK Build Tools Version: 26.0.0
Java SDK: /usr java version "1.8.0_101" Java(TM) SE Runtime Environment (build 1.8.0_101-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)
Android Designer EPL code available here: https://github.com/xamarin/AndroidDesigner.EPL
=== Xamarin.iOS ===
Version: 10.10.0.36 (Visual Studio Enterprise) Hash: d2270eec Branch: d15-2 Build date: 2017-05-22 16:30:53-0400
=== Build Information ===
Release ID: 700010024 Git revision: 7ab1ca2ced6f584e56b7a0d4d321d00775cd95c9 Build date: 2017-05-19 05:44:51-04 Xamarin addins: 08d17158f3365beee5e60f67999e607cce4b3f93 Build lane: monodevelop-lion-d15-2
=== Operating System ===
Mac OS X 10.12.5 Darwin 16.6.0 Darwin Kernel Version 16.6.0 Fri Apr 14 16:21:16 PDT 2017 root:xnu-3789.60.24~6/RELEASE_X86_64 x86_64
Indeed, this bug has not been fixed yet.
I think it's not necessary anymore LiveXAML much better than XAML previewer http://www.livexaml.com/
For compartion https://forums.xamarin.com/discussion/101703/livexaml-ability-to-develop-your-app-in-runtime#latest
@vlkam so what you mean is that it works fine with LiveXAML? so no need to do anything in the end
Xamarin XAML previewer has a lot of limitation, bugs and requires the design time data. LiveXAML works directly in simulators and devices, with real data and practically hasn't the limitation and doesn't require the design time data. LiveXAML works even with Fody and Realm Therefore, by my opinion, no reason for using Xamarin XAML previewer and no reason for solving this issue
@molinch @vlkam We should fix the official XAML Previewer anyway as LiveXaml is a third party solution.
After trying to debug it, i got nowhere as Visual Studio for Mac IDE logs are not very useful. Could someone send me some full stack trace from Windows so I could move on?
When I try to open XAML in Form Previewer "Initializing renderer" runs infinitely long