ThinkGeo.com    |     Blog    |     Wiki    |     Support

App crashes after pushing mapView off stack

Hi,

We have a bug where the map crashes when we try to push it off the navigation page stack. This does not happen on iOS.
The map uses a custom WMS server, and a GpsMarker is shown in the map. I tried running the Dispose() function, but it would crash my application.
Is there any other solution?

The error code can be seen below:

04-11 10:49:28.373 D/Mono ( 4006): DllImport attempting to load: ‘/system/lib/liblog.so’.
04-11 10:49:28.383 D/Mono ( 4006): DllImport loaded library ‘/system/lib/liblog.so’.
04-11 10:49:28.383 D/Mono ( 4006): DllImport searching in: ‘/system/lib/liblog.so’ (’/system/lib/liblog.so’).
04-11 10:49:28.383 D/Mono ( 4006): Searching for ‘__android_log_print’.
04-11 10:49:28.383 D/Mono ( 4006): Probing ‘__android_log_print’.
04-11 10:49:28.383 D/Mono ( 4006): Found as ‘__android_log_print’.
04-11 10:49:28.393 I/MonoDroid( 4006): UNHANDLED EXCEPTION:
04-11 10:49:28.413 I/MonoDroid( 4006): System.ObjectDisposedException: Cannot access a disposed object.
04-11 10:49:28.413 I/MonoDroid( 4006): Object name: ‘ThinkGeo.MapSuite.AndroidEdition.GpsMarker’.
04-11 10:49:28.413 I/MonoDroid( 4006): at Java.Interop.JniPeerMembers.AssertSelf (Java.Interop.IJavaPeerable self) [0x00030] in /Users/builder/data/lanes/4009/9578cdcd/source/Java.Interop/src/Java.Interop/Java.Interop/JniPeerMembers.cs:153
04-11 10:49:28.413 I/MonoDroid( 4006): at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualVoidMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x00002] in /Users/builder/data/lanes/4009/9578cdcd/source/Java.Interop/src/Java.Interop/Java.Interop/JniPeerMembers.JniInstanceMethods_Invoke.cs:21
04-11 10:49:28.413 I/MonoDroid( 4006): at Android.Views.View.Invalidate () [0x00000] in /Users/builder/data/lanes/4009/9578cdcd/source/monodroid/src/Mono.Android/platforms/android-24/src/generated/Android.Views.View.cs:13761
04-11 10:49:28.413 I/MonoDroid( 4006): at ThinkGeo.MapSuite.AndroidEdition.GpsMarker.b__0 () [0x00001] in :0
04-11 10:49:28.413 I/MonoDroid( 4006): at Java.Lang.Thread+RunnableImplementor.Run () [0x0000b] in /Users/builder/data/lanes/4009/9578cdcd/source/xamarin-android/src/Mono.Android/Java.Lang/Thread.cs:36
04-11 10:49:28.413 I/MonoDroid( 4006): at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00009] in /Users/builder/data/lanes/4009/9578cdcd/source/monodroid/src/Mono.Android/platforms/android-24/src/generated/Java.Lang.IRunnable.cs:81
04-11 10:49:28.413 I/MonoDroid( 4006): at (wrapper dynamic-method) System.Object:2ed9769d-508b-48e1-b96d-b33a7ed9f791 (intptr,intptr)
04-11 10:49:28.453 W/art ( 4006): JNI RegisterNativeMethods: attempt to register 0 native methods for android.runtime.JavaProxyThrowable

Hi Jehans,

It looks you have the same question in ticket 16966.

We will reply you there.

Regards,

Don

Hello!
We solved this bug here, and if anyone else should experience it, here is the code:

protected override void OnDisappearing()
		{
			EndMap();
			base.OnDisappearing();
		}

        void EndMap()
        {
			mapView.Overlays.Clear();
        }

This should be implemented in your xaml.cs file containing the mapview.

Hi Jehans,

Thanks for your share, and don’t worry about the ticket.

We will close it, it won’t reduce your ticket number.

Regards,

Don