Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Init exception with latest Xamarin.Forms 3.4 / 3.6 #1154

Closed
stesvis opened this issue Nov 15, 2018 · 144 comments
Closed

Init exception with latest Xamarin.Forms 3.4 / 3.6 #1154

stesvis opened this issue Nov 15, 2018 · 144 comments

Comments

@stesvis
Copy link

stesvis commented Nov 15, 2018

Description

I updated the Xamarin.Forms NuGet Package to the latest version and now I get an exception on OnCreate in Android (iOS untested so far).

Actual Behavior

Unhandled Exception:

System.TypeLoadException: VTable setup of type FFImageLoading.Forms.Platform.CachedImageFastRenderer failed

Basic Information

  • Version with issue: 2.4.3.840 with XF v3.4.0.1008975
  • Last known good version: 2.4.3.840 with XF v3.3.0.967583
  • Platform: Android, not sure about iOS

Reproduction Link / Code

In MainActivity, in OnCreate(), it happens on this line:
FFImageLoading.Forms.Platform.CachedImageRenderer.Init(enableFastRenderer: true);

@softsan
Copy link

softsan commented Nov 15, 2018

Same issue here.

@caseyniemann
Copy link

+1

@jitendrajadav
Copy link

same issue

@japero
Copy link

japero commented Nov 16, 2018

Same here

@daniel-luberda
Copy link
Member

daniel-luberda commented Nov 16, 2018

Did you try to delete all bin/obj folders, clean solution & then rebuild? I just tested and it's working fine (I even updated repo packages too)

@japero
Copy link

japero commented Nov 16, 2018

Deleted from those projects that uses these packages. No affect to me. I even restarted Vs17 but error remained.

@daniel-luberda
Copy link
Member

Could you write more info of your dev environment? Xamarin.Android version, VS version, etc?

@npagare
Copy link

npagare commented Nov 16, 2018

I was getting FATAL error using XF 3.4 on Xamarin.Forms App running on Android platform
Downgrading to XF 3.3 removed that error but images from resources folders are showing with lowest resolution (Android 8.0). My usage of FFImageloading is in the context of using it while building UI with Gorilla player and Gorilla SDK. (I have masked my app package details …)

VS Community 15.9.1

image

@npagare
Copy link

npagare commented Nov 16, 2018

Now back to XF v3.2 but not happy about that choice when I want to use FFImageloading while making use of XF 3.4 and next ones ...

@japero
Copy link

japero commented Nov 16, 2018

VS17 Enterprise 15.8.9, Works on Xamarin.Forms 3.3.0.967583
If I update to latest Xamarin.Forms 3.4...... error is happening.
I reverted Xamarin update because no need for new features yet

@npagare
Copy link

npagare commented Nov 16, 2018

@daniel-luberda - with the new rhythm for Xamarin.Forms release since 3.2 .. It might be worthwhile to have regression plugged in to validate compatibility and report any issues into Xamarin.Forms team directly .. ? thoughts ?

In the mean time, please help in updating FFImageLoading compatible with XF 3.3, 3.4 that will also help in picking up the images with resolution corresponding to the underlying device resolution.

Thanks

@daniel-luberda
Copy link
Member

Could you try 2.4.4.858-pre.nupkg?

@npagare
Copy link

npagare commented Nov 16, 2018

did it pass your regression under XF 3.3 and 3.4; including image issue I mentioned above ?
just asking because it takes a lot of time to upgrade , compile , deploy and test .. and revert in case...

Sorry but thanks a lot.

@daniel-luberda
Copy link
Member

daniel-luberda commented Nov 16, 2018

I only updated packages & recompiled as I can't reproduce that issue on my projects (even sample project from FFImageLoading is working fine). I'm on beta channel (Mac)

help in picking up the images with resolution corresponding to the underlying device resolution.

Could you explain it in details and create a separate issue for it?

@npagare
Copy link

npagare commented Nov 16, 2018

@daniel-luberda .. the FATAL error is gone but images problem I mentioned as in XF 3.3 still exist.
On Android 8.0, while previewing my UI using Gorilla player - FFImageloading package is picking up images from the lowest resolution … that problem doesn't exist in FFImageloading stable version + XF 3.2. Please help.

