Repository navigation
Description
Current behavior 🐛
On the dev-server, hot-reload file-update requests are processed the moment they arrive, without waiting for the Roslyn workspace to finish loading. Because the workspace captures its baseline by reading the solution from disk during (asynchronous) initialization, any UpdateFile request that lands before that read completes gets its edit written to disk first — so the baseline is loaded from the already-mutated file.
The consequence is a corrupted baseline: Roslyn diffs subsequent changes against a solution that already contains the early edit, so that edit is never emitted as a delta and the running application never receives it. The delta engine's baseline and the code the app was actually built from silently diverge, and from that point on hot-reload deltas can be computed against the wrong starting point.
Concretely, in Uno.UI.RemoteControl.Server.Processors/HotReload/ServerHotReloadProcessor:
ProcessUpdateFile(UpdateFileRequest)calls_fileUpdater.UpdateAsync(request, _ct.Token)immediately, with no dependency on the workspace being ready.- The workspace is created asynchronously in
InitializeInner/InitializeAsync(kicked off fromProcessConfigureServer) and stored in the_workspacefield. The baseline solution is loaded from disk inLoadSolutionFromDiskviaCompilationWorkspaceProvider.CreateWorkspaceAsync. FileUpdater.UpdateAsyncedits the file (through the on-disk editor) with no gate against workspace readiness, so an update can be written to disk before — or while — the baseline is being read.
There is a BufferGate (_solutionWatchersGate) that batches file changes vs. the file-system watcher, but nothing gates update requests against the initial workspace load itself.
Expected behavior 🎯
UpdateFile requests received before the workspace has finished initializing (before HotReloadEvent.Ready) should be queued and applied only once the baseline solution has been captured, so the baseline always reflects the code the running application was built from. Edits should never be written to disk ahead of the initial baseline read.
How to reproduce it 🔬
This is a startup timing race, most easily hit when a client starts issuing UpdateFile requests at app startup, before the dev-server workspace has finished loading:
- Connect a client that sends one or more
UpdateFileRequestframes very early — around the same time as (or right after) theConfigureServerhandshake, before the server has sentHotReloadWorkspaceLoadResult { WorkspaceInitialized = true }/ notifiedHotReloadEvent.Ready. - Observe that the edit is written to disk by
FileUpdaterbeforeLoadSolutionFromDiskreads it. - The subsequently loaded baseline already contains the edit, so no delta is produced for it and the running app never reflects the change.
This is primarily reproducible in QA/automation scenarios that drive updates programmatically at startup, but the race is valid in general — it is more likely to surface now that the design-time tooling begins issuing update requests as soon as the app starts.
Workaround 🛠️
Delay any programmatic UpdateFile request until after the client has received the workspace-initialized notification (HotReloadWorkspaceLoadResult.WorkspaceInitialized == true).
Suggested fix 💡
Gate ProcessUpdateFile on workspace readiness: await the _workspace initialization task (or a dedicated "ready" signal) before invoking _fileUpdater.UpdateAsync, queuing incoming requests until initialization completes. When Roslyn hot-reload is disabled (IDE-driven / no workspace), the current pass-through behavior should be preserved.
Anything else we need to know? 💬
No public API change is expected — the fix is internal to the dev-server hot-reload processor.
Activity
fix(hr): queue UpdateFile requests until the workspace has captured i…
fix(hr): queue UpdateFile requests until the workspace has captured i…
Jen-Uno commentedon Sep 30, 2026
QA: closing out without a manual pass. The fix in #23789 ships with automated tests (
Given_WorkspaceGatedFileUpdater.cs) that exercise the change.If you still see this behaviour on a build that includes that PR, please reopen or comment here.