Repository navigation
feat(aspire): give the heads a dev server for Hot Reload - #3317
Draft
Kunal22shah wants to merge 2 commits into
Draft
Kunal22shah wants to merge 2 commits into
Kunal22shah wants to merge 2 commits into
Conversation
- Run the uno.devserver CLI of the app's dev server version: it reuses the one running for the solution, an IDE's for example, or starts one that stops with the AppHost - Pass its port to each head's build as UnoRemoteControlPort - Show it as the uno-devserver resource, one per solution; Uno:DevServer:Enabled=false turns it off
4 of 7 tasks
Comment on lines
+432
to
+435
| catch (Exception exception) | ||
| { | ||
| logger.LogDebug(exception, "The state of the dev server could not be published."); | ||
| } |
| var recognized = true; | ||
| while (elapsed.Elapsed < RegistrationTimeout) | ||
| { | ||
| var output = new StringBuilder(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stack 4 of 4. Based on #3311 (baking the environment), #3310 (AppHost package) and #3309 (client package).
PR Type
What is the current behavior?
A head started by the AppHost gets Hot Reload only when an IDE, or a
dotnet dnx -y uno.devserver startrun by hand, already provides a dev server for the solution. From a terminal, the head logs "DevServer endpoint has no port" and never connects.What is the new behavior?
Every head gets a dev server, with or without an IDE. The
uno.devserverCLI does the work; the AppHost runs it and reads the result.startwith itself as the parent process. The CLI reuses the dev server already running for the solution, an IDE's for example, so the IDE's tools see the heads. Otherwise it starts one that stops on its own once the AppHost is gone and removes its registration. The AppHost never stops a dev server itself.Uno.WinUI.DevServerpackage the app restores, which the Uno.Sdk chooses. The AppHost restores the app first, under its build lock, and reads the version from the assets file.-p:UnoRemoteControlPort=<port>, the property an IDE sets through.csproj.user, so desktop, WebAssembly and Android heads all connect.uno-devserverresource, one per solution: Running with its port, process and who started it; Unavailable or FailedToStart with the reason and how to turn it off; Exited if it stops during the run. A head shows Waiting for dev server until the port is known.Uno__DevServer__Enabled=falsein the AppHost's environment, or"Uno": { "DevServer": { "Enabled": false } }in its settings: no dev server is added and heads build as before. The docs say the dev server accepts connections from the network, as one an IDE starts does.No public API is added.
Scope and limits
Important
Question for the dev server maintainers: should an Aspire integration start the dev server through the
uno.devserverCLI, or should the Uno.Sdk or the CLI own this? The answer decides whether the reuse rules, the off switch and the failure handling belong in this repository. Draft until it is answered, and not to be merged before #3309-#3311.Reviewer's guide
UnoDevServer.cs(resource,start, discovery, watch), thenHeadBuild.cs(waiting for the port, the build property) andDotnetCommand.cs(the process helper, now shared with the head build).Given_UnoDevServer(discovery parsing, version check, setting, one dev server per solution, the unavailable path through a real restore),Given_HeadBuild(the port reaching a real build, the waiting state),Given_DotnetCommand(timeouts, a child keeping the output open).Verification
On a generated
-preset recommended -server -aspireapp with desktop and WebAssembly heads, never built before, with no IDE open:Not verified: the Android head, macOS and Linux, a Visual Studio or Rider session, an offline machine.
PR Checklist
🤖 Generated with Claude Code