@npagare
Copy link

npagare commented Nov 16, 2018

Did you compile it against XF 3.4 or XF 3.3 ?

@daniel-luberda
Copy link
Member

3.4

.. the FATAL error is gone but images problem I mentioned as in XF 3.3 still exist.
On Android 8.0, while previewing my UI using Gorilla player - FFImageloading package is picking up images from the lowest resolution … that problem doesn't exist in FFImageloading stable version + XF 3.2. Please help.

I don't use Gorilla Player but I don't think it's FFImageLoading related issue. You can review code responsible for retrieving assets here: https://github.com/luberda-molinet/FFImageLoading/tree/master/source/FFImageLoading.Droid/DataResolvers

and you'll see that it supports device size specific assets.

@npagare
Copy link

npagare commented Nov 16, 2018

Well.. I am just wondering how come that's working with XF 3.2 and stable version of FFImageloading ?

@daniel-luberda daniel-luberda changed the title Init exception with latest xamarin.forms Init exception with latest Xamarin.Forms 3.4 Nov 16, 2018
@alexshikov
Copy link

alexshikov commented Nov 16, 2018

@daniel-luberda 2.4.4.858-pre fixes the issue.

@npagare
Copy link

npagare commented Nov 16, 2018

@daniel-luberda - will you be releasing a stable version today ?

@mackayn
Copy link

mackayn commented Nov 16, 2018

@daniel-luberda

Still seeing this issue in the release that just went out

11-16 14:06:02.954 D/Mono    (18252): DllImport attempting to load: '/system/lib/liblog.so'.
11-16 14:06:02.954 D/Mono    (18252): DllImport loaded library '/system/lib/liblog.so'.
11-16 14:06:02.964 D/Mono    (18252): DllImport searching in: '/system/lib/liblog.so' ('/system/lib/liblog.so').
11-16 14:06:02.964 D/Mono    (18252): Searching for '__android_log_print'.
11-16 14:06:02.964 D/Mono    (18252): Probing '__android_log_print'.
11-16 14:06:02.964 D/Mono    (18252): Found as '__android_log_print'.
11-16 14:06:02.994 I/MonoDroid(18252): UNHANDLED EXCEPTION:
11-16 14:06:03.104 I/MonoDroid(18252): System.TypeLoadException: Could not load list of method overrides due to Method not found: void Xamarin.Forms.Platform.Android.IVisualElementRenderer.add_LayoutChange(System.EventHandler`1<Android.Views.View/LayoutChangeEventArgs>)
11-16 14:06:03.104 I/MonoDroid(18252):   at HamburgerMenu.Droid.MainActivity.OnCreate (Android.OS.Bundle savedInstanceState) [0x00037] in D:\Dev\Hamburger\New UX Components Test\Droid\MainActivity.cs:24 
11-16 14:06:03.104 I/MonoDroid(18252):   at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_savedInstanceState) [0x00011] in <ad2f15102b3a4d36b40e9b0cbc11c376>:0 
11-16 14:06:03.104 I/MonoDroid(18252):   at (wrapper dynamic-method) System.Object.7(intptr,intptr,intptr)
11-16 14:06:03.134 W/art     (18252): JNI RegisterNativeMethods: attempt to register 0 native methods for android.runtime.JavaProxyThrowable
11-16 14:06:03.144 D/Mono    (18252): DllImport searching in: '__Internal' ('(null)').
11-16 14:06:03.144 D/Mono    (18252): Searching for 'java_interop_jnienv_throw'.
11-16 14:06:03.144 D/Mono    (18252): Probing 'java_interop_jnienv_throw'.
11-16 14:06:03.144 D/Mono    (18252): Found as 'java_interop_jnienv_throw'.
Unhandled Exception:

System.TypeLoadException: Could not load list of method overrides due to Method not found: void Xamarin.Forms.Platform.Android.IVisualElementRenderer.add_LayoutChange(System.EventHandler`1<Android.Views.View/LayoutChangeEventArgs>)

FFImageLoading 2.4.4.859
Visual Studio: 17.9
Android Support: 27.0.2.1
Forms: 3.3.0/3.4.0

Deleted all obj&bin and cleared nuget cache.

@mackayn
Copy link

mackayn commented Nov 16, 2018

@daniel-luberda

Worth noting I'm seeing this in Forms 3.3.0 as well, it only occurs though after updating to VS 17.9, in 15.8 everything was okay. Have you tested with 17.9?

@daniel-luberda
Copy link
Member

@mackayn Hi, I tested it on Mac VS 7.7 but I don't see anything related to FFImageLoading in the given stack trace. Are you sure it's FFImageLoading? Maybe it's other lib?

I didn't make any fix for XF 3.4 - I only rebuild it with XF packages updates. Maybe VS is caching those files somewhere?

@IoTFier Stable is released already

@mackayn
Copy link

mackayn commented Nov 16, 2018

@daniel-luberda

It's definitely FFImageLoading that fails

image

@NiknakSi
Copy link

I had the same TypeLoadException on Mac as well, until I upgraded the XF package from 3.4.0-pre1 to stable. As @daniel-luberda says it's probably the IDE holding onto something. In any case, 2.4.4 definitely works with XF 3.4.0 stable.

@npagare
Copy link

npagare commented Nov 16, 2018

@daniel-luberda, a BIG THANK for removing FATAL Error.
All good with VS 17.9.1, XF 3.4 except my image resolution issue that I talked about ..

Appreciate your help in making us look good. Many paid vendors struggle to reach this bar and level of understanding to serve their customers.

A big Applaud for your professionalism. Thank you !

image

@mackayn
Copy link

mackayn commented Nov 16, 2018

@daniel-luberda

Yah, finally got there, delete all obj & bin, close VS, clear %temp%, re-open VS, clear nuget cache, open solution, restore & rebuild, all good.

Thanks for sorting this so quickly.

@IbrahimElshafey
Copy link

@daniel-luberda It seems that some images that were displayed correctly using the old version can't be displayed with the new one.
I created a sample that demonstrates that In this sample I display two images using the old version (2.3.6) and the other use the pre-release version (2.4.5.900), the old sample display both images correctly but the new one display only one image and the other is white.

@kmagalios
Copy link

@kmagalios We could use a fix for this, see: #1246
Reflection is needed as we need to be backward compatible. What do you think? Can you confirm if non-default style is an issue?

@daniel-luberda I've installed the latest preview version (2.4.5.900-pre) and everything works fine.
I remove the property Visual="Default" and everything is ok.

Thank you.

@daniel-luberda
Copy link
Member

I pushed quite a lot of fixes and improvements lately. New prerelease package should be a lot more performant, especially on Android. I tested it while fast scrolling tons of images (also with poor internet connection scenario), not a single crash or exception and memory usage is lower than with previous versions. SVG parsing is also improved, etc.

I plan to release new stable. If you could test prerelease first and submit your feedback I would be grateful as I would like to fix all potential issues before a release.

@IbrahimElshafey
Copy link

@daniel-luberda I upgraded to the latest prerelease package but SVG images that were displayed by the old version (2.3.6) can't be displayed.

@Kiitoksia
Copy link

Kiitoksia commented Apr 22, 2019

Also having this issue that IbrahimElshafey mentioned. Using the latest stable Xamarin Forms release.
Stack Trace


04-22 11:12:33.843 I/mono-stdout(17978): Image loading failed: resource://PROJECT.Resources.cogwheel.svg?assembly=PROJECT,%20Version=1.0.0.0,%20Culture=neutral,%20PublicKeyToken=null;(size=0x64,dip=True,type=SvgDataResolver)
04-22 11:12:33.848 I/mono-stdout(17978): System.MissingMethodException: Method not found: void SkiaSharp.SKPath.AddRoundRect(SkiaSharp.SKRect,single,single,SkiaSharp.SKPathDirection)Image loading failed: resource://PROJECT.Resources.cogwheel.svg?assembly=PROJECT,%20Version=1.0.0.0,%20Culture=neutral,%20PublicKeyToken=null;(size=0x64,dip=True,type=SvgDataResolver)
System.MissingMethodException: Method not found: void SkiaSharp.SKPath.AddRoundRect(SkiaSharp.SKRect,single,single,SkiaSharp.SKPathDirection)
  at FFImageLoading.Svg.Platform.SKSvg.ReadElement (System.Xml.Linq.XElement e, SkiaSharp.SKCanvas canvas, SkiaSharp.SKPaint stroke, SkiaSharp.SKPaint fill) [0x00440] in C:\projects\ffimageloading\source\FFImageLoading.Svg.Shared\SkSvg.cs:281 

