I am working on an application in Xamarin
for Visual Studio 2017
. I am attempting to test my application on Android
and iOS
live player devices.
When I try to run it, I get the following error on my device (Android
and iOS
):
Level=Error, Title=Visualization Error, Message=Encoding 1252 data could not be found. Make sure you have correct international codeset assembly installed and enabled. (NotSupportedException)
I have found similar issues through Google
searching, but after making the changes, it still will not run. I have checked all Internationalization options for both devices, and I have even saved directly as UTF-8
encoding, as I figured it may be an issue with encoding windows-1252
. I also referenced the I18N.dll
to the I18N.West.dll
for both.
Any help would be greatly appreciated. Thank you.
Update:
I have been able to narrow down the issue further.
using (SqlConnection sqlConn = new
SqlConnection(Configuration.ConnectionString))
{
//sqlConn.Open();
}
The .open
was causing the encoding error. After commenting it out, the app will run on the live device, however, I now get:
Level=Error, Title=Uncaught Exception, Message=Encoding 1252 data could not be found. Make sure you have correct international codeset assembly installed and enabled. (NotSupportedException)
And Visual Studio 2017
throws the following error
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
at
using (SqlConnection sqlConn = new
SqlConnection(Configuration.ConnectionString))
It occurs the moment it tries to pull from the database at the using
statement above. I am using SQL Server 2008 R2
. All I can tell is that it is having an issue with sending to and receiving from the SQL Server with Android
and iOS
.
Update 2:
After using some Exception Handlers
, I boiled it down to this inner exception:
{System.NotSupportedException: Encoding 1252 data could not be found. Make sure you have correct international codeset assembly installed and enabled. at System.Text.Encoding.GetEncoding (System.Int32 codepage) [0x0023f] in <896ad1d315ca4ba7b117efb8dacaedcf>:0 at Mono.Data.Tds.TdsCharset.GetEncodingFromSortOrder (System.Int32 sortId) [0x00022] in :0 at Mono.Data.Tds.TdsCharset.GetEncodingFromSortOrder (System.Byte[] collation) [0x00006] in :0 at Mono.Data.Tds.TdsCharset.GetEncoding (System.Byte[] collation) [0x00008] in :0 at Mono.Data.Tds.Protocol.Tds.ProcessEnvironmentChange () [0x00229] in :0 at Mono.Data.Tds.Protocol.Tds.ProcessSubPacket () [0x00129] in :0 at Mono.Data.Tds.Protocol.Tds.NextResult () [0x00039] in :0 at Mono.Data.Tds.Protocol.Tds.SkipToEnd () [0x00000] in :0 at Mono.Data.Tds.Protocol.Tds70.Connect (Mono.Data.Tds.Protocol.TdsConnectionParameters connectionParameters) [0x0058e] in :0 at Mono.Data.Tds.Protocol.Tds80.Connect (Mono.Data.Tds.Protocol.TdsConnectionParameters connectionParameters) [0x00000] in :0 at System.Data.SqlClient.SqlConnection.Open () [0x00245] in <868a6461786e4884ac572c5e90a6b7fd>:0 at System.Data.Common.DbDataAdapter.QuietOpen (System.Data.IDbConnection connection, System.Data.ConnectionState& originalState) [0x0000c] in <868a6461786e4884ac572c5e90a6b7fd>:0 at System.Data.Common.DbDataAdapter.FillInternal (System.Data.DataSet dataset, System.Data.DataTable[] datatables, System.Int32 startRecord, System.Int32 maxRecords, System.String srcTable, System.Data.IDbCommand command, System.Data.CommandBehavior behavior) [0x0002d] in <868a6461786e4884ac572c5e90a6b7fd>:0 at System.Data.Common.DbDataAdapter.Fill (System.Data.DataSet dataSet, System.Int32 startRecord, System.Int32 maxRecords, System.String srcTable, System.Data.IDbCommand command, System.Data.CommandBehavior behavior) [0x00069] in <868a6461786e4884ac572c5e90a6b7fd>:0 at System.Data.Common.DbDataAdapter.Fill (System.Data.DataSet dataSet) [0x00029] in <868a6461786e4884ac572c5e90a6b7fd>:0 at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&) at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in <896ad1d315ca4ba7b117efb8dacaedcf>:0 }
Which occurs at:
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(ds);
From the "iOS Build" Project Options page in Visual Studio for Mac you should check "west" checkbox. Same for Android properties.
In the the Android project, go to Properties -> Android Options
Then Linker Options, in the "Additional supported encodings" check "West".
For VS2019, on windows : Check : 'Additional Supported Encodings'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With