Problem
AdbRunner.GetEmulatorAvdNameAsync() uses adb -s <serial> emu avd name to resolve the AVD name of a running emulator. On ADB v36.0.0, this command returns empty output (exit code 0) — causing MergeDevicesAndEmulators() to fail deduplication, resulting in duplicate device entries (one running without AVD name + one "Not Running" from emulator -list-avds).
Root Cause
adb emu avd name returns empty on adb v36.0.0:
$ adb -s emulator-5554 emu avd name
(empty output, exit code 0)
But the correct name is available via shell property:
$ adb -s emulator-5554 shell getprop ro.boot.qemu.avd_name
MAUI_Emulator_API_36
Proposed Fix
In GetEmulatorAvdNameAsync(), add a fallback:
- Try
adb emu avd name (existing behavior)
- If result is null/empty, try
adb shell getprop ro.boot.qemu.avd_name
- Return the first non-empty result
Impact
This is a pre-existing bug on main — confirmed by testing dotnet run on dotnet/android main branch with an emulator running: same duplicate listing occurs. Not caused by the EmulatorRunner feature branch.
The same fix is also needed in dotnet/android's GetAvailableAndroidDevices.GetEmulatorAvdName() which has identical logic.
Problem
AdbRunner.GetEmulatorAvdNameAsync()usesadb -s <serial> emu avd nameto resolve the AVD name of a running emulator. On ADB v36.0.0, this command returns empty output (exit code 0) — causingMergeDevicesAndEmulators()to fail deduplication, resulting in duplicate device entries (one running without AVD name + one "Not Running" fromemulator -list-avds).Root Cause
adb emu avd namereturns empty on adb v36.0.0:But the correct name is available via shell property:
Proposed Fix
In
GetEmulatorAvdNameAsync(), add a fallback:adb emu avd name(existing behavior)adb shell getprop ro.boot.qemu.avd_nameImpact
This is a pre-existing bug on main — confirmed by testing
dotnet runon dotnet/android main branch with an emulator running: same duplicate listing occurs. Not caused by the EmulatorRunner feature branch.The same fix is also needed in
dotnet/android'sGetAvailableAndroidDevices.GetEmulatorAvdName()which has identical logic.