04-22 11:12:33.848 I/mono-stdout(17978):   at FFImageLoading.Svg.Platform.SKSvg.ReadElement (System.Xml.Linq.XElement e, SkiaSharp.SKCanvas canvas, SkiaSharp.SKPaint stroke, SkiaSharp.SKPaint fill) [0x00440] in C:\projects\ffimageloading\source\FFImageLoading.Svg.Shared\SkSvg.cs:281   at FFImageLoading.Svg.Platform.SKSvg.ReadElement (System.Xml.Linq.XElement e, SkiaSharp.SKCanvas canvas, SkiaSharp.SKPaint stroke, SkiaSharp.SKPaint fill) [0x006c6] in C:\projects\ffimageloading\source\FFImageLoading.Svg.Shared\SkSvg.cs:357 
  at FFImageLoading.Svg.Platform.SKSvg.ReadElement (System.Xml.Linq.XElement e, SkiaSharp.SKCanvas canvas, SkiaSharp.SKPaint stroke, SkiaSharp.SKPaint fill) [0x006c6] in C:\projects\ffimageloading\source\FFImageLoading.Svg.Shared\SkSvg.cs:357 
  at FFImageLoading.Svg.Platform.SKSvg.LoadElements (System.Collections.Generic.IEnumerable`1[T] elements, SkiaSharp.SKCanvas canvas, SkiaSharp.SKPaint stroke, SkiaSharp.SKPaint fill) [0x00010] in C:\projects\ffimageloading\source\FFImageLoading.Svg.Shared\SkSvg.cs:215 

04-22 11:12:33.848 I/mono-stdout(17978):   at FFImageLoading.Svg.Platform.SKSvg.ReadElement (System.Xml.Linq.XElement e, SkiaSharp.SKCanvas canvas, SkiaSharp.SKPaint stroke, SkiaSharp.SKPaint fill) [0x006c6] in C:\projects\ffimageloading\source\FFImageLoading.Svg.Shared\SkSvg.cs:357 
04-22 11:12:33.849 I/mono-stdout(17978):   at FFImageLoading.Svg.Platform.SKSvg.ReadElement (System.Xml.Linq.XElement e, SkiaSharp.SKCanvas canvas, SkiaSharp.SKPaint stroke, SkiaSharp.SKPaint fill) [0x006c6] in C:\projects\ffimageloading\source\FFImageLoading.Svg.Shared\SkSvg.cs:357   at FFImageLoading.Svg.Platform.SKSvg.Load (System.Xml.Linq.XDocument xdoc) [0x003f9] in C:\projects\ffimageloading\source\FFImageLoading.Svg.Shared\SkSvg.cs:203 

04-22 11:12:33.849 I/mono-stdout(17978):   at FFImageLoading.Svg.Platform.SKSvg.LoadElements (System.Collections.Generic.IEnumerable`1[T] elements, SkiaSharp.SKCanvas canvas, SkiaSharp.SKPaint stroke, SkiaSharp.SKPaint fill) [0x00010] in C:\projects\ffimageloading\source\FFImageLoading.Svg.Shared\SkSvg.cs:215 
04-22 11:12:33.849 I/mono-stdout(17978):   at FFImageLoading.Svg.Platform.SKSvg.Load (System.Xml.Linq.XDocument xdoc) [0x003f9] in C:\projects\ffimageloading\source\FFImageLoading.Svg.Shared\SkSvg.cs:203 
04-22 11:12:33.850 I/mono-stdout(17978):   at FFImageLoading.Svg.Platform.SKSvg.Load (System.Xml.XmlReader reader) [0x00000] in C:\projects\ffimageloading\source\FFImageLoading.Svg.Shared\SkSvg.cs:97 
04-22 11:12:33.852 I/mono-stdout(17978):   at FFImageLoading.Svg.Platform.SKSvg.Load (System.IO.Stream stream) [0x00012] in C:\projects\ffimageloading\source\FFImageLoading.Svg.Shared\SkSvg.cs:91   at FFImageLoading.Svg.Platform.SKSvg.Load (System.Xml.XmlReader reader) [0x00000] in C:\projects\ffimageloading\source\FFImageLoading.Svg.Shared\SkSvg.cs:97 
  at FFImageLoading.Svg.Platform.SKSvg.Load (System.IO.Stream stream) [0x00012] in C:\projects\ffimageloading\source\FFImageLoading.Svg.Shared\SkSvg.cs:91 
  at FFImageLoading.Svg.Platform.SvgDataResolver.Resolve (System.String identifier, FFImageLoading.Work.TaskParameter parameters, System.Threading.CancellationToken token) [0x00198] in C:\projects\ffimageloading\source\FFImageLoading.Svg.Shared\SvgDataResolver.cs:98 
  at FFImageLoading.DataResolvers.WrappedDataResolver.Resolve (System.String identifier, FFImageLoading.Work.TaskParameter parameters, System.Threading.CancellationToken token) [0x00044] in C:\projects\ffimageloading\source\FFImageLoading.Common\DataResolvers\WrappedDataResolver.cs:21 
  at FFImageLoading.Work.ImageLoaderTask`3[TDecoderContainer,TImageContainer,TImageView].RunAsync () [0x00300] in C:\projects\ffimageloading\source\FFIma

geLoading.Common\Work\ImageLoaderTask.cs:555 

@daniel-luberda
Copy link
Member

  • Which version of SkiaSharp do you use?
  • Are you sure you have the same FFIL packages version in all projects?

@Kiitoksia
Copy link

Kiitoksia commented Apr 22, 2019

SkiaSharp wasn't referenced in my project, so I guess it was whichever version is bundled with Xamarin?
Adding the latest SkiaSharp reference via Nuget fixed this issue.

@IbrahimElshafey
Copy link

IbrahimElshafey commented Apr 22, 2019

@daniel-luberda First of all thank you, I very appreciate your work, FFIL is an essential package to any Xamarin.Forms project.
I use the same SkiaSharp version in all projects, the sample contains two Xamarin forms projects, the code in both is the same but in the old (SvgCachedImageTest_old) I use FFIL version as the image
old_version_work_fine the other one uses the latest pre-release version as the following
image

  • the result of both project is different, The old version display both SVG fine but the new pre-release isn't
    image
    image

@daniel-luberda
Copy link
Member

daniel-luberda commented Apr 22, 2019

@IbrahimElshafey Thanks.

  • You're not referencing all packages in your projects (Xamarin.FFImageLoading, Xamarin.FFImageLoading.Svg)
  • The important thing is you should use the same package version in all your projects. Both images render just fine on latest prerelease package. Also:
  • Always delete all bin / obj folders and then rebuild if you experience any problems.

Screenshot_1555934256

@IbrahimElshafey
Copy link

IbrahimElshafey commented Apr 22, 2019

@daniel-luberda Thanks for your response.
I added the missing packages and I deleted the bin/obj folders but with the new version the arrow image didn't display. bellow is the SVG for the image:

<svg xmlns="http://www.w3.org/2000/svg" width="8.5" height="14.9">
  <path fill="#f0f" d="M2.5 7.5a2 2 0 0 1 .3.2L8 13a1 1 0 1 1-1.5 1.5l-3.8-3.9L.4 8.2a1 1 0 0 1 0-1.6L6.6.4a1 1 0 0 1 1.8.4 1 1 0 0 1-.3 1L4.7 5.4 2.5 7.5z"/>
</svg>

If I deleted the fill attribute (fill="#f0f") it displayed fine, I tried this on two diffrent emulators and on my phone.

<svg xmlns="http://www.w3.org/2000/svg" width="8.5" height="14.9">
  <path d="M2.5 7.5a2 2 0 0 1 .3.2L8 13a1 1 0 1 1-1.5 1.5l-3.8-3.9L.4 8.2a1 1 0 0 1 0-1.6L6.6.4a1 1 0 0 1 1.8.4 1 1 0 0 1-.3 1L4.7 5.4 2.5 7.5z"/>
</svg>

@IbrahimElshafey
Copy link

@daniel-luberda I didn't want to waste your time If it works fine on your machine ignore the latest message because I use the old version in the real project and it works fine.

@daniel-luberda
Copy link
Member

See screenshot above, it works. I just tested it on FFIL sample project:

Screenshot_1555936745

@IbrahimElshafey
Copy link

@daniel-luberda It may be some packages cached on my machine I will try again.

@mackayn
Copy link

mackayn commented Apr 22, 2019

@IbrahimElshafey

Clear your Visual Studio nuget cache.

@IbrahimElshafey
Copy link

@mackayn I tried this already, I deleted all FFIL packages in the packages folder C:\Users\UserName\.nuget\packages\ but the problem still exists, I will compile source code locally.

@LeoJHarris
Copy link

Using 2.4.5.909-pre and Xamarin forms 3.6.0.344457 resolves this issue for me.

@HugoTruffe
Copy link

Hi

Using 2.4.5.909-pre (Core, iOS and Android) and Xamarin forms 3.6.0.344457 but the images are not visible.

@MaxenceSAUNIER
Copy link

I confirm

@Giorgi
Copy link

Giorgi commented Apr 26, 2019

Same issue here, SVGs are not rendered

@daniel-luberda
Copy link
Member

Please make sure you:

MookieFumi added a commit to MookieFumi/DotNet2019Challenge that referenced this issue Apr 28, 2019
@stesvis
Copy link
Author

stesvis commented Apr 30, 2019

Please make sure you:

This worked, however, only the first time i run the app after a clean+delete obj/bin+rebuild.
After that, if i run the app again there is no error, but all my svg icons are invisible.
I would have to clean+delete obj/bin+rebuild the app every time to make it work....

Is there a reason?

@MaxenceSAUNIER
Copy link

I have install SkiaSharp and it's working. Thanks @daniel-luberda

@scriptBoris
Copy link

scriptBoris commented May 16, 2019

I updated the Xamarin.Forms NuGet Package to the latest version and now I get an exception on OnCreate in Android (iOS untested so far).

Is there a solution to this problem?

@MHamzaRajput
Copy link

commit your code or take a copy of your project.
After the apply this command on package manager console "update-package".
After this clean build your project, then restart visual studio and rebuild your project.
This procedure work for me.

@ngoquoc
Copy link

ngoquoc commented Jul 19, 2019

Using version 2.4.4.859 works well with XForms 3.4.0.1009.
The following versions did not work for me (combined with the same XForms version above):

  • 2.4.11.982
  • 2.4.9.961

@hbock-42
Copy link

hbock-42 commented May 25, 2020

Hello,
it also crashes for me, I use FFImageLoading version 2.4.4.858-pre and Xamarin.forms 4.6.0.800.

It throws this exception:

System.TypeLoadException: Could not load list of method overrides due to Method not found: void Xamarin.Forms.Platform.Android.IVisualElementRenderer.add_LayoutChange(System.EventHandler`1<Android.Views.View/LayoutChangeEventArgs>)

I did everything requested here: https://github.com/luberda-molinet/FFImageLoading/wiki/Xamarin.Forms-API#step-1

I did not do:

Xamarin.FFImageLoading.Transformations (if you’ll use transformations like CircleTransformation)

Xamarin.FFImageLoading.Svg (for SVG support)

Xamarin.FFImageLoading.Svg.Forms (for SVG support)

SkiaSharp (for SVG support)

As it is optional - I don't use SVG, and I don't use transformations

@udaysaikumargarlapati
Copy link

@daniel-luberda, a BIG THANK for removing FATAL Error.
All good with VS 17.9.1, XF 3.4 except my image resolution issue that I talked about ..

Appreciate your help in making us look good. Many paid vendors struggle to reach this bar and level of understanding to serve their customers.

A big Applaud for your professionalism. Thank you !

image

@IoTFier screenshots helped me a lot.. thanks....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests