Program won't run from VS using x86 configuration (MonoGame 3.5.1)

I’ve been trying to get started with Monogame, and so I’ve installed VS2015 community, and then the latest Monogame version. I then created a new “MonoGame Cross Platform Desktop Project” and got the standard default “cornflower blue” window template program.

I have a few weird things going on though that maybe someone can help with:

  • If I run the program from VS with Debug/Release & x86 configuration, it will try and run, no window appears, and in the output console it says:

The program '[9012] test123.vshost.exe' has exited with code 1080890248 (0x406d1388).

In the windows event viewer, it has a more detailed error about it, saying:

Faulting module name: KERNELBASE.dll, version: 10.0.14393.479, time stamp: 0x58256d37

  • However, if I manually run the built test123.exe from the bin/DesktopGL/x86/Debug folder, it runs fine (although the window position is weird and not centered). Running under Debug & x64 config works fine directly from Visual Studio as well.

Has anyone got any ideas why it won’t run correctly from inside VS? I’ve tried reinstalling both VS and Monogame but nothing seems to fix the problem. I can continue with using x64 of course for development, but it bothers me that something isn’t set up correctly. Thanks.

After almost randomly testing out settings in Visual Studio, it seems to run with x86 when “Enable native code debugging” is enabled in the project settings, although I don’t know enough about this to understand why this fixed the problem.

It shouldn’t require that. I’ll have a look at it soon.

Thanks - just to update, it’s still a bit dodgy with that setting enabled, often the window won’t actually appear. However, if I run from the VS menu using “Run without debugging” it runs correctly even with x86. So it seems to be something related to debugging, and only with x86.

When I was searching for that error code, I came across a possibly-related issue someone had raised with FNA - Github issue - could that somehow be related to this problem, I think MonoGame also now uses SDL for the OpenGL projects?

Just to let you know, I started up a test Desktop Cross Platform project and got the same issue.

Made with a Win 7 machine and source controlled using Github, cloned it on a different Windows 10 machine and wouldn’t run unless I did the above settings.

Same exit code of 0x406d1388.

Edit: Some more info might be helpful, Win 7 was with VS 2015, Win 10 was with VS 2017. Both used the latest MonoGame 3.6 installed from the website.

I ran into this problem. It turned that there the 2 SDL dlls in my output folder. After clearing the Debug output directory and insuring that only the correct one ‘SDL2.dll’ got copied, things started working again