1

Closed

Syncronization with Decimal Bug

description

Hello,
I use your framework to Synchronize my application Android with my database SQL SERVER 2008 and today i noticed a problem when i synchronize a row where there is a column with a number decimal. Of SQL server 2008 to sqlite everything works (it gets back the decimal fields) but in the other direction, impossible : the server give the error HTTP 500 error internal server.
I seek since two days unsuccessfully.
I give you the logerror with a decimal and a logOK with an integer.
Details configuration:
Android 4.0.3
MSSQL10_50
Microsoft Sync Framework ADO.NET v3.1
Thank you for your help.

file attachments

Closed Jan 25, 2013 at 1:22 PM by Selvin
actually this is not bug in my code ...

comments

Selvin wrote Jan 24, 2013 at 12:52 AM

how did you define this column on device and sqlserver ? i mean, what is the type of this column ?

flounn wrote Jan 24, 2013 at 9:49 AM

On the device the column is numeric: Database.class:
@Column(type = ColumnType.numeric, nullable = true)
public static final String CHA_SURFACE = "CHA_SURFACE";

and on sqlserver the column is numeric(18,2): scope_config:
<Col name="CHA_SURFACE" type="decimal" prec="18" scale="2" null="true" param="@P_10"/>

i give you screens for confirm that.

Selvin wrote Jan 24, 2013 at 2:01 PM

change
Log.e(TAG, "Server error in fetching remote contacts: "
                                + response.getStatusLine());
to:
Log.e(TAG, "Server error in fetching remote contacts: "
                                + response.getStatusLine() + " " + EntityUtils.toString(response));
then you should see the exact server error ... without this i'm not able to help you ...


OR use Fiddler2 to send request ({"d":{"__sync": .... rest goes here....}}) to your endpoint and check if it return the same error

flounn wrote Jan 24, 2013 at 3:32 PM

I attach the logCat with the error's details.

Selvin wrote Jan 25, 2013 at 1:21 PM

actually it's a bug in MSFT ... they forget that we (non english EU) using commas as decimal separator ...
so if server has setted ours locale/culture, System.Number.ParseDecimal expects comma not dot ...
you need to change:
return Convert.ChangeType(value, type, null);
to:
return Convert.ChangeType(value, type, CultureInfo.InvariantCulture);
in ReflectionUtility.cs file and recompile Microsoft.Synchronization.Services.dll