Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default Android OS proxy is ignored #3058

Closed
sdebruyn opened this issue May 2, 2019 · 6 comments · Fixed by #3060
Closed

Default Android OS proxy is ignored #3058

sdebruyn opened this issue May 2, 2019 · 6 comments · Fixed by #3060
Assignees
Labels
Area: App Runtime Issues in `libmonodroid.so`.

Comments

@sdebruyn
Copy link
Contributor

sdebruyn commented May 2, 2019

Steps to Reproduce

  1. Make sure HTTP client handler is set to native client handler (which is the default now)
  2. Instantiate an HttpClient and perform an HTTP request

Repro project: https://github.com/3factr/xamarin-android-proxy-issue
Workaround: workaround branch

Expected Behavior

The request goes through the system OS defined proxy.

Actual Behavior

The request ignores the proxy.

Temporary workaround

You can define a proxy yourself on the AndroidClientHandler. This proxy is then correctly used. This is not feasible for us. We use Charles to intercept HTTP traffic after the app is built and this is no longer possible.

Version Information

The issue did not occur in Xamarin.Android 8.

=== Visual Studio Enterprise 2019 for Mac ===

Version 8.0.5 (build 9)
Installation UUID: e1324239-09f8-4ef0-841d-818a176fdfbd
	GTK+ 2.24.23 (Raleigh theme)
	Xamarin.Mac 5.6.0.2 (d16-0 / 040682909)

	Package version: 518010003

=== Mono Framework MDK ===

Runtime:
	Mono 5.18.1.3 (2018-08/fdb26b0a445) (64-bit)
	Package version: 518010003

=== NuGet ===

Version: 4.8.2.5835

=== .NET Core ===

Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
	2.2.0
	2.1.2
	2.1.1
	2.1.0
	2.0.7
	2.0.5
SDK: /usr/local/share/dotnet/sdk/2.2.100/Sdks
SDK Versions:
	2.2.100
	2.1.302
	2.1.301
	2.1.300
	2.1.200
	2.1.4
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.18.1/lib/mono/msbuild/15.0/bin/Sdks

=== Xamarin.Profiler ===

Version: 1.6.9
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Updater ===

Version: 11

=== Xamarin.Android ===

Version: 9.2.3.0 (Visual Studio Enterprise)
Android SDK: /Users/sam/Library/Android/sdk
	Supported Android versions:
		5.0 (API level 21)
		6.0 (API level 23)
		7.0 (API level 24)
		7.1 (API level 25)
		8.0 (API level 26)
		8.1 (API level 27)

SDK Tools Version: 26.1.1
SDK Platform Tools Version: 28.0.2
SDK Build Tools Version: 29.0.0 rc2

Build Information: 
Mono: mono/mono/2018-08-rc@5ac37ccd385
Java.Interop: xamarin/java.interop/d16-0@c987483
LibZipSharp: grendello/LibZipSharp/d16-1@44de300
LibZip: nih-at/libzip/rel-1-5-1@b95cf3f
MXE: xamarin/mxe/xamarin@b9cbb535
ProGuard: xamarin/proguard/master@905836d
SQLite: xamarin/sqlite/3.26.0@325e91a
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-0@0a7edd6

=== Microsoft Mobile OpenJDK ===

Java SDK: /Users/sam/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_8.0.25
1.8.0-25
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Android Device Manager ===

Version: 1.2.0.14
Hash: 86df26f
Branch: remotes/origin/d16-0
Build date: 2019-04-05 16:58:56 UTC

=== Apple Developer Tools ===

Xcode 10.2.1 (14490.122)
Build 10E1001

=== Xamarin.Mac ===

Version: 5.8.0.0 (Visual Studio Enterprise)
Hash: 0aa84521
Branch: d16-0
Build date: 2019-04-02 16:01:19-0400

=== Xamarin.iOS ===

Version: 12.8.0.0 (Visual Studio Enterprise)
Hash: 0aa84521
Branch: d16-0
Build date: 2019-04-02 16:01:19-0400

=== Xamarin Designer ===

Version: 4.17.4.418
Hash: 3d086e814
Branch: remotes/origin/d16-0
Build date: 2019-04-01 09:20:10 UTC

=== Xamarin Inspector ===

Version: 1.4.3
Hash: db27525
Branch: 1.4-release
Build date: Mon, 09 Jul 2018 21:20:18 GMT
Client compatibility: 1

=== Build Information ===

Release ID: 800050009
Git revision: d9d7eed60cb59740ba55c04bfe9c39ac57014c12
Build date: 2019-04-26 10:08:19+00
Build branch: master
Xamarin extensions: 5efedb990d786142d3b54351c01ce867af7b7680

=== Operating System ===

Mac OS X 10.14.4
Darwin 18.5.0 Darwin Kernel Version 18.5.0
    Mon Mar 11 20:40:32 PDT 2019
    root:xnu-4903.251.3~3/RELEASE_X86_64 x86_64

=== Enabled user installed extensions ===

NuGet Package Explorer 0.3.1
NuGet Package Management Extensions 0.17


Log File

N/A

@sdebruyn
Copy link
Contributor Author

sdebruyn commented May 2, 2019

The cause of this issue is at https://github.com/xamarin/xamarin-android/blob/756117040ef85fd7d6c9ae5c7afe218da6cae734/src/Mono.Android/Xamarin.Android.Net/AndroidClientHandler.cs#L263 and changed with bf07044

Proxy in GetJavaProxy is null so the goto done; is executed and Java.Net.Proxy.NoProxy is returned. According to the documentation, this indicates that no proxy should be used. This also overrides the system proxy.

@sdebruyn
Copy link
Contributor Author

sdebruyn commented May 2, 2019

For future reference: UseProxy in that line is true by default (the default is set in the Mono source)

@sdebruyn
Copy link
Contributor Author

sdebruyn commented May 2, 2019

The solution here would be to not return NoProxy but to just leave the parameter out like it was before. PR incoming...

@jonathanpeppers
Copy link
Member

@grendello when you have a chance to take a look, @SamuelDeBruyn sent a PR for this one.

@deyupopp
Copy link

Is there any way to backport this in Xamarin.Android 9.3 or 9.4? Our QA team depends on proxy to test different scenarios, and we cannot use 9.1 because of this: https://developercommunity.visualstudio.com/content/problem/399276/missing-method-bindings-in-androidhardwarebiometri.html

@brendanzagaeski
Copy link
Contributor

Release status update for the candidate fix

A new Release version has now been published that includes the fix for this item.

Fix included in Xamarin.Android 10.0.0.43

Fix included on Windows in Visual Studio 2019 version 16.3. To get the new version that includes the fix, check for the latest updates or install the latest version from https://visualstudio.microsoft.com/downloads/.

Fix included on macOS in Visual Studio 2019 for Mac version 8.3. To get the new version that includes the fix, check for the latest updates on the Stable updater channel.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Area: App Runtime Issues in `libmonodroid.so`.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants