Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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.
Description of Issue: Customer reported an issue in 6.3.8 that was fixed in 6.3.6. Believes it is related to Bug #12212 that was fixed in 6.3.6:
Fix disposal of EAGLContext and GraphicsContext to avoid exceptions [#12212] (from the Xamarin.iOS release notes)
Reverting back to 6.3.6 fixed issue, so looks like a possible regression.
Here is the Xamarin info:
=== Xamarin Studio ===
Version 4.0.10 (build 5)
Installation UUID: c0cff6c3-82c4-47ab-95d4-d4952faa7115
Mono 3.1.2 ((no/71af847)
Package version: 301020000
=== Apple Developer Tools ===
Xcode 4.6.3 (2068)
=== Xamarin.iOS ===
Version: 220.127.116.11 (Business Edition)
Build date: 2013-17-07 15:48:27-0400
=== Xamarin.Android ===
Version: 4.8.0 (Starter Edition)
Android SDK: /Users/wwang/Library/Developer/Xamarin/android-sdk-mac_x86
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)
Java SDK: /usr
java version "1.6.0_51"
Java(TM) SE Runtime Environment (build 1.6.0_51-b11-456-11M4508)
Java HotSpot(TM) 64-Bit Server VM (build 20.51-b01-456, mixed mode)
=== Xamarin.Mac ===
Xamarin.Mac: Not Installed
=== Build Information ===
Release ID: 400100005
Git revision: f78b1117e201b3890dce45559bc8995adc4005a2
Build date: 2013-07-15 16:16:13+0000
Xamarin addins: a158bb2e0120450d0d23a35a5d4cbc695947bcab
=== Operating System ===
Mac OS X 10.8.4
Darwin Williams-iMac.local 12.4.0 Darwin Kernel Version 12.4.0
Wed May 1 17:57:12 PDT 2013
The patch for #12212 is still there and included in the latest builds.
$ git branch --contains 938cf69518205d26fe4243dca1a0b6cdf8dbb46a
Please attach your test case to reproduce the issue.
This problem appears to still be present in 6.4.0. I believe it's related to a GC issue related to IGraphicsContextInternal object being disposed of.
If the iPhoneOSGraphicsContext object is created as follows the EAGLContext object eventually gets disposed of prematurely:
Context = (iPhoneOSGraphicsContext)( (IGraphicsContextInternal)Utilities.CreateGraphicsContext(EAGLRenderingAPI.OpenGLES2) ).Implementation;
However, if a handle to the IGraphicsContextInternal object is kept the problem seems to not exhibit itself:
ContextInternal = (IGraphicsContextInternal)Utilities.CreateGraphicsContext(EAGLRenderingAPI.OpenGLES2);
Context = (iPhoneOSGraphicsContext)ContextInternal.Implementation;
Here is an OpenTK post regarding an issue that sounds very similar:
Created attachment 4476 [details]
EAGLContext becomes null
Sample project where EAGLContext eventually becomes null. Sample modified from https://github.com/chrisntr/monotouch-samples/tree/master/OpenGLESSample (only Context assignment line modified).
I can reproduce a NRE with that test case, I'll have a look.
Any update on this issue?
I've looked into this now, and I'm not sure there is a bug.
You're creating a GraphicsContext, then fetching its implementation and forgetting about the GraphicsContext you just created.
Then the GraphicsContext is freed, and will dispose its implementation, causing the NRE.
The sample runs successfully if you store the GraphicsContext in the EAGLView instance.