ObjectDisposedException on ChartStripLinesRenderer

We are using the SfChart control in out solution and after we implemented dark mode in our app we are facing a crash when changing between dark and light mode. See output:

UNHANDLED EXCEPTION:
System.ObjectDisposedException: Cannot access a disposed object.Thread started: <Thread Pool> #34

Object name: 'Com.Syncfusion.Charts.ChartStripLinesRenderer'.
  at Java.Interop.JniPeerMembers.AssertSelf(Java.Interop.IJavaPeerable self) [0x00029] in <42748fcc36b74733af2d9940a8f3cc8e>:0
  at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualVoidMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters)[0x00000] in <42748fcc36b74733af2d9940a8f3cc8e>:0
  at Android.Views.View.RequestLayout() [0x0000a] in <7d2292394f8c488b97f5bc2a0ac0240d>:0
  at Com.Syncfusion.Charts.ChartStripLine.LabelStyle_PropertyChanged(System.Object sender, System.ComponentModel.PropertyChangedEventArgs e) [0x0001e] in <76d4754b7f8944168d358e756b379e75>:0
  at Com.Syncfusion.Charts.ChartLabelStyle.OnPropertyChanged(System.Boolean requestLayout, System.String propertyName) [0x00013] in <76d4754b7f8944168d358e756b379e75>:0
  at Com.Syncfusion.Charts.ChartLabelStyle.set_TextColor(Android.Graphics.Color value) [0x0002e] in <76d4754b7f8944168d358e756b379e75>:0
  at Syncfusion.SfChart.XForms.Droid.ChartStyleMapping.OnChartLabelStylePropertiesChanged(System.String propertyName, Syncfusion.SfChart.XForms.ChartLabelStyle formChartLabel, Com.Syncfusion.Charts.ChartLabelStyle nativeChartLabel) [0x000c5] in <76d4754b7f8944168d358e756b379e75>:0
  at Syncfusion.SfChart.XForms.Droid.ChartStripLinesMapping.OnLabelStylePropertyChanged(System.Object sender, System.ComponentModel.PropertyChangedEventArgs e) [0x000d9] in <76d4754b7f8944168d358e756b379e75>:0
  at Xamarin.Forms.BindableObject.OnPropertyChanged(System.String propertyName) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:229
  at Xamarin.Forms.Element.OnPropertyChanged(System.String propertyName) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Element.cs:358
  at 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) [0x00114] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:461
  at Xamarin.Forms.BindableObject.SetValueCore(Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.Internals.SetValueFlags attributes, Xamarin.Forms.BindableObject+SetValuePrivateFlags privateAttributes) [0x00173] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:397
  at Xamarin.Forms.BindableObject.SetValueCore(Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.Internals.SetValueFlags attributes) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:343
  at Xamarin.Forms.AppThemeBinding.ApplyCore() [0x00018] in D:\a\1\s\Xamarin.Forms.Core\AppThemeBinding.cs:45
  at Xamarin.Forms.AppThemeBinding.<.ctor>b__2_1 ()[0x00000] in D:\a\1\s\Xamarin.Forms.Core\AppThemeBinding.cs:10
  at Java.Lang.Thread+RunnableImplementor.Run ()[0x00008] in <7d2292394f8c488b97f5bc2a0ac0240d>:0
  at Java.Lang.IRunnableInvoker.n_Run(System.IntPtr jnienv, System.IntPtr native__this) [0x00008] in <7d2292394f8c488b97f5bc2a0ac0240d>:0
  at(wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.1(intptr, intptr)
** System.ObjectDisposedException:** 'Cannot access a disposed object. Object name: 'Com.Syncfusion.Charts.ChartStripLinesRenderer'.'

6 Replies 1 reply marked as answer

HM Hemalatha Marikumar Syncfusion Team November 9, 2020 12:53 PM UTC

Hi Arnstein,  
  
Greetings from Syncfusion.   
  
We have checked the reported problem with usage of ChartStripLine in android, but it has been worked fine even with page navigation. But we have validated this based on the stack trace, we are in the planning to share possible condition fix on November 10, 2020.  
 
We appreciate your patience until then. 
 
Regards,
Hemalatha M.
 



HM Hemalatha Marikumar Syncfusion Team November 9, 2020 02:26 PM UTC

Hi Arnstein,  
 
We have fixed the issue based on the provided stack trace and could you please try the below fix and let us know whether your reported dispose exception has been resolved or not?  
 
Please find the patch from below link  
 
 
(OR) 
 
 
(OR) 
 
Before replacing the NuGet, please follow the below steps to clear the NuGet cache,    
Follow the below link to clear cache,     
 
Please find the way to use the custom patch    
Assembly Version: 18.3.0.47  
 
Disclaimer:       
Please note that we have created this patch for version 18.3.0.47 specifically to resolve the issue reported in this incident. If you have received other patches for the same version for other products, please apply all patches in the order received.       
 
Note: Based on your confirmation only, we can include this fix in our official release.

 
Regards,
Hemalatha M. 


Marked as answer

AR Arnstein November 10, 2020 02:33 PM UTC

Hi. Thank you for the fast response. I tried the new nuget, but the problem seem to persist. This is what I got after the update

UNHANDLED EXCEPTION:
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'Com.Syncfusion.Charts.ChartStripLinesRenderer'.
  at Java.Interop.JniPeerMembers.AssertSelf (Java.Interop.IJavaPeerable self) [0x00029] in <42748fcc36b74733af2d9940a8f3cc8e>:0
  at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualVoidMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x00000] in <42748fcc36b74733af2d9940a8f3cc8e>:0
  at Android.Views.View.RequestLayout () [0x0000a] in <7d2292394f8c488b97f5bc2a0ac0240d>:0
  at Com.Syncfusion.Charts.ChartStripLine.LabelStyle_PropertyChanged (System.Object sender, System.ComponentModel.PropertyChangedEventArgs e) [0x0001e] in <76d4754b7f8944168d358e756b379e75>:0
  at Com.Syncfusion.Charts.ChartLabelStyle.OnPropertyChanged (System.Boolean requestLayout, System.String propertyName) [0x00013] in <76d4754b7f8944168d358e756b379e75>:0
  at Com.Syncfusion.Charts.ChartLabelStyle.set_TextColor (Android.Graphics.Color value) [0x0002e] in <76d4754b7f8944168d358e756b379e75>:0
  at Syncfusion.SfChart.XForms.Droid.ChartStyleMapping.OnChartLabelStylePropertiesChanged (System.String propertyName, Syncfusion.SfChart.XForms.ChartLabelStyle formChartLabel, Com.Syncfusion.Charts.ChartLabelStyle nativeChartLabel) [0x000c5] in <76d4754b7f8944168d358e756b379e75>:0
  at Syncfusion.SfChart.XForms.Droid.ChartStripLinesMapping.OnLabelStylePropertyChanged (System.Object sender, System.ComponentModel.PropertyChangedEventArgs e) [0x000d9] in <76d4754b7f8944168d358e756b379e75>:0
  at Xamarin.Forms.BindableObject.OnPropertyChanged (System.String propertyName) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:229
  at Xamarin.Forms.Element.OnPropertyChanged (System.String propertyName) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Element.cs:358
  at 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) [0x00114] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:461
  at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.Internals.SetValueFlags attributes, Xamarin.Forms.BindableObject+SetValuePrivateFlags privateAttributes) [0x00173] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:397
  at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.Internals.SetValueFlags attributes) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:343
  at Xamarin.Forms.AppThemeBinding.ApplyCore () [0x00018] in D:\a\1\s\Xamarin.Forms.Core\AppThemeBinding.cs:45
  at Xamarin.Forms.AppThemeBinding.<.ctor>b__2_1 () [0x00000] in D:\a\1\s\Xamarin.Forms.Core\AppThemeBinding.cs:10
  at Java.Lang.Thread+RunnableImplementor.Run () [0x00008] in <7d2292394f8c488b97f5bc2a0ac0240d>:0
  at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00008] in <7d2292394f8c488b97f5bc2a0ac0240d>:0
  at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.1(intptr,intptr)
**System.ObjectDisposedException:** 'Cannot access a disposed object.
Object name: 'Com.Syncfusion.Charts.ChartStripLinesRenderer'.'

[ERROR] FATAL UNHANDLED EXCEPTION: System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'Com.Syncfusion.Charts.ChartStripLinesRenderer'.
  at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.1(intptr,intptr)
  at (wrapper native-to-managed) Android.Runtime.DynamicMethodNameCounter.1(intptr,intptr)




HM Hemalatha Marikumar Syncfusion Team November 11, 2020 03:26 PM UTC

Hi Arnstein, 
 
Thanks for your confirmation.  
 
As we updated earlier, the reported problem is not reproduced at our end. Based on the stack trace updates only we put the possible fix and update to you.  
 
We suspect it may not reflect due to the cache reference from your old packages. So, could you please remove the cache and then use the provided patch again.  
 
To remove the cache in windows: 
   
Delete the Syncfusion packages from C:\Users\Username\.nuget\packages.   
   
In MAC:   
  
            In Finder, open up your Macintosh HD folder.   
            Press Command+Shift+Dot to unhide the folder.   
            Get the. nuget folder from it.  Delete the Syncfusion Packages. 
 
Delete all bin& obj and then install the provided patch. 
 
And to replicate at our end to proceed this further, could you please share the use case to replicate or else share the reproducing sample if possible? 
 
Regards,
Hemalatha M. 
 



AR Arnstein November 12, 2020 02:00 PM UTC

Hi again.

After following your steps to clear the nuget cache, I was able to successfully confirm that I no longer get the ObjectDisposedException. Thanks again for the help and fast response.


YP Yuvaraj Palanisamy Syncfusion Team November 13, 2020 05:34 AM UTC

Hi Arnstein, 
 
Thanks for your update. 
 
Please let us know if you have any concern regarding this. 
 
Regards, 
Yuvaraj. 


Loader.
Up arrow icon