Bug 2890 - OpenGLESSample-GameView application throws Fatal Unhandled exception on application close in simulator
Summary: OpenGLESSample-GameView application throws Fatal Unhandled exception on appli...
Status: VERIFIED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: XI runtime ()
Version: 5.0
Hardware: Macintosh Mac OS
: Highest critical
Target Milestone: Untriaged
Assignee: Rolf Bjarne Kvinge [MSFT]
URL:
Depends on:
Blocks:
 
Reported: 2012-01-13 12:20 UTC by lindsey.driscoll
Modified: 2014-01-24 09:43 UTC (History)
6 users (show)

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


Attachments
Fatal Unhandled exception (3.31 KB, text/plain)
2012-01-13 12:20 UTC, lindsey.driscoll
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
VERIFIED FIXED

Description lindsey.driscoll 2012-01-13 12:20:03 UTC
Created attachment 1188 [details]
Fatal Unhandled exception

Fatal Unhandled exception thrown when clicking the home button in the iPhone simulator to exit the application.


Screencast: http://screencast.com/t/PkYwQlY0r


Steps to reproduce:

1. Open the OpenGLESSample-GameView sample application in MonoDevelop
2. Run the application in the iPhone simulator through MD
3. Wait for view to load
- Should see a spinning colorful square
4. Click the iPhone home button to exit the application


Actual result:

Application output indicates FATAL UNHANDLED exception occurs (see attachment)

Expected result:

Should not have a FATAL UNHANDLED exception when exiting program through home button click


Environment:

Macosx Lion
MonoDevelop: 2.8.6
MonoTouch: 5.1.2
Mono: 2.10.8
Comment 1 lindsey.driscoll 2012-01-13 13:37:23 UTC
Note: This problem did not exist in the previous stable release of MT (5.0.4)
Comment 2 Sebastien Pouliot 2012-01-13 15:17:59 UTC
I can't duplicate it - at least no exactly like this*. Can you reliably reproduce it ? or maybe the app was interrupted in a weird place ?

* When I click on the simulator home button the application quits but I don't get the exception shown in MonoDevelop. OTOH MonoDevelop** does not stop (it still believe it's debugging the app) and I have to stop it manually (that seems consistent with other applications, I don't often use the home button with the simulator ;-).

** I'm using MonoDevelop 2.8.5 (on Lion) so this might explain the difference.
Comment 3 Sebastien Pouliot 2012-01-13 15:44:50 UTC
I used the wrong sample -> OpenGLESSample-GameView
Comment 4 Sebastien Pouliot 2012-01-13 16:10:29 UTC
This null check will avoid the exception - but maybe we should have our own GetContext implementation ? 

diff --git a/Source/OpenTK/Graphics/GraphicsContext.cs b/Source/OpenTK/Graphics/GraphicsContext.cs
index f62d29a..501d445 100644
--- a/Source/OpenTK/Graphics/GraphicsContext.cs
+++ b/Source/OpenTK/Graphics/GraphicsContext.cs
@@ -300,7 +300,7 @@ namespace OpenTK.Graphics
             foreach (WeakReference weak_ref in available_contexts.Values)
             {
                 IGraphicsContext context = (IGraphicsContext)weak_ref.Target;
-                if (context.IsCurrent)
+                if (context != null && context.IsCurrent)
                 {
                     return (context as IGraphicsContextInternal).Context;
                 }
Comment 5 Miguel de Icaza [MSFT] 2012-01-13 16:20:00 UTC
Adding Rolf to this one, since this is OpenTK related.
Comment 6 Rolf Bjarne Kvinge [MSFT] 2012-01-13 21:41:24 UTC
Fixed in 8a3c1b2e.
Comment 7 narayanp 2014-01-24 09:43:15 UTC
I have checked this issue with following builds:

All Mac
X.S 4.2.3(build 154)
Mono 3.2.6
X.iOS 7.0.7-64

Now I am not seeing crash, Cube appears on simulator. This is the screencast for the same: http://screencast.com/t/Zicn9VyriGV