Xamarin C# empty project exception: Culture not supported - c#

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.

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.

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.

Related

Windows UWP BLE DeviceInformation.CreateWatcher throws Property key syntax error

We have a Desktop Windows app using some UWP Bluetooth LE UWP functions. We start the watcher:
string BTLEDeviceWatcherAQSString = "(System.Devices.Aep.ProtocolId:=\"{bb7bb05e-5972-42b5-94fc-76eaa7084d49}\")";
string[] props = { "System.Devices.Aep.DeviceAddress", "System.Devices.Aep.IsConnected", "System.Devices.Aep.Bluetooth.Le.IsConnectable"};
watcher = DeviceInformation.CreateWatcher(BTLEDeviceWatcherAQSString, props, DeviceInformationKind.AssociationEndpoint);
It runs OK on most machines, just rarely we have an anonymized error log:
System.Exception: Element not found. Property key syntax error. A property key must either be specified as a canonical property name (preferred) or be of the form {fmtid} pid.
at Windows.Devices.Enumeration.DeviceInformation.CreateWatcher(String aqsFilter, IEnumerable`1 additionalProperties, DeviceInformationKind kind)
We run this code for Windows 10.0.15063 (i.e. 1703) or higher, so all properties should be available by doc.
What may cause this error? Some HW configuration or Windows 10 settings?
I have seen this exception in a windows WPF desktop application. The reason was that I had neglected to detect the revision of Windows 10 was greater than version 1703 AKA creators edition. Therefore anyone running the application on an earlier version of Windows 10 would see this error. Its unfortunate that the error is so obscure, a not supported error would be better.

The type initializer for 'WebSupergoo.ABCpdf7.Internal.NDoc' threw an exception

I have installed a software ABCPDF7, which converts a html file to pdf and saves it.
I am facing an error:
ERROR MESSAGE :The type initializer for 'WebSupergoo.ABCpdf7.Internal.NDoc' threw an exception. ERROR DETAILS : at WebSupergoo.ABCpdf7.Internal.NDoc.New() at WebSupergoo.ABCpdf7.Doc..ctor()
on line :
WebSupergoo.ABCpdf7.Doc oDoc = new WebSupergoo.ABCpdf7.Doc();
======
This error is coming in one old application.
So for cross checking I did create a dummy app, and executed the code in same box and everything worked fine.
Any idea where is it failing in existing app?
ABCpdf7 requires two DLLs to be accessible: ABCPDF.DLL and ABCPDFCE7.DLL. Both must be the same version (down to the minor release number) and also must both match the bitness of the machine they are running on (32-bit or 64-bit).
Perhaps one of the DLLs in the old application is incorrect.
If you are facing this issue after Deployment , The issue could be Application Pool . It need to be configured to enable 32 bit Application . Please see attached (Embedded) Screenshot:
https://i.stack.imgur.com/MkZpA.png

XamlReader official code snippet throwing exception for me

I'm building a Windows 8 app, and want to parse some XAML from a web service to put in a RichTextBlock. I'm trying to use XamlReader to use this, but this code from Microsoft's documentation is throwing an exception in my environment.
string xaml = "<Ellipse Name=\"EllipseAdded\" Width=\"300.5\" Height=\"200\" Fill=\"Red\" \"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"/>";
object ellipse = Windows.UI.Xaml.Markup.XamlReader.Load(xaml);
When executing the second line, I get the exception:
An unhandled exception of type 'Windows.UI.Xaml.Markup.XamlParseException' occurred in mscorlib.dll
WinRT information: illegal qualified name character [Line: 1 Position: 68]
Additional information: Unspecified error
My version of VS is Microsoft Visual C# 2012 (Microsoft Visual Studio Premium 2012 Version 11.0.51106.01, Microsoft .NET Framework Version 4.5.50709). The documentation says Windows 8 should support the load method. Any ideas?
It looks like there's a typo in their XAML - they're missing an xmlns= before the namespace URI:
string xaml = "<Ellipse"
+ " Name=\"EllipseAdded\" Width=\"300.5\" Height=\"200\" Fill=\"Red\""
+ " xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"/>";
(Line wrapped for readability.)

Culture is not supported

I'm using Visual Studio 2012 Ultimate version.
I've got this error and I don't know how to solve it.
Culture is not supported.
Parameter name: name
en-UK is an invalid culture identifier.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: System.Globalization.CultureNotFoundException:
Culture is not supported. Parameter name: name en-UK is an invalid
culture identifier.
please help me
Go to Debug -> Options -> Debugging and tick "Enable Just My Code"
You should try en-GB for English (United Kingdom)
List of Cultures
In my case with IIS Express, it was caused by its inability to write to C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files as IIS Express runs by a current user. So I've added permission to write to it for the current user to solve the error.

InvalidProgramException in Team Foundation Server Sample

Hi I get an System.InvalidProgramException while trying to run the Example Project called "C# Example.WorkItemBrowser".
The Exception also apears when I try to execute these lines:
TeamFoundationServer tfserver = new TeamFoundationServer("http://localhost:8085");
tfserver.EnsureAuthenticated();
WorkItemStore store = new WorkItemStore(tfserver);
Console.WriteLine(store.Projects.Count);
I'm using the 2008 Visual Studio SDK for that.
PEverify for the assembly Microsoft.TeamFoundation.WorkItemTracking.Client.dll
got this otuput:
[MD]: Error: Value class has neither fields nor size parameter. [token:0x020000B3]
[MD]: Error: Value class has neither fields nor size parameter. [token:0x020000BF]
[MD]: Error: Value class has neither fields nor size parameter. [token:0x020000C4]
3 Error(s) Verifying Microsoft.TeamFoundation.WorkItemTracking.Client.dll
A fresh download and install of the SDK as well as deinstall and install as well as installing .net 3.5 sp1 again didn't help.
Is something wrong with the description of my problem or did it just not happen anywhere else?
I just a very similar question here.
Turns out, you have to have Team Explorer installed on the machine you are executing this code on.

Categories

Resources