Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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.
Created attachment 7874 [details]
HTML response generated by the proxy
I recently upgraded my app from Xamarion.iOS 126.96.36.199 to 188.8.131.52, and several users wrote to me and complained that the app could no longer communicate with its server.
After investigating, I found all of these users were behind a proxy of some sort. One user said he was behind a WAN optimization device called CloudBridge, and he verified that if he bypassed the proxy the app started working again. Just so this is clear, the app fails 100% of the time with the proxy in place, and succeeds 100% of the time with no proxy.
He also verified that the app worked under 184.108.40.206 through the proxy, so it really seems like something in Xamarion.iOS changed that the proxy doesn't like.
The app simply does a call to WebClient.DownloadDataAsync() -- there isn't anything special about it. It just uploads a byte array via POST and downloads the resulting byte array.
The HTTP request never reaches the remote server, since the user's local proxy rejects it. The exception returned to the app is:
System.Net.WebException: The remote server returned an error: (417) Expectation failed.
at System.Net.HttpWebRequest.CheckFinalStatus (System.Net.WebAsyncResult result) [0x00000] in <filename unknown>:0
at System.Net.HttpWebRequest.SetResponseData (System.Net.WebConnectionData data) [0x00000] in <filename unknown>:0
Reading the response stream from the WebException reveals the text the proxy is sending down, which is attached.
Obviously, I can't provide a repro project since I don't have a proxy that's causing this error, and I assume you won't either. Can you tell me everything that's changed in the networking stack that could explain this error? Looking at the binaries, I see some changes related to proxies between these versions of Xamarin.iOS, so I suspect one of these changes caused this problem.
There has been a lof of HTTP related fixes in recent 7.2.x releases.
@Martin does this ring any bell ?
Well, first we need to figure out whether it's the proxy generating this error or the remote server.
If the request really does not reach the remote server, then either there's a bug in the new networking stack. Does this happen with all proxy servers or just with some of them?
If you don't have access to these proxy servers, would it be possible to somehow get a networking trace of the data that's sent to that proxy? It would be very helpful to see the actual HTTP request that's being sent.
As I mentioned in the initial bug report, the error is being generated by the proxy server, and the HTTP request never reaches the remote server.
Unfortunately I don't have a proxy server that causes this issue myself, so I'm not able to run a networking trace. Is there any code that I can put into my app that would capture what you need?
Well, since this previously worked for you, we should figure out what changed.
Could you try getting a network trace with a different proxy server - just any proxy server, even if it does not trigger the problem - with both the old and the new version? We could then look at the difference and figure out whether anything changed that may cause their proxy server to not like the request anymore.
Unfortunately I don't have any proxies available or experience running network traces. If you want to walk me through it I can help, but it's probably something you could just as easily do yourself.
Since Xamarin.iOS is closed source, I have no way of knowing what http changes were made, so I can't even begin to debug the issue from my end. Can these changes just be rolled back, or expose a flag where we can disable them? Or is there any other work-around we can use?
Closing ancient bugs, please reopen if you're still having this problem.