WPF C#: Starting crash due to client 'Region and Language' settings

Posted by FrieK on Stack Overflow See other posts from Stack Overflow or by FrieK
Published on 2010-05-30T19:00:40Z Indexed on 2010/05/30 19:12 UTC
Read the original article Hit count: 153

Hi, I'm working on a WPF C# application, and it seems to crash with a few random people.

So eventually I found out it was the 'Region and Language' settings that was responsible.

For example, if I were to set my Format to English (United States) it will work, if I set it to Swedish (Sweden) it will crash from the start.

When I test this in Visual Studio 2010 it gives error 'TypeInitializationException'. More precisely it does it here (it doesn't get passed the InitializeComponent() void):

private void RadioButton_Checked(object sender, RoutedEventArgs e) {
 Info.SortOrder = SortBy.Rank;
}

It claims the error at the first line, which is just setting an enum value to a variable. I guess it's just doing it there because it's the first thing it makes, or something.

Anyone has any idea how to fix this? I've searched around but can't seem to find out how :(

Any help is much appreciated!

Thanks

© Stack Overflow or respective owner

Related posts about wpf

Related posts about date