AnsweredAssumed Answered

MapView ObjectDisposedException IOS

Question asked by zachovaltomas on Oct 14, 2020

Hello,

I'm using nuget Esri.ArcGISRuntime.Xamarin.Forms v. 100.9.0 on Android platform everything works fine, but on IOS i found bug which I was also able to reproduce in a clean project.

It is this exception:

 

Exception

- $exception {System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'MapView'.
at Foundation.NSObject.get_SuperHandle () [0x0004a] in /Library/Frameworks/Xamarin.iOS.framework/Versions/14.0.0.0/src/Xamarin.iOS/Foundation/NSObject2.cs:401
at UIKit.UIView.get_Bounds () [0x0009d] in /Library/Frameworks/Xamarin.iOS.framework/Versions/14.0.0.0/src/Xamarin.iOS/UIKit/UIView.g.cs:3114
at Esri.ArcGISRuntime.UI.Controls.GeoView.ApplicationDidBecomeActive (System.WeakReference`1[T] geoview) [0x0000d] in <feaa53e84d7043e88504283a2c404a62>:0
at Esri.ArcGISRuntime.UI.Controls.GeoView+<>c__DisplayClass47_0.<SetupApplicationNotificationHandlers>b__3 (System.Object s, Foundation.NSNotificationEventArgs e) [0x00000] in <feaa53e84d7043e88504283a2c404a62>:0
at UIKit.UIApplication+Notifications+<>c__DisplayClass4_0.<ObserveDidBecomeActive>b__0 (Foundation.NSNotification notification) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/14.0.0.0/src/Xamarin.iOS/UIKit/UIApplication.g.cs:2092
at Foundation.InternalNSNotificationHandler.Post (Foundation.NSNotification s) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/14.0.0.0/src/Xamarin.iOS/Foundation/NSNotificationCenter.cs:48
at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Library/Frameworks/Xamarin.iOS.framework/Versions/14.0.0.0/src/Xamarin.iOS/UIKit/UIApplication.cs:86
at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0000e] in /Library/Frameworks/Xamarin.iOS.framework/Versions/14.0.0.0/src/Xamarin.iOS/UIKit/UIApplication.cs:65
at Ag.App.Phone.Ios.Application.Main (System.String[] args) [0x00001] in C:\devel\App\Source\App.Phone.iOS\Main

 

- $exception {System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'MapView'.
at Foundation.NSObject.get_SuperHandle () [0x0004a] in /Library/Frameworks/Xamarin.iOS.framework/Versions/14.0.0.0/src/Xamarin.iOS/Foundation/NSObject2.cs:401
at UIKit.UIView.get_Bounds () [0x0009d] in /Library/Frameworks/Xamarin.iOS.framework/Versions/14.0.0.0/src/Xamarin.iOS/UIKit/UIView.g.cs:3114
at Esri.ArcGISRuntime.UI.Controls.GeoView.ApplicationDidBecomeActive (System.WeakReference`1[T] geoview) [0x0000d] in <feaa53e84d7043e88504283a2c404a62>:0
at Esri.ArcGISRuntime.UI.Controls.GeoView+<>c__DisplayClass47_0.<SetupApplicationNotificationHandlers>b__3 (System.Object s, Foundation.NSNotificationEventArgs e) [0x00000] in <feaa53e84d7043e88504283a2c404a62>:0
at UIKit.UIApplication+Notifications+<>c__DisplayClass4_0.<ObserveDidBecomeActive>b__0 (Foundation.NSNotification notification) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/14.0.0.0/src/Xamarin.iOS/UIKit/UIApplication.g.cs:2092
at Foundation.InternalNSNotificationHandler.Post (Foundation.NSNotification s) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/14.0.0.0/src/Xamarin.iOS/Foundation/NSNotificationCenter.cs:48
at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Library/Frameworks/Xamarin.iOS.framework/Versions/14.0.0.0/src/Xamarin.iOS/UIKit/UIApplication.cs:86
at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0000e] in /Library/Frameworks/Xamarin.iOS.framework/Versions/14.0.0.0/src/Xamarin.iOS/UIKit/UIApplication.cs:65
at Ag.App.Phone.Ios.Application.Main (System.String[] args) [0x00001] in C:\devel\App\Source\App.Phone.iOS\Main.cs:12 } System.ObjectDisposedException

 

Exception appearing alwayse when i have loaded MapView on current page. Then I go to another page. Then send app to background. Do work and return back to the app. And when app is send from backgroud to foreground it will crash on System.ObjectDisposedException: Cannot access a disposed object.Object name: 'MapView' . On physical device it happen almost everytime on simulator sometimes not.

If I send app to backgroud and current page is page with MapView it works fine. 

Example in suffix. 

 

Thanks for your help

T. Zachoval

 

Attachments

Outcomes