markus
markus

Reputation: 53

Xamarin UI Test "1 is not a supported code page."

I have a problem with my computer when trying to run xamarin UI tests. It's a xamarin forms project and I'm building and testing on android devices. I'm using visual studio community 2017 and windows.

I have tried both in my own project and in the example project provided by microsoft here: https://developer.xamarin.com/samples/test-cloud/Quickstarts/CreditCardValidator.Droid/

The same code works on several other computers, with the same setup as far as i can see.

The error I get is this:

System.ArgumentException : 1 is not a supported code page.
Parameter name: codepage

This is the end of the stacktrace:

at System.Text.Encoding.GetEncoding(Int32 codepage)
at ICSharpCode.SharpZipLib.Zip.ZipFile.ReadEntries()
at ICSharpCode.SharpZipLib.Zip.ZipFile..ctor(FileStream file)
at Xamarin.UITest.Shared.Android.ApkFile.GetFileBytes(String fileName)

The last line I can get to when debugging is this:

app = ConfigureApp.Android.Debug().ApkFile(appPath).StartApp(mode); where I have checked that it's the correct path to the apk and "mode" is AppDataMode.Clear.

I have tried changing any options i can find, like project properties or visual studio and windows settings. Everything is up to date and I tried every combination of clean/build/restart visual studio. I have looked at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage and not found anything that differs from the working machines. While searching I haven't found anything that gets me closer to a solution. This error doesn't seem common. OEMCP (original equipment manufacturer code page) is set to 437 in the registry but logging TextInfo.OEMCodePage in the code gives me "1", which is what the description of the error is. Maybe that helps.

Thread.CurrentThread.CurrentCulture.TextInfo.OEMCodePage == 1

The next step for me would be reinstalling visual studio or windows.

Upvotes: 5

Views: 1532

Answers (2)

panuv
panuv

Reputation: 31

On code level, you can call

Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;

e.g. in the beginning of AppInitializer.StartApp(). Then you don't need to modify your Windows settings to be able to run the tests.

Upvotes: 1

Egbert
Egbert

Reputation: 66

Had the same problem. Setting the default windows language to English (United States) somehow fixed it.

Upvotes: 5

Related Questions