Bug 21750 - AndroidGameView.Close crashes
Summary: AndroidGameView.Close crashes
Status: REOPENED
Alias: None
Product: Android
Classification: Xamarin
Component: Mono runtime / AOT Compiler (show other bugs)
Version: 4.16.0
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Radek Doulik
URL:
Depends on:
Blocks:
 
Reported: 2014-07-31 23:54 UTC by pierre
Modified: 2015-03-25 08:03 UTC (History)
5 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Repro (4.28 KB, text/plain)
2014-07-31 23:54 UTC, pierre
Details
Test App (17.80 KB, application/zip)
2014-08-01 03:39 UTC, Udham Singh
Details

Description pierre 2014-07-31 23:54:54 UTC
Created attachment 7561 [details]
Repro

Function AndroidGameView.Close tries to recreate the context and crashes with log:

V/PhoneStatusBar(  863): setLightsOn(true)
I/MonoDroid(24640): UNHANDLED EXCEPTION: Java.Lang.IllegalArgumentException: Exception of type 'Java.Lang.IllegalArgumentException' was thrown.
I/MonoDroid(24640): at Android.Runtime.JNIEnv.CallBooleanMethod (intptr,intptr,Android.Runtime.JValue[]) <0x00104>
I/MonoDroid(24640): at Javax.Microedition.Khronos.Egl.IEGL10Invoker.EglMakeCurrent (Javax.Microedition.Khronos.Egl.EGLDisplay,Javax.Microedition.Khronos.Egl.EGLSurface,Javax.Microe
dition.Khronos.Egl.EGLSurface,Javax.Microedition.Khronos.Egl.EGLContext) <0x00213>
I/MonoDroid(24640): at OpenTK.Platform.Android.AndroidGraphicsContext.MakeCurrent (OpenTK.Platform.IWindowInfo) <0x000db>
I/MonoDroid(24640): at OpenTK.Platform.Android.AndroidGameView.MakeCurrent () <0x0007b>
I/MonoDroid(24640): at OpenTK.GameViewBase.OnContextSet (System.EventArgs) <0x0001f>
I/MonoDroid(24640): at OpenTK.GameViewBase.set_GraphicsContext (OpenTK.Graphics.IGraphicsContext) <0x00047>
I/MonoDroid(24640): at OpenTK.Platform.Android.AndroidGameView.CreateContext () <0x00073>
I/MonoDroid(24640): at OpenTK.Platform.Android.AndroidGameView.MakeCurrent () <0x0002f>
I/MonoDroid(24640): at OpenTK.GameViewBase.OnContextSet (System.EventArgs) <0x0001f>
I/MonoDroid(24640): at OpenTK.GameViewBase.set_GraphicsContext (OpenTK.Graphics.IGraphicsContext) <0x00047>
I/MonoDroid(24640): at OpenTK.Platform.Android.AndroidGameView.DestroyContext () <0x00043>
I/MonoDroid(24640): at OpenTK.Platform.Android.AndroidGameView.Close () <0x0002b>
I/MonoDroid(24640): at OpenGLApplication19.Activity2.OnDestroy () <0x00037>
I/MonoDroid(24640): at Android.App.Activity.n_OnDestroy (intptr,intptr) <0x00037>
I/MonoDroid(24640): at (wrapper dynamic-method) object.8a37a89e-c742-4f02-9811-c82f6b45955d (intptr,intptr) <0x0003b>
I/MonoDroid(24640):
I/MonoDroid(24640):   --- End of managed exception stack trace ---
I/MonoDroid(24640): java.lang.IllegalArgumentException
I/MonoDroid(24640):     at com.google.android.gles_jni.EGLImpl.eglMakeCurrent(Native Method)
I/MonoDroid(24640):     at openglapplication19.Activity2.n_onDestroy(Native Method)
I/MonoDroid(24640):     at openglapplication19.Activity2.onDestroy(Activity2.java:55)
I/MonoDroid(24640):     at android.app.Activity.performDestroy(Activity.java:5403)
I/MonoDroid(24640):     at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1117)
I/MonoDroid(24640):     at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3484)
I/MonoDroid(24640):     at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:3515)
I/MonoDroid(24640):     at android.app.ActivityThread.access$1400(ActivityThread.java:135)
I/MonoDroid(24640):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1249)
I/MonoDroid(24640):     at android.os.Handler.dispatchMessage(Handler.java:102)
I/MonoDroid(24640):     at android.os.Looper.loop(Looper.java:136)
I/MonoDroid(24640):     at android.app.ActivityThread.main(ActivityThread.java:5017)
I/MonoDroid(24640):     at java.lang.reflect.Method.invokeNative(Native Method)
I/MonoDroid(24640):     at java.lang.reflect.Method.invoke(Method.java:515)
I/MonoDroid(24640):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
I/MonoDroid(24640):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
I/MonoDroid(24640):     at dalvik.system.NativeStart.main(Native Method)
E/mono    (24640):
E/mono    (24640): Unhandled Exception:
E/mono    (24640): Java.Lang.IllegalArgumentException: Exception of type 'Java.Lang.IllegalArgumentException' was thrown.
E/mono    (24640): at Android.Runtime.JNIEnv.CallBooleanMethod (intptr,intptr,Android.Runtime.JValue[]) <0x00104>
E/mono    (24640): at Javax.Microedition.Khronos.Egl.IEGL10Invoker.EglMakeCurrent (Javax.Microedition.Khronos.Egl.EGLDisplay,Javax.Microedition.Khronos.Egl.EGLSurface,Javax.Microed
ition.Khronos.Egl.EGLSurface,Javax.Microedition.Khronos.Egl.EGLContext) <0x00213>
E/mono    (24640): at OpenTK.Platform.Android.AndroidGraphicsContext.MakeCurrent (OpenTK.Platform.IWindowInfo) <0x000db>
E/mono    (24640): at OpenTK.Platform.Android.AndroidGameView.MakeCurrent () <0x0007b>
E/mono    (24640): at OpenTK.GameViewBase.OnContextSet (System.EventArgs) <0x0001f>
E/mono    (24640): at OpenTK.GameViewBase.set_GraphicsContext (OpenTK.Graphics.IGraphicsContext) <0x00047>
E/mono    (24640): at OpenTK.Platform.Android.AndroidGameView.CreateContext () <0x00073>
E/mono    (24640): at OpenTK.Platform.Android.AndroidGameView.MakeCurrent () <0x0002f>
E/mono    (24640): at OpenTK.GameViewBase.OnContextSet (System.EventArgs) <0x0001f>
E/mono    (24640): at OpenTK.GameViewBase.set_Graphic
E/mono-rt (24640): [ERROR] FATAL UNHANDLED EXCEPTION: Java.Lang.IllegalArgumentException: Exception of type 'Java.Lang.IllegalArgumentException' was thrown.
E/mono-rt (24640): at Android.Runtime.JNIEnv.CallBooleanMethod (intptr,intptr,Android.Runtime.JValue[]) <0x00104>
E/mono-rt (24640): at Javax.Microedition.Khronos.Egl.IEGL10Invoker.EglMakeCurrent (Javax.Microedition.Khronos.Egl.EGLDisplay,Javax.Microedition.Khronos.Egl.EGLSurface,Javax.Microed
ition.Khronos.Egl.EGLSurface,Javax.Microedition.Khronos.Egl.EGLContext) <0x00213>
E/mono-rt (24640): at OpenTK.Platform.Android.AndroidGraphicsContext.MakeCurrent (OpenTK.Platform.IWindowInfo) <0x000db>
E/mono-rt (24640): at OpenTK.Platform.Android.AndroidGameView.MakeCurrent () <0x0007b>
E/mono-rt (24640): at OpenTK.GameViewBase.OnContextSet (System.EventArgs) <0x0001f>
E/mono-rt (24640): at OpenTK.GameViewBase.set_GraphicsContext (OpenTK.Graphics.IGraphicsContext) <0x00047>
E/mono-rt (24640): at OpenTK.Platform.Android.AndroidGameView.CreateContext () <0x00073>
E/mono-rt (24640): at OpenTK.Platform.Android.AndroidGameView.MakeCurrent () <0x0002f>
E/mono-rt (24640): at OpenTK.GameViewBase.OnContextSet (System.EventArgs) <0x0001f>
E/mono-rt (24640): at OpenTK.GameViewBas
Comment 1 Udham Singh 2014-08-01 03:39:57 UTC
Created attachment 7562 [details]
Test App

