We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Crash on Android when using a SVG image within DataTemplate (CachingStrategy?)

Thread ID:





129458 Mar 20,2017 09:47 AM UTC Mar 21,2017 12:42 PM UTC Xamarin.Forms 1
Tags: SfListView
Xavier Perseguers
Asked On March 20, 2017 09:47 AM UTC

I'm using the SfListView to show persons. Same/similar XAML code is used on basically two different pages:

- DirectoryPage.xaml : showing a list of persons related to some search (text field on top of the page). The list refreshes each time the user changes the text field to show corresponding items
- PersonsPage.xaml : showing a static list of persons (the list is provided as data binding upon loading the page).

Both XAML contain such code for the DataTemplate:




                            <!-- snip -->

                                <StackLayout Grid.Column="2" Padding="0,0,5,0" Orientation="Horizontal" VerticalOptions="Start">

                                    <svg:SvgImage Svg="res:Assets.Images.BirthdayCake" IsVisible="{Binding IsInBirthdayPeriod}" HeightRequest="20" />





This is using library XamSvg.Forms to show the SVG image. It works fine on iOS for both pages. On Android however the page with the static list of persons is just fine but the one which dynamically updates the list of persons crashes as soon as the SvgImage needs to be visible. It crashes with:

Xamarin caused by: android.runtime.JavaProxyThrowable: System.ObjectDisposedException: Cannot access a disposed object.

Object name: 'XamSvg.SvgImageView'.

  at Java.Interop.JniPeerMembers.AssertSelf (Java.Interop.IJavaPeerable self) [0x00030] in <a043032cf94a485190047a14918b9f60>:0 

  at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualVoidMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x00001] in <a043032cf94a485190047a14918b9f60>:0 

  at Android.Views.View.RequestLayout () [0x0000a] in <82194ba0d96e4d64b3f1f6b60247af10>:0 

  at XamSvg.SvgImageView+<>c__DisplayClass51_1.<set_ImageDrawable>b__0 () [0x0003d] in <3c41261deb414f4eba76bf90d664fc04>:0 

  at Java.Lang.Thread+RunnableImplementor.Run () [0x0000b] in <82194ba0d96e4d64b3f1f6b60247af10>:0 

  at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00009] in <82194ba0d96e4d64b3f1f6b60247af10>:0 

  at (wrapper dynamic-method) System.Object:5888540f-7cee-47d3-8b47-bfb7f2d5febc (intptr,intptr)

at mono.java.lang.RunnableImplementor.n_run(Native Method)

at mono.java.lang.RunnableImplementor.run(RunnableImplementor.java:30)

at android.os.Handler.handleCallback(Handler.java:739)

at android.os.Handler.dispatchMessage(Handler.java:95)

at android.os.Looper.loop(Looper.java:158)

at android.app.ActivityThread.main(ActivityThread.java:7229)

at java.lang.reflect.Method.invoke(Native Method)

at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)

at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

If I use a standard "Image" control instead of the SVG one, it works fine. Since it works when a static list of persons is provided, I suspect this may have something to do with CachingStrategy.

Dinesh Babu Yadav [Syncfusion]
Replied On March 21, 2017 12:42 PM UTC

Hi Xavier, 
Sorry for the inconvenience caused. 
The reported issue “Application crashes when SVG image is used in SfListView’s  ItemTemplate” has been resolved at our end and a support incident has been created under your account for providing custom assemblies which includes the fix for the reported issue. Please log on to our support website to check for further updates.       
Dinesh Babu Yadav 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon