Describe the bug
On Android, DevTools shows only App in the Elements tree when the app sets
IActivityApplicationLifetime.MainViewFactory, which is the path Avalonia 12 recommends and the one the
avalonia.xplat template generates. The TopLevel and every control are missing. This happens in the
DevTools window and through the DevTools MCP, where tree and search return []. Neither side logs an
error, the app is connected, App's properties are shown, and messages flow.
As far as we can read the 2.2.3 assembly, DiagnosticsSupport has top-level groups for
IClassicDesktopStyleApplicationLifetime, ISingleViewApplicationLifetime,
ISingleTopLevelApplicationLifetime and design time, but none for IActivityApplicationLifetime.
Android's ApplicationLifetime implements both IActivityApplicationLifetime and
ISingleViewApplicationLifetime. With only MainViewFactory set, ISingleViewApplicationLifetime.MainView
is null, so there is no root to show.
Workaround: set ISingleViewApplicationLifetime.MainView instead, which Android's lifetime turns
into the factory. The tree then shows EmbeddableControlRoot → PageNavigationHost → the app's view,
and every MCP tool works. It costs the warning "ISingleViewApplicationLifetime.MainView is not fully
supported on Android", so it isn't something to ship.
Ask: support IActivityApplicationLifetime roots in DiagnosticsSupport, so the recommended Android
path works with DevTools.
To Reproduce
dotnet new avalonia.xplat -page TabbedPage -av 12.1.4, and keep the Android head.
- Leave the template's
App.OnFrameworkInitializationCompleted as generated: it sets
IActivityApplicationLifetime.MainViewFactory on Android.
- Add
.WithDeveloperTools() to the Android head's AppBuilder. Allow cleartext to the DevTools host in
network_security_config.xml. On an emulator, adb reverse tcp:29414 tcp:29414 and connect to
127.0.0.1.
- Start the DevTools window, run the app, and open Elements: only
App.
- Change step 2 to set
ISingleViewApplicationLifetime.MainView instead, run again, and the full tree
appears.
Product(s)
DevTools
Platform
Android
License Tier
Trial
Avalonia version
12.1.4 (Avalonia.Android 12.1.4)
Tool/Control Version
AvaloniaUI.DeveloperTools 2.2.3, AvaloniaUI.DiagnosticsSupport 2.2.3; .NET 11.0.100-rc.1
(net11.0-android), Android 16 emulator (API 36, x86_64), Kubuntu host
Relevant log output
DevTools MCP, the app attached:
attach-to-app → {"connectedClient":{"runningPlatform":"android", ... "frameworkVersion":"12.1.4.0"}}
tree → []
search → []
After setting ISingleViewApplicationLifetime.MainView:
tree → [{"typeName":"EmbeddableControlRoot","children":[{"typeName":"TopLevelHost"},
{"typeName":"PageNavigationHost","children":[{"typeName":"MainView", ...}]}]}]
Describe the bug
On Android, DevTools shows only
Appin the Elements tree when the app setsIActivityApplicationLifetime.MainViewFactory, which is the path Avalonia 12 recommends and the one theavalonia.xplattemplate generates. The TopLevel and every control are missing. This happens in theDevTools window and through the DevTools MCP, where
treeandsearchreturn[]. Neither side logs anerror, the app is connected,
App's properties are shown, and messages flow.As far as we can read the 2.2.3 assembly, DiagnosticsSupport has top-level groups for
IClassicDesktopStyleApplicationLifetime,ISingleViewApplicationLifetime,ISingleTopLevelApplicationLifetimeand design time, but none forIActivityApplicationLifetime.Android's
ApplicationLifetimeimplements bothIActivityApplicationLifetimeandISingleViewApplicationLifetime. With onlyMainViewFactoryset,ISingleViewApplicationLifetime.MainViewis null, so there is no root to show.
Workaround: set
ISingleViewApplicationLifetime.MainViewinstead, which Android's lifetime turnsinto the factory. The tree then shows
EmbeddableControlRoot→PageNavigationHost→ the app's view,and every MCP tool works. It costs the warning "ISingleViewApplicationLifetime.MainView is not fully
supported on Android", so it isn't something to ship.
Ask: support
IActivityApplicationLifetimeroots in DiagnosticsSupport, so the recommended Androidpath works with DevTools.
To Reproduce
dotnet new avalonia.xplat -page TabbedPage -av 12.1.4, and keep the Android head.App.OnFrameworkInitializationCompletedas generated: it setsIActivityApplicationLifetime.MainViewFactoryon Android..WithDeveloperTools()to the Android head'sAppBuilder. Allow cleartext to the DevTools host innetwork_security_config.xml. On an emulator,adb reverse tcp:29414 tcp:29414and connect to127.0.0.1.App.ISingleViewApplicationLifetime.MainViewinstead, run again, and the full treeappears.
Product(s)
DevTools
Platform
Android
License Tier
Trial
Avalonia version
12.1.4 (Avalonia.Android 12.1.4)
Tool/Control Version
AvaloniaUI.DeveloperTools 2.2.3, AvaloniaUI.DiagnosticsSupport 2.2.3; .NET 11.0.100-rc.1
(
net11.0-android), Android 16 emulator (API 36, x86_64), Kubuntu hostRelevant log output