src/Uno.UI.RemoteControl.Server/AppLaunch/ApplicationLaunchMonitor.md
using Uno.UI.RemoteControl.Server.AppLaunch;
var options = new ApplicationLaunchMonitor.Options
{
// Default is 60s
Timeout = TimeSpan.FromSeconds(30),
OnRegistered = ev => logger.LogInformation($"Launch registered: {ev.Mvid} ({ev.Platform})"),
OnConnected = ev => logger.LogInformation($"Connected: {ev.Mvid} ({ev.Platform})"),
OnTimeout = ev => logger.LogWarning($"Timed out: {ev.Mvid} ({ev.Platform})")
};
using var monitor = new ApplicationLaunchMonitor(options: options);
// New signature includes IDE and Uno plugin version
monitor.RegisterLaunch(mvid, "Wasm", isDebug: true, ide: "VisualStudio", plugin: "uno-vs-extension-1.2.3");
monitor.ReportConnection(mvid, "Wasm", isDebug: true);
That’s it. The monitor pairs the connection with the oldest pending launch for the same (mvid, platform, isDebug). If no connection arrives before the timeout, OnTimeout is invoked.
Events emitted by the monitor are prefixed with uno/dev-server/app-launch/. See Telemetry.md in the .Host project for more info.
The dev-server can receive registration and connection events through multiple channels:
AppLaunchRegisterIdeMessage (scope: AppLaunch) carrying MVID, Platform, IsDebug. Triggers RegisterLaunch.DevServerChannel): AppLaunchMessage with Step = Launched. Triggers RegisterLaunch.GET /applaunch/{mvid}?platform={platform}&isDebug={true|false}. Triggers RegisterLaunch.Connections are reported by the runtime after establishing the WebSocket connection:
DevServerChannel): AppLaunchMessage with Step = Connected. Triggers ReportConnection.If no matching Connected message arrives before timeout, a timeout event is emitted.
TimeProvider which the monitor uses for timeout scheduling. Tests commonly inject Microsoft.Extensions.Time.Testing.FakeTimeProvider and advance time with fake.Advance(...) to trigger timeouts instantly.var fake = new FakeTimeProvider(DateTimeOffset.UtcNow);
using var monitor = new ApplicationLaunchMonitor(timeProvider: fake, options: options);
// register, then fake.Advance(TimeSpan.FromSeconds(11)); // triggers timeout callbacks
ApplicationLaunchMonitor.cs (implementation) + this ApplicationLaunchMonitor.md (short guide)