Summary
With the recommended unoapp template, Uno.UI.RemoteControl.RemoteControlClient Trace/Debug logs emitted during early app startup (the DevServer connection attempts: Connecting to [ws://…], OnRemoteControlClientAvailable, etc.) are never captured, even with a correct filter (SetMinimumLevel(Trace) + AddFilter("Uno.UI", LogLevel.Trace)).
The same filter on the blank template captures them fine.
Root cause is timing/ordering, not filtering: the recommended template configures logging via IHostBuilder.UseLogging(...) inside App.OnLaunched (the host is built during MainWindow.InitializeNavigationAsync(...) => builder.Build()). That runs after the RemoteControl client has already started connecting and emitted its early logs. At that point Uno.Extensions.LogExtensionPoint.AmbientLoggerFactory is still unset, so those early records are dropped.
The blank template does not have the problem because it sets the ambient factory as the first line of Program.Main() (App.InitializeLogging()), before the Uno host runs.
Environment
- Uno.Sdk 6.7.16, Uno.Templates 6.7.16
- .NET SDK 10.0.111 (
net10.0)
- Reproduced on Desktop (Skia/X11). Originally reported on iOS. The ordering issue is platform-independent (only the required log provider differs per head:
AddDebug() on iOS to reach the VS Output window, AddConsole() on Desktop).
Repro
dotnet new install Uno.Templates::6.7.16
dotnet new unoapp -preset recommended -platforms desktop
- In
App.xaml.cs, inside .UseLogging(configure: (context, logBuilder) => { ... }):
logBuilder
.SetMinimumLevel(LogLevel.Trace)
.CoreLogLevel(LogLevel.Warning);
logBuilder.AddFilter("Uno.UI", LogLevel.Trace);
- Run the app.
Expected: Uno.UI.RemoteControl.RemoteControlClient connection traces appear (they are LogTrace/LogDebug).
Actual: they never appear. In fact no Uno.UI.RemoteControl.* category is logged at all.
Evidence
Category Uno.UI.RemoteControl.RemoteControlClient occurrences in captured output (same machine, same Uno.Sdk 6.7.16, Trace + Uno.UI filter applied in both):
| Template |
RemoteControlClient category lines |
blank (factory set in Main()) |
11 |
recommended (UseLogging in OnLaunched) |
0 |
First categories logged, in chronological order:
- blank:
Uno.UI.Hosting.UnoPlatformHostBuilder → …X11InputMethodDetector → Uno.UI.RemoteControl.RemoteControlClient (3rd — captured very early) → …
- recommended:
Uno.UI.Xaml.Core.VisualTree → BaseWindowImplementation → ActivationWrapper → … (RemoteControlClient never present — it already ran before the factory existed).
Higher-severity records from the same subsystem do show in recommended (e.g. LogError "DevServer isn't able to connect" from Uno.UI.HotDesign.Client.Logic.DevServer.RemoteControlService), which is what makes the problem confusing: users see some DevServer errors but never the early client traces — purely a level+timing artifact.
Note: uncommenting the template's logBuilder.HotReloadCoreLogLevel(LogLevel.Trace) group helper does not surface these logs either (still 0 lines) — the late-configuration timing dominates regardless of the filter used.
Proposed fix / discussion
The ambient ILoggerFactory should be established before the Uno host and its DevServer/RemoteControl client start, so early Trace/Debug records are not lost. Options:
- Establish
LogExtensionPoint.AmbientLoggerFactory (a lightweight bootstrap factory using the same UseLogging configuration) before host.Run() in the generated Program.cs, then hand off to the DI-built factory — instead of only wiring it inside OnLaunched.
- Or expose a documented early-logging hook in the recommended template so the DevServer client traces are captureable via the standard configuration.
Current workaround (set an early ambient factory in Program.Main, before building/running the Uno host — mirrors what the blank template does):
var earlyFactory = LoggerFactory.Create(b =>
{
b.AddDebug(); // iOS -> VS Output; use AddConsole() on Desktop
b.SetMinimumLevel(LogLevel.Trace);
b.AddFilter("Uno.UI", LogLevel.Trace);
});
global::Uno.Extensions.LogExtensionPoint.AmbientLoggerFactory = earlyFactory;
With this in place, the Uno.UI.RemoteControl.RemoteControlClient early traces are captured on the recommended template as well.
Summary
With the
recommendedunoapp template,Uno.UI.RemoteControl.RemoteControlClientTrace/Debug logs emitted during early app startup (the DevServer connection attempts:Connecting to [ws://…],OnRemoteControlClientAvailable, etc.) are never captured, even with a correct filter (SetMinimumLevel(Trace)+AddFilter("Uno.UI", LogLevel.Trace)).The same filter on the
blanktemplate captures them fine.Root cause is timing/ordering, not filtering: the recommended template configures logging via
IHostBuilder.UseLogging(...)insideApp.OnLaunched(the host is built duringMainWindow.InitializeNavigationAsync(...) => builder.Build()). That runs after the RemoteControl client has already started connecting and emitted its early logs. At that pointUno.Extensions.LogExtensionPoint.AmbientLoggerFactoryis still unset, so those early records are dropped.The
blanktemplate does not have the problem because it sets the ambient factory as the first line ofProgram.Main()(App.InitializeLogging()), before the Uno host runs.Environment
net10.0)AddDebug()on iOS to reach the VS Output window,AddConsole()on Desktop).Repro
dotnet new install Uno.Templates::6.7.16dotnet new unoapp -preset recommended -platforms desktopApp.xaml.cs, inside.UseLogging(configure: (context, logBuilder) => { ... }):Expected:
Uno.UI.RemoteControl.RemoteControlClientconnection traces appear (they areLogTrace/LogDebug).Actual: they never appear. In fact no
Uno.UI.RemoteControl.*category is logged at all.Evidence
Category
Uno.UI.RemoteControl.RemoteControlClientoccurrences in captured output (same machine, same Uno.Sdk 6.7.16, Trace +Uno.UIfilter applied in both):RemoteControlClientcategory linesblank(factory set inMain())recommended(UseLogginginOnLaunched)First categories logged, in chronological order:
Uno.UI.Hosting.UnoPlatformHostBuilder→…X11InputMethodDetector→Uno.UI.RemoteControl.RemoteControlClient(3rd — captured very early) → …Uno.UI.Xaml.Core.VisualTree→BaseWindowImplementation→ActivationWrapper→ … (RemoteControlClient never present — it already ran before the factory existed).Higher-severity records from the same subsystem do show in recommended (e.g.
LogError"DevServer isn't able to connect"fromUno.UI.HotDesign.Client.Logic.DevServer.RemoteControlService), which is what makes the problem confusing: users see some DevServer errors but never the early client traces — purely a level+timing artifact.Note: uncommenting the template's
logBuilder.HotReloadCoreLogLevel(LogLevel.Trace)group helper does not surface these logs either (still 0 lines) — the late-configuration timing dominates regardless of the filter used.Proposed fix / discussion
The ambient
ILoggerFactoryshould be established before the Uno host and its DevServer/RemoteControl client start, so early Trace/Debug records are not lost. Options:LogExtensionPoint.AmbientLoggerFactory(a lightweight bootstrap factory using the sameUseLoggingconfiguration) beforehost.Run()in the generatedProgram.cs, then hand off to the DI-built factory — instead of only wiring it insideOnLaunched.Current workaround (set an early ambient factory in
Program.Main, before building/running the Uno host — mirrors what theblanktemplate does):With this in place, the
Uno.UI.RemoteControl.RemoteControlClientearly traces are captured on the recommended template as well.