DevServer host candidates ignore the platform on Skia: Android emulator never gets 10.0.2.2
Current behavior
RemoteControlClient.GetDevServerHostCandidates() picks the high-priority dev server addresses with #if __WASM__ / #elif __IOS__ || __TVOS__ / #elif __ANDROID__ / #else. With the Skia renderer these platform branches never run:
- On 6.x, a Skia head gets
Uno.UI.RemoteControlfromuno-runtime/<tfm>/skia.RuntimeAssetsSelectorTaskonly takes the WinRT assemblies from the platform build, and the Skia build is compiled without__ANDROID__/__IOS__/__TVOS__. - On master (7.0), the project only builds for plain
net10.0;net11.0, so no configuration compiles these branches.
As a result, every Skia app, Android emulator included, gets the desktop list ["127.0.0.1", "[::1]"]. The Android emulator never gets 10.0.2.2 (the host-machine alias). Physical iOS/tvOS devices get loopback candidates they can't use. These have been dead for Skia apps since the host candidates were added.
Expected behavior
- Android emulator:
10.0.2.2,127.0.0.1 - iOS/tvOS simulator: loopback
- Physical devices: no loopback candidates
- Browser and desktop: loopback
These should apply to Skia apps too.
How to reproduce it (as minimally and precisely as possible)
- Build
src/Uno.UI.RemoteControland inspectDefineConstants: none of__ANDROID__,__IOS__,__TVOS__,__WASM__is defined. - On 6.7, check which
Uno.UI.RemoteControl.dlla Skia Android head copies locally: it's theuno-runtime/<tfm>/skiaone. - Run a Skia Android app on an emulator without
adb reverseand watch the DevServer connection order:10.0.2.2is never tried first.
Workaround ️
Use adb reverse tcp:<port> tcp:<port> so 127.0.0.1 reaches the dev server. The client also still tries the other advertised host addresses, so this is mostly slower first-connection latency, not a hard failure.
Renderer
- Skia
- Native
Affected platforms ️
Android, iOS
Uno.Sdk version (and other relevant versions)
6.7 (release/stable/6.7) and master (7.0)
IDE version
No response
Anything else we need to know?
#24554 (7.0) replaces the #ifs with OperatingSystem runtime checks and a pure GetDevServerHostCandidates(...) that is unit-tested. Its new IsAndroidEmulator() can't use Android.OS.Build from a plain net10.0 assembly, so it probes the filesystem instead. From reading the code, that probe looks unreliable:
File.Exists("/dev/goldfish_pipe" | "/dev/qemu_pipe")is likely denied silently by SELinux for normal apps (Android 8+).ro.kernel.qemuandro.hardwareare set at boot and aren't in/system/build.prop, so that scan probably never matches.
Suggestions:
- Read the real properties via
__system_property_get(P/Invoke to libc). - Or move emulator/simulator detection behind an
ApiExtensibilityhook in the Skia Android/AppleUIKit runtimes. - Either way, fall back to
127.0.0.1when detection misses, so a miss is no worse than today.
Nobody has checked this on an emulator yet.
Source: unoplatform/uno