microcharts-dotnet / Microcharts

Create cross-platform (Xamarin, Windows, ...) simple charts.
MIT License
2.03k stars 360 forks source link

System.ObjectDisposedException: Cannot access a disposed object. Object name: 'Microcharts.Droid.ChartView' #288

Closed dev8546 closed 3 years ago

dev8546 commented 3 years ago

We are getting crash reported in the PROD. What we have found is that this happens when our user move to new activity while chart is still building

Stack Trace JniPeerMembers.AssertSelf (Java.Interop.IJavaPeerable self) JniPeerMembers+JniInstanceMethods.InvokeVirtualVoidMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) View.Invalidate () ChartView+<>c.b8_0 (Microcharts.Droid.ChartView view) InvalidatedWeakEventHandler`1[TTarget].OnEvent (System.Object sender, System.EventArgs args) Chart.Invalidate () Chart.OnPropertyChanged (System.Object sender, System.ComponentModel.PropertyChangedEventArgs e) Chart.RaisePropertyChanged (System.String property) Chart.Set[T] (T& field, T value, System.String property) Chart.set_AnimationProgress (System.Single value) Chart+<>cDisplayClass78_0.b0 () DelayTimer.Start (System.TimeSpan interval, System.Func`1[TResult] step) AsyncMethodBuilderCore+<>c.b7_0 (System.Object state)

dev8546 commented 3 years ago

I have added the pull request to fix this issue https://github.com/microcharts-dotnet/Microcharts/pull/289