Bug 13754 - WebClient results broken
Summary: WebClient results broken
Status: RESOLVED FEATURE
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: 6.4.0
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: Untriaged
Assignee: Vinicius Jarina
URL:
: 13756 ()
Depends on:
Blocks:
 
Reported: 2013-08-05 11:48 UTC by Dylan
Modified: 2013-08-06 11:49 UTC (History)
5 users (show)

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


Attachments
Example project (477.39 KB, application/octet-stream)
2013-08-05 11:48 UTC, Dylan
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 FEATURE

Description Dylan 2013-08-05 11:48:51 UTC
Created attachment 4538 [details]
Example project

In my solution I am calling some Google web services that returns my reverse geolocation (JSON) as well as a static map (byte []). This worked 100% prior to the upgrade to the Mono Framework 3.2.0 in both iOS and Android. However, now when running the same code on the newer version the reverse geolocation does not return the correct results and the map data is definitely wrong (mostly shows a blue image). I suspect that the request made is not correct? The coordinates returned from the geolocation call are correct and when manually pasting the URL in a browser the results are perfect.

I have tried using System.Net.Http to replace WebClient only to have the same output. The code works perfectly in the simulator. The exact code does not work on the Android platform either. 

This is a pretty critical problem as now my apps do not work with the new versions of Xamarin.iOS. No code has changed on my side to cause these issues. 

Please see the attached iPhone example project and screenshot. I am going to log this issue again for Android with the relevant sample code.
Comment 1 Rolf Bjarne Kvinge [MSFT] 2013-08-05 12:03:28 UTC
Marek, can you have a look at this?
Comment 2 Chris Hardy [MSFT] 2013-08-06 10:16:53 UTC
Dylan,

This works as expected to me, is it possible to provide an example of this not working as a screenshot so we can confirm that this is not working for you and also provide your Xamarin information from Xamarin -> Xamarin Studio -> About Xamarin Studio -> Show Details -> Copy Information

ChrisNTR
Comment 3 Dylan 2013-08-06 10:17:43 UTC
=== Xamarin Studio ===

Version 4.0.10 (build 7)
Installation UUID: ad159810-1470-4877-b190-a24e54e7a7eb
Runtime:
	Mono 3.2.0 ((no/7c7fcc7)
	GTK 2.24.20
	GTK# (2.12.0.0)
	Package version: 302000000

=== Apple Developer Tools ===

Xcode 4.6.2 (2067.2)
Build 4H1003

=== Xamarin.Mac ===

Xamarin.Mac: Not Installed

=== Xamarin.iOS ===

Version: 6.4.1.1 (Business Edition)
Hash: 5a0fe54
Branch: 
Build date: 2013-30-07 08:24:03-0400

=== Xamarin.Android ===

Not Installed

=== Build Information ===

Release ID: 400100007
Git revision: f324e2154ee86ae1b6b8483392eddbf418e6381b
Build date: 2013-07-20 06:23:58+0000
Xamarin addins: fe4f180e2386eafc00087ef68c3a580cff4a2592

=== Operating System ===

Mac OS X 10.8.4
Darwin Dylans-Mac.local 12.4.0 Darwin Kernel Version 12.4.0
    Wed May  1 17:57:12 PDT 2013
    root:xnu-2050.24.15~1/RELEASE_X86_64 x86_64
Comment 4 Dylan 2013-08-06 10:18:20 UTC
Screenshot and sample solution provided in attachment.
Comment 5 Chris Hardy [MSFT] 2013-08-06 10:18:54 UTC
I noticed you added a screenshot already, I'm not seeing this behaviour, is it possible to use something like Charles[1] to compare the web requests being made, are you sure the results from your location service are correct?

[1] http://www.charlesproxy.com/
Comment 6 Chris Hardy [MSFT] 2013-08-06 11:29:31 UTC
So looking into this further, it seems that when you're on a Afrikaans Regional setting, a URI constructor will convert . dot values to , commas, so a URL like:

http://maps.googleapis.com/maps/api/geocode/json?latlng=53.4848503584129,-2.23727740302962&sensor=true

would end up being 

http://maps.googleapis.com/maps/api/geocode/json?latlng=53,4848503584129,-2,23727740302962&sensor=true
Comment 7 Miguel de Icaza [MSFT] 2013-08-06 11:30:59 UTC
Vinicius,

Would you mind reviewing this change?
Comment 8 Miguel de Icaza [MSFT] 2013-08-06 11:31:10 UTC
Potentially related to this:

https://github.com/mono/mono/commit/ee352cde7568af8bf6ecca59b3b427dcb7916797
Comment 9 Chris Hardy [MSFT] 2013-08-06 11:33:46 UTC
*** Bug 13756 has been marked as a duplicate of this bug. ***
Comment 10 Marek Safar 2013-08-06 11:49:13 UTC
It's actually issue in your core. Code like

            Uri address = new Uri("http://maps.googleapis.com/maps/api/geocode/json?latlng=" + latitude + "," + longitude + "&sensor=true");

will use current culture to construct the url, it does something like latitute.ToString () which is most likely not what you want. One possible fix is to do latitude.ToString (CultureInfo.InvariantCulture) or write correct custom formatting according to what Google API expects.

We fixed many of our culture info tables which is probably the reason why upgrade exposed issue in your code.