Skip to content

Android Emulator fails to connect debugger when VPN is running on PC AND on the Emulator via Extended Controls Panel  #7426

@hjharvey-MSFT

Description

@hjharvey-MSFT

Android application type

Classic Xamarin.Android (MonoAndroid12.0, etc.), Android for .NET (net6.0-android, etc.)

Affected platform version

VS 2022 17.3.4

Description

Debugger fails to attach to Android Emulator when running and launching form visual studio IF a VPN has been setup VIA the Android Emulator Extended Controls Panel and a VPN is running on the PC.

The following errors are observed on visual Studio and LogCat. The project will deploy and run correctly, but cannot be debugged.

Visual Studio
[dex.webauth.ap] Attempt to remove non-JNI local reference, dumping thread
[monodroid-debug] Trying to initialize the debugger with options: --debugger-agent=transport=dt_socket,loglevel=0,address=10.0.2.2:59559,embedding=1
[mono] debugger-agent: DWP handshake failed.

LogCat
08-12 12:34:11.785 6199 6199 W monodroid-debug: Trying to initialize the debugger with options: --debugger-agent=transport=dt_socket,loglevel=0,address=10.0.2.2:59559,embedding=1
08-12 12:34:12.086 6199 6199 E mono : debugger-agent: DWP handshake failed.
08-12 12:34:12.113 293 293 I Zygote : Process 6199 exited cleanly (1)

If a PC has an active VPN that allows access to Internal Intranet, then the VPN must be setup on the Emulator to allow access to both internal and external addresses.

Current workaround is to use the Internal OS level Android VPN to allow access.

  • Connect to VPN on the PC
  • Start the emulator image
  • Within the OS running within the emulator, go into the settings for "AndroidWiFi" and set the auto-proxy there

We have tried:

  • using Additional Emulator Launch Arguments
  • Setting http_proxy environment variable
  • setting http_proxy adb variable

Steps to Reproduce

Run restricted VPN on a PC (Requires access to Intranet resources that you cant reach without VPN)
Setup VPN on the Android Emulator using the Extended Controls Panel

Verify that the Emulator has access to the internet sites.

Run and Deploy/debug an Android Project onto the android Emulator.
See failure.

Did you find any workaround?

Setup VPN Via the Emulator OS
Within the OS running within the emulator, go into the settings for "AndroidWiFi" and set the auto-proxy ther

Relevant log output

Visual Studio
[dex.webauth.ap] Attempt to remove non-JNI local reference, dumping thread
[monodroid-debug] Trying to initialize the debugger with options: --debugger-agent=transport=dt_socket,loglevel=0,address=10.0.2.2:59559,embedding=1
[mono] debugger-agent: DWP handshake failed.

LogCat
08-12 12:34:11.785  6199  6199 W monodroid-debug: Trying to initialize the debugger with options: --debugger-agent=transport=dt_socket,loglevel=0,address=10.0.2.2:59559,embedding=1
08-12 12:34:12.086  6199  6199 E mono    : debugger-agent: DWP handshake failed.
08-12 12:34:12.113   293   293 I Zygote  : Process 6199 exited cleanly (1)

Metadata

Metadata

Assignees

Labels

Area: DebuggerIssues using or interacting with the debugger.mobcat

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions