Fresh pull of MonoGame source crashes an empty project on launch with InvalidFramebufferOperationExt

I can’t seem to track this one down. This can be reproduced by doing the following on Mac:

  • pull MonoGame source from GitHub
  • run mono Protobuild.exe to generate project files
  • build the solution
  • create a fresh MonoGame project
  • replace all NuGet references with a reference to the MonoGame.Framework.MacOS project

Run that and it results in an InvalidFramebufferOperationExt the first time GL.Clear is called. Running in release mode works fine since CheckGLError is a noop for non-DEBUG builds. Any ideas what’s going on here?

Unhandled Exception:
Microsoft.Xna.Framework.Graphics.MonoGameGLException: GL.GetError() returned InvalidFramebufferOperationExt
  at Microsoft.Xna.Framework.Graphics.GraphicsExtensions.CheckGLError () [0x00024] in /Users/desaro/Desktop/MG/MonoGame.Framework/Graphics/GraphicsExtensions.cs:883 
  at Microsoft.Xna.Framework.Graphics.GraphicsDevice.PlatformClear (ClearOptions options, Vector4 color, Single depth, Int32 stencil) [0x0010a] in /Users/desaro/Desktop/MG/MonoGame.Framework/Graphics/GraphicsDevice.OpenGL.cs:314 
  at Microsoft.Xna.Framework.Graphics.GraphicsDevice.Clear (Color color) [0x00020] in /Users/desaro/Desktop/MG/MonoGame.Framework/Graphics/GraphicsDevice.cs:417 
  at Microsoft.Xna.Framework.Graphics.GraphicsDevice.ApplyRenderTargets (Microsoft.Xna.Framework.Graphics.RenderTargetBinding[] renderTargets) [0x000c1] in /Users/desaro/Desktop/MG/MonoGame.Framework/Graphics/GraphicsDevice.cs:722 
  at Microsoft.Xna.Framework.Graphics.GraphicsDevice.Initialize () [0x000b9] in /Users/desaro/Desktop/MG/MonoGame.Framework/Graphics/GraphicsDevice.cs:277 
  at Microsoft.Xna.Framework.Graphics.GraphicsDevice..ctor (Microsoft.Xna.Framework.Graphics.GraphicsAdapter adapter, GraphicsProfile graphicsProfile, Microsoft.Xna.Framework.Graphics.PresentationParameters presentationParameters) [0x00122] in /Users/desaro/Desktop/MG/MonoGame.Framework/Graphics/GraphicsDevice.cs:200 
  at Microsoft.Xna.Framework.GraphicsDeviceManager.Initialize () [0x00089] in /Users/desaro/Desktop/MG/MonoGame.Framework/GraphicsDeviceManager.cs:385 
  at Microsoft.Xna.Framework.GraphicsDeviceManager.CreateDevice () [0x00002] in /Users/desaro/Desktop/MG/MonoGame.Framework/GraphicsDeviceManager.cs:90 
  at Microsoft.Xna.Framework.GamePlatform.BeforeInitialize () [0x0003a] in /Users/desaro/Desktop/MG/MonoGame.Framework/GamePlatform.cs:207 
  at Microsoft.Xna.Framework.Game.DoInitialize () [0x0000d] in /Users/desaro/Desktop/MG/MonoGame.Framework/Game.cs:678 
  at Microsoft.Xna.Framework.Game.Run (GameRunBehavior runBehavior) [0x0003b] in /Users/desaro/Desktop/MG/MonoGame.Framework/Game.cs:384 
  at Microsoft.Xna.Framework.Game.Run () [0x0000d] in /Users/desaro/Desktop/MG/MonoGame.Framework/Game.cs:370 
  at TesterProject.AppDelegate.FinishedLaunching (MonoMac.Foundation.NSObject notification) [0x00037] in /Users/desaro/Desktop/MG/TesterProject/Main.cs:49 
  at (wrapper dynamic-method) System.Object:[TesterProject.AppDelegate:Void FinishedLaunching(MonoMac.Foundation.NSObject)] (MonoMac.Foundation.NSObject,MonoMac.ObjCRuntime.Selector,MonoMac.Foundation.NSObject)
  at (wrapper native-to-managed) System.Object:[TesterProject.AppDelegate:Void FinishedLaunching(MonoMac.Foundation.NSObject)] (MonoMac.Foundation.NSObject,MonoMac.ObjCRuntime.Selector,MonoMac.Foundation.NSObject)
  at (wrapper managed-to-native) MonoMac.AppKit.NSApplication:NSApplicationMain (int,string[])
  at MonoMac.AppKit.NSApplication.Main (System.String[] args) [0x0003d] in <filename unknown>:0 
  at TesterProject.Program.Main (System.String[] args) [0x0001d] in /Users/desaro/Desktop/MG/TesterProject/Main.cs:26 
[ERROR] FATAL UNHANDLED EXCEPTION: Microsoft.Xna.Framework.Graphics.MonoGameGLException: GL.GetError() returned InvalidFramebufferOperationExt
  at Microsoft.Xna.Framework.Graphics.GraphicsExtensions.CheckGLError () [0x00024] in /Users/desaro/Desktop/MG/MonoGame.Framework/Graphics/GraphicsExtensions.cs:883 
  at Microsoft.Xna.Framework.Graphics.GraphicsDevice.PlatformClear (ClearOptions options, Vector4 color, Single depth, Int32 stencil) [0x0010a] in /Users/desaro/Desktop/MG/MonoGame.Framework/Graphics/GraphicsDevice.OpenGL.cs:314 
  at Microsoft.Xna.Framework.Graphics.GraphicsDevice.Clear (Color color) [0x00020] in /Users/desaro/Desktop/MG/MonoGame.Framework/Graphics/GraphicsDevice.cs:417 
  at Microsoft.Xna.Framework.Graphics.GraphicsDevice.ApplyRenderTargets (Microsoft.Xna.Framework.Graphics.RenderTargetBinding[] renderTargets) [0x000c1] in /Users/desaro/Desktop/MG/MonoGame.Framework/Graphics/GraphicsDevice.cs:722 
  at Microsoft.Xna.Framework.Graphics.GraphicsDevice.Initialize () [0x000b9] in /Users/desaro/Desktop/MG/MonoGame.Framework/Graphics/GraphicsDevice.cs:277 
  at Microsoft.Xna.Framework.Graphics.GraphicsDevice..ctor (Microsoft.Xna.Framework.Graphics.GraphicsAdapter adapter, GraphicsProfile graphicsProfile, Microsoft.Xna.Framework.Graphics.PresentationParameters presentationParameters) [0x00122] in /Users/desaro/Desktop/MG/MonoGame.Framework/Graphics/GraphicsDevice.cs:200 
  at Microsoft.Xna.Framework.GraphicsDeviceManager.Initialize () [0x00089] in /Users/desaro/Desktop/MG/MonoGame.Framework/GraphicsDeviceManager.cs:385 
  at Microsoft.Xna.Framework.GraphicsDeviceManager.CreateDevice () [0x00002] in /Users/desaro/Desktop/MG/MonoGame.Framework/GraphicsDeviceManager.cs:90 
  at Microsoft.Xna.Framework.GamePlatform.BeforeInitialize () [0x0003a] in /Users/desaro/Desktop/MG/MonoGame.Framework/GamePlatform.cs:207 
  at Microsoft.Xna.Framework.Game.DoInitialize () [0x0000d] in /Users/desaro/Desktop/MG/MonoGame.Framework/Game.cs:678 
  at Microsoft.Xna.Framework.Game.Run (GameRunBehavior runBehavior) [0x0003b] in /Users/desaro/Desktop/MG/MonoGame.Framework/Game.cs:384 
  at Microsoft.Xna.Framework.Game.Run () [0x0000d] in /Users/desaro/Desktop/MG/MonoGame.Framework/Game.cs:370 
  at TesterProject.AppDelegate.FinishedLaunching (MonoMac.Foundation.NSObject notification) [0x00037] in /Users/desaro/Desktop/MG/TesterProject/Main.cs:49 
  at (wrapper dynamic-method) System.Object:[TesterProject.AppDelegate:Void FinishedLaunching(MonoMac.Foundation.NSObject)] (MonoMac.Foundation.NSObject,MonoMac.ObjCRuntime.Selector,MonoMac.Foundation.NSObject)
  at (wrapper native-to-managed) System.Object:[TesterProject.AppDelegate:Void FinishedLaunching(MonoMac.Foundation.NSObject)] (MonoMac.Foundation.NSObject,MonoMac.ObjCRuntime.Selector,MonoMac.Foundation.NSObject)
  at (wrapper managed-to-native) MonoMac.AppKit.NSApplication:NSApplicationMain (int,string[])
  at MonoMac.AppKit.NSApplication.Main (System.String[] args) [0x0003d] in <filename unknown>:0 
  at TesterProject.Program.Main (System.String[] args) [0x0001d] in /Users/desaro/Desktop/MG/TesterProject/Main.cs:26

I belive i have the same issue… Were you able to get this resolved?

Nope. I gave up trying and just used release builds to work around the issue.

If you use MonoDevelop/Xamarin(Recommended as MonoGame has more recent nuget builds and project types that are compatable with it) you can get the latest Packages which are newer than listed on site and to my experience doesnt have these issues. Alternatively, should be able to do so in Xamarin and reopen in VS and it should still work too.

Having an updated DLL does not really help when you are making changes to the source…

It looks like this only happens on a device with IOS 9.2 is installed.

I am seeing this on Mac. I didnt even try to deploy an iOS project. Just a plain old empty Mac project.