Bug 29346 - Mono WCF client data corruption using binaryMessageEncoding
Summary: Mono WCF client data corruption using binaryMessageEncoding
Status: RESOLVED FIXED
Alias: None
Product: Android
Classification: Xamarin
Component: BCL Class Libraries ()
Version: 5.2
Hardware: Other Other
: Normal normal
Target Milestone: ---
Assignee: Atsushi Eno
URL:
Depends on:
Blocks:
 
Reported: 2015-04-23 13:14 UTC by jaguiar
Modified: 2015-11-16 01:02 UTC (History)
3 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
3 sample projects to reproduce problem. (46.05 KB, application/octet-stream)
2015-04-23 13:14 UTC, jaguiar
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description jaguiar 2015-04-23 13:14:14 UTC
Created attachment 10881 [details]
3 sample projects to reproduce problem.

The problem is simpler to explain with a repro. It is attached.

Using Xamarin for Visual Studio 3.9.547 (latest version, at the time of writing).
Calling a WCF service, created with Visual Studio on .NET framework 4.5 and running on IIS.
The service contract is very simple:

int GetNextNumber()

It simply returns 0 in the first call, -1 in the next, -2 in the next, and so on.

Whenever the WCF endpoint binding is configured to use binary message encoding, and the returned number is negative, Xamarin.Android will receive a corrupt result: (-1) becomes 255, (-2) becomes 254, and so on. 

When using basic HTTP binding, it works fine. Looks like some kind of deserialization issue.

Standard Microsoft .NET works fine either with or without binary message encoding.

This is probably a duplication of bug #18578, only it applies to 'int' instead of float, and the only way I could submit a repro as an attachment was to file a new bug.

Repro includes 3 projects: the WCF service, the Android client and a Windows Console Application client, which I used to compare MS .NET results with Mono for Android results.

Regards
Jorge
Comment 1 Atsushi Eno 2015-05-28 04:42:30 UTC
It is most likely fixed in the next version that will be based on mono 4.20 because our System.Runtime.Serialization switched to MS referencesource. Our System.ServiceModel cannot switch yet, so old code may still bite.