2
\$\begingroup\$

I've written a game in MonoGame, which works great on my desktop computer. It's running Windows 8, has a good graphics card and can be assumed to be up to date with everything.

However, when I run on my laptop, it crashes within the starting function game.Run(). I created a new template project, and it still crashes. I've check the obvious places, it's running x86 config, I've installed the openAL, and the dlls are in the right places.

The error is "NullReferenceException" occurred in MonoGame.Framework.dll

I can't post images, but I've changed nothing about the new project. It runs the init and the loadContent functions, then crashes.

The thing that might be important, the laptop has openGL 2.1, Windows 7. I have OpenTK, OpenAL installed. If anyone has even suggestions on things that might be the cause, or want more info, just say.

EDIT: The stack is as follows:

at Microsoft.Xna.Framework.Audio.OpenALSoundController.Update()
at Microsoft.Xna.Framework.OpenTKGamePlatform.BeforeUpdate(GameTime gameTime)
at Microsoft.Xna.Framework.Game.DoUpdate(GameTime gameTime)
at Microsoft.Xna.Framework.Game.Tick()
at Microsoft.Xna.Framework.OpenTKGameWindow.OnUpdateFrame(Object sender, FrameEventArgs e)
at System.EventHandler`1.Invoke(Object sender, TEventArgs e)
at OpenTK.GameWindow.OnUpdateFrame(FrameEventArgs e)
at OpenTK.GameWindow.OnUpdateFrameInternal(FrameEventArgs e)
at OpenTK.GameWindow.RaiseUpdateFrame(Stopwatch update_watch, Double& next_update, FrameEventArgs update_args)
at OpenTK.GameWindow.DispatchUpdateAndRenderFrame(Object sender, EventArgs e)
at OpenTK.GameWindow.Run(Double updates_per_second, Double frames_per_second)
at OpenTK.GameWindow.Run(Double updateRate)
at Microsoft.Xna.Framework.OpenTKGamePlatform.RunLoop()
at Microsoft.Xna.Framework.Game.Run(GameRunBehavior runBehavior)
at Microsoft.Xna.Framework.Game.Run()
at Mojo.Program.Main(String[] args)

Posted as an error report to MonoGame, I'll answer this depending on their response.

\$\endgroup\$
5
  • \$\begingroup\$ What operating system are you running on the laptop, and what type of game did you write/what kind of graphics is it using (2d/3d, shaders, etc.)? \$\endgroup\$
    – Pandacoder
    Aug 5, 2013 at 9:36
  • \$\begingroup\$ This happens if you run it with a keyboard that OpenTK doesn't support (eg. remote desktop). It might be that. Can you post the exception stack trace? \$\endgroup\$
    – ashes999
    Aug 5, 2013 at 9:41
  • \$\begingroup\$ NullReferenceException is not very helpful. It could be any number of things already mentioned or something else entirely, try to track down what line of code is throwing the exception or grab the stack trace msdn.microsoft.com/en-us/library/… \$\endgroup\$ Aug 5, 2013 at 11:11
  • \$\begingroup\$ This is totally a bug report to file for MonoGame and likely too vague (in the sense there's not enough info here to know the problem) and too specific (in the sense this isn't super helpful to most people) for GDSE. \$\endgroup\$ Aug 5, 2013 at 16:59
  • \$\begingroup\$ Is this yours? github.com/mono/MonoGame/issues/1376 \$\endgroup\$ Aug 6, 2013 at 0:09

1 Answer 1

1
\$\begingroup\$

I had this the other day. After much frustration ("What have I done? Nothing's changed!") I realised that I had unplugged my headphones.

Apparently OpenTK makes some assumptions about using sound drivers - try plugging in your speakers...!

(Notice that in the stack trace it is the sound controller throwing the exception)

\$\endgroup\$
4
  • 2
    \$\begingroup\$ If that's the case, is there no way to fix it in the game code? I certainly would not want to release anything with problems like that. In fact every where I worked a bug report like that would block the release entirely. \$\endgroup\$
    – Will
    Aug 6, 2013 at 9:58
  • \$\begingroup\$ Certainly not in game code. It's an issue with OpenTK/AL. A fresh Monogame project had this issue when I tried it out \$\endgroup\$
    – Alex
    Aug 6, 2013 at 10:17
  • 1
    \$\begingroup\$ You should go through MonoGame's sources, where the exception is being raised, and handle it properly. Then submit the fix so that future programmers don't hit the same wall again. \$\endgroup\$
    – user15805
    Aug 6, 2013 at 11:17
  • \$\begingroup\$ The problem was indeed fixed by plugging in headphones. I reported this with the MonoGame author and they've added protection against this happening in future versions. \$\endgroup\$
    – Tom
    Aug 7, 2013 at 10:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .