System.TypeInitializationException: 'The type initializer for 'Sdl' threw an exception.'
Prerequisites
- [x] I have verified this issue is present in the
developbranch - [x] I have searched open and closed issues to ensure it has not already been reported.
MonoGame Version
MonoGame 3.8.4
Which MonoGame platform are you using?
MonoGame Cross-Platform Desktop Application (mgdesktopgl)
Operating System
Windows
Description
Starting from a fresh Monogame template, haven't modified anything and it crashes. The SDL2 dll is present next to the executable.
I'm using VS 2026 and Windows 11 on arm if that makes any difference.
Steps to Reproduce
- Create new project from latest templates
- Run
- Crash.
Minimal Example Repo
No response
Expected Behavior
The official templates should at least compile without modifications.
Resulting Behavior
Crash.
Files
No response
VS 2026 and Windows 11 on arm if that makes any difference
It makes a big one.
I believe this is fixed for 3.8.5. You can test a preview by using the 3.8.5-develop.12 nugets.
Using 3.8.5-develop.12 I get a different crash, I believe it might be the same but VS doesn't catch it?
Here's the whole output, the debugger does attach but doesn't seem to catch the exceptions.
Exception thrown: 'System.DllNotFoundException' in System.Private.CoreLib.dll
Exception thrown: 'System.TypeInitializationException' in MonoGame.Framework.dll
Do you happen to have manually replaced the dll yourself? (if so, you shouldn't)
Maybe try to delete the bin and obj folders before attempting to rebuild, just to make sure that the correct dll gets in the output folder.
Are you running VS for ARM and .NET for ARM?
I haven't, still happens after deleting the bin and obj folders.
I tried with both .NET8 for ARM via the command-line and VS2026's bundled .NET10 and got the same result.
I'm not sure if VS2026 detected Windows for ARM on download or something but it is running properly on an ARM machine so, I would assume so?
I don't have that issue when running on macOS but it's not a viable workaround (I use Windows-exclusive APIs so it just crashes later with platform exceptions).
Still happens with 3.8.5.develop-13 on the official release of VS2026. @ThomasFOG