Skip to content

fix(devserver): restart a dead monitor on re-select; skip ambient reuse on forceRestart - #24764

Draft
noknowscode wants to merge 4 commits into
masterfrom
dev/mtmattei/devserver-restart-dead-monitor
Draft

noknowscode wants to merge 4 commits into
masterfrom
dev/mtmattei/devserver-restart-dead-monitor

Conversation

@noknowscode

Copy link
Copy Markdown
Contributor

GitHub Issue: unoplatform/uno.app-mcp#153 (also hardens unoplatform/uno.app-mcp#148 and #152)

PR Type:

🐞 Bugfix

What changed? 🚀

Current behavior

  • DevServerMonitor's loop exits on its own after 3 no-host cycles (sets NotAnUnoWorkspace, breaks) or after repeated start failures. DevServerStarted stays true and no event is raised.
  • A freshly scaffolded solution hits this: before the first restore the new Uno.Sdk / Uno.WinUI.DevServer is not in the NuGet cache (SdkNotInCache), so the monitor dies ~30 s after starting.
  • Afterwards, the project.assets.json write from restore/build and an explicit uno_app_select_solution both resolve to the same workspace: Refresh, already_selected, nothing restarts. Only forceRestart: true recovers.
  • A Start transition can be skipped by StartDevServerMonitor's start-once guard when a monitor from an earlier solution-less workspace (roots on an empty folder) is still registered.
  • With forceRestart, StartProcess re-adopts any running host registered for the same solution through AmbientRegistry (no version check), and TerminateServerProcess does not wait for a killed host, so a forced restart can reuse the old host.

New behavior

  • DevServerMonitor.IsMonitoring reports whether the loop is alive.
  • ApplyWorkspaceResolutionAsync escalates Refresh to Restart when the monitor loop has exited (resolved workspaces only).
  • The Start path stops the previous workspace first.
  • forceRestart skips AmbientRegistry re-adoption once; TerminateServerProcess waits up to 5 s after Kill.
  • Test: Given_ProxyLifecycleManager.WhenSelectingCurrentSolutionAfterMonitorExited_DevServerRestarts.

Risk: a forced restart can now run a second host next to an IDE-owned host for the same solution.

PR Checklist ✅

  • Added a unit test (not yet run)
  • Uno.UI.DevServer.Cli.Tests pass
  • Manual: start the MCP in an empty folder, scaffold an app, dotnet restore, then uno_app_select_solution on the new .sln attaches without forceRestart

Other information ℹ️

Draft opened from a browser session; the change was written from reading master and has not been built locally yet.

🤖 Generated with Claude Code

https://claude.ai/code/session_01EVdoaKDSQpmH53dJYEV3Qv

@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 235840 found UI Test snapshots differences: skia-linux-screenshots: 57, skia-windows-screenshots: 2310, wasm: 11

Details
  • skia-linux-screenshots: 57 changed over 2348

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • Buttons.png-dark
    • Buttons.png
    • DisplayInformation.png-dark
    • ContextRequested.png-dark
    • ContextRequested.png
    • ClipboardTests.png-dark
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • ElementLevelTheme.png-dark
    • ElementLevelTheme.png
    • Examples.png-dark
    • Examples.png
    • ExpanderColorValidationPage.png-dark
    • ExpanderColorValidationPage.png
    • Focus_FocusVisual_Properties.png-dark
    • DropDownButtonPage.png-dark
    • DropDownButtonPage.png
    • Image_AnimatedWebP.png-dark
  • skia-windows-screenshots: 2310 changed over 2500

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AnimatedIconPage.png
    • AppBar_KeyBoard.png-dark
    • ApplicationViewSpanningRectsPage.png
    • AppWindowTitleBar Properties.png
    • Attributed_text_FontSize_Changing.png
    • AutoBorderStretchwithbottommargin.png
    • AutoBorderStretchwithrightmargin.png-dark
    • AutomationPropertiesExtensions_Role.png
    • AutoSizedPathCentered.png-dark
    • AutoSizedPathCentered.png
    • AutoSuggestBox_SoftKeboard.png-dark
    • AutoSuggestBox_SoftKeboard.png
    • Basics Pivot Test.png-dark
    • Basics Pivot Test.png
    • Battery.png-dark
    • Battery.png
    • BeginTime_MultipleAnimations.png-dark
    • BeginTime_MultipleAnimations.png
    • BitmapIcon_Foreground.png-dark
    • BitmapIcon_Foreground.png
  • wasm: 11 changed over 1076

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • UITests.Shared.Microsoft_UI_Xaml_Controls.ExpanderTests.WinUIExpanderPage
    • SamplesApp.Wasm.Windows_UI_Xaml_Controls.ListView.ListView_IsSelected
    • SamplesApp.Windows_UI_Xaml_Controls.ListView.ListViewSelectedItems
    • UITests.Microsoft_UI_Xaml_Controls.WebView2Tests.WebView2_NavigationProperties
    • SamplesApp.Microsoft_UI_Xaml_Controls.WebView2Tests.WebView2_EnableDevTools
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Minimal
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Ogg_Extension
    • UITests.Windows_UI_Xaml_Controls.CalendarView.CalendarView_Theming
    • UITests.Windows_UI_Xaml_Media_Animation.ColorAnimation_Background
    • UITests.Uno_Web.Http.CookieManagerTests
    • Uno.UI.Samples.Content.UITests.WebView.WebView_AnchorNavigation

