Recently, my crash manager has emailed me a crash from a game that I'm working on.
System.ArgumentException: Exception from HRESULT: 0x80070057 (E_INVALIDARG)
at System.Globalization.CultureInfo.nativeSetThreadLocale(String localeName)
at System.Threading.Thread.set_CurrentCulture(CultureInfo value)
at Siphon_Spirit.Game1.Initialize()
at Microsoft.Xna.Framework.Game.RunGame(Boolean useBlockingRun)
at Siphon_Spirit.Program.Main(String[] args)
Since it was automatically emailed, I don't know where the user was located, but it seems that for their machine InvariantCulture is not set up or something.
In my initialize method I use the following code. I believe that only the two lines setting the CurrentCulture and the CurrentUICulture are causing issues.
protected override void Initialize()
{
this.IsMouseVisible = false;
SetFullScreen(true);
SaveController.LoadOptions();
screenManager = new Screens.ScreenManager();
screenManager.Initialize();
graphics.ApplyChanges();
Window.Title = "Siphon Spirit";
SaveController.Initialize();
rendertarget = new RenderTarget2D(GraphicsDevice, GlobalData.ScreenWidth, GlobalData.ScreenHeight);
debugger = new Debugger();
Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;
Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.InvariantCulture;
base.Initialize();
}
Any ideas as to what is making it crash? This seems to be an isolated case, as more people have run it with no issues.