I’ve followed along with the latest getting started guide here:
https://docs.monogame.net/articles/getting_started/2_creating_a_new_project_vs.html
I started with a new install of VS2022, the required workload components and then proceeded to creating the example “Pong” project, from the “Cross-Platform Desktop template”.
It all goes well until I run the default program. No window appears, no Cornflower blue, just a program exit:
The program '[16560] PongVS2022.exe' has exited with code 3221226505 (0xc0000409).
I tried to debug the situation using the latest Git code and traced the issue to this file:
\MonoGame.Framework\Platform\SDL\SDL2.cs
Line 399:
public static IntPtr Create(string title, int x, int y, int w, int h, int flags)
{
return GetError(SDL_CreateWindow(title, x, y, w, h, flags));
}
This gets called twice (before program crash). The first time is from:
\MonoGame.Framework\Platform\SDL\SDLGameWindow.cs constructor, line 132:
_handle = Sdl.Window.Create("", 0, 0,
GraphicsDeviceManager.DefaultBackBufferWidth, GraphicsDeviceManager.DefaultBackBufferHeight,
Sdl.Window.State.Hidden | Sdl.Window.State.FullscreenDesktop);
and this call completes without issue.
the second time is from the same classes CreateWindow method, on line 161:
_handle = Sdl.Window.Create(
AssemblyHelper.GetDefaultWindowTitle(),
winx, winy, _width, _height, initflags
);
passing values:
title = "Pong"
x = 805240832
y = 805240832
w = 800
h = 480
flags = 1546
this is where the line:
return GetError(SDL_CreateWindow(title, x, y, w, h, flags));
causes the program to crash.
I’ve not modified the default program from the template in any way, this was all fresh out of the box. does anyone have any ideas what is going wrong here?