Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux: Error loading SpriteEffect.ogl.mgfxo #3160

Closed
adamreeve opened this issue Nov 8, 2014 · 4 comments
Closed

Linux: Error loading SpriteEffect.ogl.mgfxo #3160

adamreeve opened this issue Nov 8, 2014 · 4 comments

Comments

@adamreeve
Copy link

Running an empty game that just uses the plain game template from https://github.com/mono/MonoGame/wiki/Tutorials%3A-Creating-a-Game-Class crashes with this exception:

Unhandled Exception:
System.TypeInitializationException: An exception was thrown by the type initializer for Microsoft.Xna.Framework.Graphics.SpriteEffect ---> System.NullReferenceException: Object reference not set to an instance of an object
at Microsoft.Xna.Framework.Graphics.Effect.LoadEffectResource (System.String name) [0x00000] in <filename unknown>:0~
at Microsoft.Xna.Framework.Graphics.SpriteEffect..cctor () [0x00000] in <filename unknown>:0~
--- End of inner exception stack trace ---
at Shooter.ShooterGame.LoadContent () [0x00008] in /mnt/data/dev/games/ShooterTutorial/Shooter/ShooterGame.cs:96~
at Microsoft.Xna.Framework.Game.Initialize () [0x00000] in <filename unknown>:0~
at Shooter.ShooterGame.Initialize () [0x00069] in /mnt/data/dev/games/ShooterTutorial/Shooter/ShooterGame.cs:86~
at Microsoft.Xna.Framework.Game.DoInitialize () [0x00000] in <filename unknown>:0~
at Microsoft.Xna.Framework.Game.Run (GameRunBehavior runBehavior) [0x00000] in <filename unknown>:0~
at Microsoft.Xna.Framework.Game.Run () [0x00000] in <filename unknown>:0~
at ShooterLinux.Program.Main () [0x00008] in /mnt/data/dev/games/ShooterTutorial/ShooterLinux/Program.cs:19~
X Error of failed request:  BadCursor (invalid Cursor parameter)
Major opcode of failed request:  95 (X_FreeCursor)
Resource id in failed request:  0x2600005
Serial number of failed request:  121
Current serial number in output stream:  122
AL lib: (EE) alc_cleanup: 1 device not closed

I'm not sure why the traceback says "filename unknown" for every line, I'm using the Debug builds for everything...

The crash is at this line in my ShooterGame.cs file:

spriteBatch = new SpriteBatch(GraphicsDevice);

It looks like the error occurs when constructing the SpriteEffect class, at this section:

        static internal readonly byte[] Bytecode = LoadEffectResource(
#if DIRECTX
            "Microsoft.Xna.Framework.Graphics.Effect.Resources.SpriteEffect.dx11.mgfxo"
#elif PSM
            "Microsoft.Xna.Framework.PSSuite.Graphics.Resources.SpriteEffect.cgx" //FIXME: This shader is totally incomplete
#else
            "Microsoft.Xna.Framework.Graphics.Effect.Resources.SpriteEffect.ogl.mgfxo"
#endif

It looks like for some reason the SpriteEffect.ogl.mgfxo file isn't found, but I can see that it's at ./MonoGame.Framework/Graphics/Effect/Resources/SpriteEffect.ogl.mgfxo

I'm using MonoDevelop 5.4 and Mono 3.10.0 on Fedora 20.

@flibitijibibo
Copy link
Contributor

I ran into this as well, you'll have to either work around this or downgrade Mono and its tools back to 2.10:

https://plus.google.com/+flibitijibibo/posts/KzeuHnQt96E

Not sure where the regression occurred, not sure if it's been fixed in the next version.

@adamreeve
Copy link
Author

Ok thanks, I'll see if this has been fixed in Mono and then report a bug if not.

@adamreeve
Copy link
Author

I've submitted a bug to Mono at https://bugzilla.xamarin.com/show_bug.cgi?id=24454. After a bit more testing, I've noticed that sometimes the build works fine and doesn't have this problem, which is extra weird... I also couldn't reproduce this behaviour with a minimal example, so I'm not sure what exactly is triggering this in MonoGame.

@harry-cpp
Copy link
Member

@tomspilman This is a mono bug not a monogame bug, and it has been fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants