dotnet watch)This guide covers SourceGen hot reload setup for iOS simulator and physical devices.
<AvaloniaXamlCompilerBackend>SourceGen</AvaloniaXamlCompilerBackend><AvaloniaSourceGenHotReloadEnabled>true</AvaloniaSourceGenHotReloadEnabled>Run these commands from the repository root.
cd samples/ControlCatalog.iOS
AXSG_HOTRELOAD_TRACE=1 dotnet watch ./ControlCatalog.iOS.csproj
Expected startup signals:
dotnet watch 🔨 Build succeededxcrun simctl launch ... Avalonia.ControlCatalogAvalonia.ControlCatalog: 96930During iOS watch runs, AXSG build targets forward/derive:
AXSG_HOTRELOAD_TRANSPORT_MODEAXSG_HOTRELOAD_HANDSHAKE_TIMEOUT_MSAXSG_HOTRELOAD_REMOTE_ENDPOINT (when configured or auto-selected for simulator)For physical devices, set an explicit remote endpoint reachable from device.
<PropertyGroup>
<AvaloniaSourceGenIosHotReloadTransportMode>RemoteOnly</AvaloniaSourceGenIosHotReloadTransportMode>
<AvaloniaSourceGenHotReloadRemoteEndpoint>tcp://192.168.1.10:45820</AvaloniaSourceGenHotReloadRemoteEndpoint>
<AvaloniaSourceGenHotReloadRemoteRequireExplicitDeviceEndpoint>true</AvaloniaSourceGenHotReloadRemoteRequireExplicitDeviceEndpoint>
</PropertyGroup>
Then run:
AXSG_HOTRELOAD_TRACE=1 dotnet watch ./ControlCatalog.iOS.csproj
Requirements:
MSBuild properties:
AvaloniaSourceGenIosHotReloadEnabled (true by default for Debug iOS)AvaloniaSourceGenIosHotReloadUseInterpreter (true by default for Debug iOS)AvaloniaSourceGenIosHotReloadTransportMode (Auto|MetadataOnly|RemoteOnly)AvaloniaSourceGenIosHotReloadHandshakeTimeoutMs (default 3000)AvaloniaSourceGenHotReloadRemoteEndpointAvaloniaSourceGenHotReloadRemotePort (default 45820)AvaloniaSourceGenHotReloadRemoteAutoSimulatorEndpointEnabled (default true)AvaloniaSourceGenHotReloadRemoteRequireExplicitDeviceEndpoint (default true)AvaloniaSourceGenIosHotReloadForwardStartupHooks (default false)AvaloniaSourceGenIosHotReloadForwardWatchEnvironment (default true)Environment overrides:
AXSG_HOTRELOAD_TRACE=1AXSG_HOTRELOAD_TRANSPORT_MODE=Auto|MetadataOnly|RemoteOnlyAXSG_HOTRELOAD_HANDSHAKE_TIMEOUT_MS=<milliseconds>AXSG_HOTRELOAD_REMOTE_ENDPOINT=<endpoint>Accepted AXSG_HOTRELOAD_REMOTE_ENDPOINT formats:
host:porttcp://host:portws://host:port/pathwss://host:port/pathPort is required for all formats.
| Startup signal | Meaning | Action |
|---|---|---|
Waiting for application to connect to pipe ... |
Metadata hot reload channel not established yet | Keep TransportMode=Auto for simulator fallback or set explicit remote endpoint and RemoteOnly. |
[AXSG.HotReload.iOS] Physical-device remote fallback requires a reachable host endpoint. |
Device run without endpoint while endpoint is required | Set AvaloniaSourceGenHotReloadRemoteEndpoint (or AXSG_HOTRELOAD_REMOTE_ENDPOINT) to reachable host:port. |
Invalid AXSG_HOTRELOAD_REMOTE_ENDPOINT value ... |
Endpoint format rejected | Use one of: host:port, tcp://host:port, ws://host:port/path, wss://host:port/path. |
No precompiled XAML found for avares://... during startup |
Include resolved before source-generated registry entry became available or stale outputs | Clean bin/obj, rebuild, and ensure referenced project is part of build graph; if recurring, capture AXSG_HOTRELOAD_TRACE=1 logs. |
Failed to load AOT module ... while running in aot-only mode |
Debug build/runtime mismatch or stale AOT artifacts | Ensure Debug iOS with interpreter enabled, clean bin/obj, rebuild/redeploy simulator app. |
Microsoft.iOS: Socket error while connecting to IDE on 127.0.0.1:10000: Connection refused |
IDE debugging channel not attached | Usually non-blocking for dotnet watch; if needed, start from IDE debugger instead of pure CLI run. |
See:
samples/ControlCatalog.iOS/README.md