I have checked this issue and observed the same behavior mention in bug description. To reproduce this issue I have followed the steps mentioned below : 

1. Create an android 'OpenGL App' and Implement the code provided in bug description.
2. Run and deploy the application on device.
3. Click on button "Push Activity2" and then click on button "Pop Activity2".

Screencast : http://www.screencast.com/t/0N8vK46gaP

Error Log : https://gist.github.com/saurabh360/e75e0b2b4c4998251771
Application Output : https://gist.github.com/saurabh360/07cedba878b9f94426d7
Ide Log : https://gist.github.com/saurabh360/3c085695e64cd07fc2d7

Environment Info :

=== Xamarin Studio ===

Version 5.1.4 (build 0)
Installation UUID: 312d4e9a-339c-433f-a27b-88ce0777af8f
Runtime:
	Microsoft .NET 4.0.30319.34014
	GTK+ 2.24.22 (MS-Windows theme)
	GTK# 2.12.25

=== Xamarin.Android ===

Version: 4.12.6 (Enterprise Edition)
Android SDK: D:\SDK\AndroidSDK
	Supported Android versions:
		2.1   (API level 7)
		2.2   (API level 8)
		2.3   (API level 10)
		3.1   (API level 12)
		3.2   (API level 13)
		4.0   (API level 14)
		4.0.3 (API level 15)
		4.1   (API level 16)
		4.2   (API level 17)
		4.3   (API level 18)
		4.4   (API level 19)
Java SDK: C:\Program Files (x86)\Java\jdk1.6.0_31
java version "1.6.0_31"
Java(TM) SE Runtime Environment (build 1.6.0_31-b05)
Java HotSpot(TM) Client VM (build 20.6-b01, mixed mode)

=== Build Information ===

Release ID: 501040000
Git revision: 7d45bbe2ee22625f125d0c52548524f02d005cca
Build date: 2014-07-14 13:38:46-04
Xamarin addins: c78f1d88e57baa928aeee1484d96e6f8edf8de33

=== Operating System ===

Windows 6.2.9200.0 (64-bit)
Comment 2 pierre 2014-08-04 07:10:52 UTC
By the way, the mHolder.RemoveCallback(this) is also missing in current Close/Dispose function code. This is generating some crashes depending on the disposal timings. Please properly unregister the callback during disposal too.
Comment 3 Arpit Jha 2014-10-30 09:14:49 UTC
This issue is working fine and I am going to verify this issue.

Screencast regarding same:
http://screencast.com/t/oO6qhcTckU

Environment Info:
 Xamarin Studio :Version 5.5.3 (build 6)
Installation UUID: b5156fb6-e8d3-47e2-b3a5-0925a4054ffd
Runtime:
	Microsoft .NET 4.0.30319.34003
	GTK+ 2.24.22 (MS-Windows theme)
	GTK# 2.12.25

=== Xamarin.Android ===

Version: 4.18.0 (Business Edition)
Android SDK: D:\android-sdk
	Supported Android versions:
		1.6    (API level 4)
		2.1    (API level 7)
		2.2    (API level 8)
		2.3    (API level 10)
		3.0    (API level 11)
		3.1    (API level 12)
		4.0    (API level 14)
		4.0.3  (API level 15)
		4.1    (API level 16)
		4.2    (API level 17)
		4.3    (API level 18)
		4.4    (API level 19)
		4.4.87 (API level 20)
Java SDK: C:\Program Files\Java\jdk1.6.0_39
java version "1.6.0_39"
Java(TM) SE Runtime Environment (build 1.6.0_39-b04)
Java HotSpot(TM) 64-Bit Server VM (build 20.14-b01, mixed mode)

=== Build Information ===

Release ID: 505030006
Git revision: fbe3e9453daf6a3bb9a9709ed22bec35f7c9056b
Build date: 2014-10-23 13:11:11-04
Xamarin addins: e44add2b39de4dd57c0742bb2e620dfad84c64c6

=== Operating System ===

Windows 6.2.9200.0 (64-bit)
Comment 4 Arpit Jha 2015-03-25 08:03:04 UTC
I apologise that I have verified this issue mistakenly  with wrong steps. 

This issue is also exist with  (XS 5.5.3 (build 6) + XA : 4.18.0) and (XS 5.8.2 (build 5) + XA 4.20.0)

Screencast with following build:
XS 5.5.3 (build 6) + XA : 4.18.0 : http://www.screencast.com/t/FRJcwFtwptx

XS 5.8.2 (build 5) + XA 4.20.0  : http://www.screencast.com/t/kbP5t0ielJAg


Ide log: https://gist.github.com/Arpit360/7e960a0fc06486f0c795
Application output : https://gist.github.com/Arpit360/dd39caa3300b126a62ad

For now I am reopening this issue and Please let me know for any query?

Environment Info:
=== Xamarin Studio ===

Version 5.8.2 (build 5)
Installation UUID: 0ab3f31c-da0f-40d3-be27-a8ade9c61903
Runtime:
 Microsoft .NET 4.0.30319.18408
 GTK+ 2.24.22 (MS-Windows theme)
 GTK# 2.12.26

=== Xamarin.Android ===

Version: 4.20.0 (Business Edition)
Android SDK: C:\android-sdk
 Supported Android versions:
  2.1    (API level 7)
  2.2    (API level 8)
  2.3    (API level 10)
  3.1    (API level 12)
  4.0    (API level 14)
  4.0.3  (API level 15)
  4.1    (API level 16)
  4.2    (API level 17)
  4.3    (API level 18)
  4.4    (API level 19)
  4.4.87 (API level 20)
  5.0    (API level 21)
Java SDK: C:\Program Files\Java\jdk1.7.0_71
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) Client VM (build 24.71-b01, mixed mode, sharing)

=== Xamarin Android Player ===

Version: 0.2.5
Location: C:\Program Files\Xamarin Android Player\DeviceManager.exe

=== Build Information ===

Release ID: 508020005
Git revision: 541c06a4f6c95383333375d56fd6c23ce48cb916
Build date: 2015-03-20 06:08:35-04
Xamarin addins: 02510c4990dee3475c282b3182d588975a63ff07

=== Operating System ===

Windows 6.1.7601.65536

Note You need to log in before you can comment on or make changes to this bug.