Reputation: 599
Just downloaded Xamarin Studio 5.9.6 (build 23), and went into Tools - Options - Language, and selected "English" as the "User interface language".
When I created a new C# "empty project", Xamarin complained, a dialog box displayed saying: "An error has occurred - The project could not be created".
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeInitializationException:
The type initializer for 'Microsoft.FSharp.Compiler.SourceCodeServices.FSharpChecker' threw an exception. ---> System.TypeInitializationException:
The type initializer for '<StartupCode$FSharp-Compiler-Service>.$Service' threw an exception. ---> System.TypeInitializationException:
The type initializer for '<StartupCode$FSharp-Compiler-Service>.$Reactor' threw an exception. ---> System.Globalization.CultureNotFoundException: Culture is not supported.
Parameter name: culture
4096 (0x1000) is an invalid culture identifier.
Kinda of a strange little annoyance. Running Windows 10 x64. I have tons of Visual Studios on this PC as well, including VS2015.
Upvotes: 0
Views: 535
Reputation: 47967
This is a bug in Xamarin Studio's language selection on Windows 10. It is fixed in Xamarin Studio 5.10.
This is normally seen when English is selected, typically this would be done with Windows 10 using a non-English language, and configuring Xamarin Studio to use English would not change the UI text but would still show the language used by Windows.
The problem is that on Windows 10 a lot of the English non-neutral cultures returned from CultureInfo.GetCultures have an unspecified custom locale ID (LCID) which is 0x1000. Earlier versions of Windows do not have this problem. One of these cultures was being used to set the current UI culture and it was ignored since it is invalid. According to the MSDN documentation before Windows 10 unspecified custom locale ids were assigned to custom cultures created by the user. In Windows 10 this unspecified custom locale id is assigned to any culture that does not have a unique locale identifier and does not have complete system provided data. So Windows 10 returns more locales with this unspecified locale id.
Since Xamarin Studio was using an invalid culture this caused the F# exception.
Now these cultures with unspecified custom locale ids are ignored by Xamarin Studio 5.10 and above.
Upvotes: 2
Reputation: 599
The interesting thing about this error is it is complaining about the F# compiler. Yet, my intent was to create a new C# empty project. ...and I do have F# loaded due to my Visual Studio instance(s). And I am in the USA, it's not like I was attempting to load a different language.
So the quick fix for this was to go back into Xamarin Tools - Options - Language, and change it back to (default).
User error (?) by selecting English.
Upvotes: 0