…ne' may silently drop its earlier arguments'

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
@nventive-devops

Copy link
Copy Markdown
Contributor

The build 236055 found UI Test snapshots differences: skia-linux-screenshots: 57, skia-windows-screenshots: 289, wasm: 11

Details
  • skia-linux-screenshots: 57 changed over 2348

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • ClipboardTests.png-dark
    • DisplayInformation.png-dark
    • Buttons.png-dark
    • Buttons.png
    • ContextRequested.png-dark
    • ContextRequested.png
    • Gamepad_CurrentReading.png-dark
    • Gamepad_CurrentReading.png
    • Gamepad_Enumeration.png-dark
    • Gamepad_Enumeration.png
    • Focus_FocusVisual_Properties.png-dark
    • Examples.png-dark
    • Examples.png
    • ExpanderColorValidationPage.png-dark
    • ExpanderColorValidationPage.png
    • ImageIconPage.png-dark
  • skia-windows-screenshots: 289 changed over 2348

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AuthenticationBroker_Demo.png-dark
    • AutomationProperties_AutomationId.png-dark
    • Battery.png-dark
    • Battery.png
    • Accessibility_ScreenReader.png
    • AutomationProperties_AutomationId.png
    • AutomationPropertiesExtensions_Role.png
    • Buttons.png-dark
    • ContentPresenter_NativeEmbedding_ZIndex.png
    • AutomationPropertiesExtensions_Role.png-dark
    • AutomationProperties_Name.png
    • CompositionPath.png-dark
    • CompositionPath.png
    • Display.DisplayRequest.png-dark
    • Display.DisplayRequest.png
    • DisplayInformation.png-dark
    • DisplayInformation.png
    • ElevatedView_CornerRadius.png-dark
    • ElevatedView_CornerRadius.png
    • ElevatedView_Corners.png-dark
  • wasm: 11 changed over 1076

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • UITests.Shared.Microsoft_UI_Xaml_Controls.ExpanderTests.WinUIExpanderPage
    • SamplesApp.Wasm.Windows_UI_Xaml_Controls.ListView.ListView_IsSelected
    • SamplesApp.Microsoft_UI_Xaml_Controls.WebView2Tests.WebView2_EnableDevTools
    • SamplesApp.Windows_UI_Xaml_Controls.ListView.ListViewSelectedItems
    • UITests.Microsoft_UI_Xaml_Controls.WebView2Tests.WebView2_NavigationProperties
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Minimal
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Ogg_Extension
    • UITests.Uno_Web.Http.CookieManagerTests
    • UITests.Windows_UI_Xaml_Media_Animation.ColorAnimation_Background
    • Uno.UI.Samples.Content.UITests.WebView.WebView_AnchorNavigation
    • UITests.Windows_UI_Xaml_Controls.CalendarView.CalendarView_Theming

@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 236055 has failed on Uno.UI - CI.

@carldebilly

Copy link
Copy Markdown
Member

Coordination note on unoplatform/uno.app-mcp#148, which this PR lists as hardened.

#148 had two symptoms, and only one belongs here:

  • uno_app_start failing with No process is associated with this object: deterministic, and entirely in the App MCP add-in (AppProcess.StartAsync read the process id after disposing the Process on its default no-wait path). Fixed in unoplatform/uno.app-mcp#167, validated against main; it does not depend on this PR.
  • forceRestart not clearing the launcher state after an SDK change: the AmbientRegistry re-adoption this PR skips once. That is what this PR covers for Fixed android output paths #148.

No merge order between the two.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants