Skip to content

Hot reload on iOS: MVUX model updates don't apply, and #3235 hangs the app (needs Mac investigation) #3240

Open

Description

@kazo0

Summary

Two related problems on the iOS simulator (iOS 26.1, .NET for iOS on Mono with the interpreter, Debug):

  1. MVUX model edits made through hot reload don't apply. The same 5 Reactive.WinUI.Tests.Given_HotReload tests fail as on Android before fix(reactive): enable MVUX hot reload on Android #3235. The plain method-body edit passes, so the runtime does apply deltas; only the MVUX model swap is missing.
  2. With fix(reactive): enable MVUX hot reload on Android #3235 applied, the test app hangs before any test runs. In 2 of 2 runs it never completes the DevServer handshake. Without fix(reactive): enable MVUX hot reload on Android #3235 it completes in 3 of 3 runs.

#3235 only changes behavior when Assembly.GetEntryAssembly() is null. That it changes anything on iOS suggests the entry assembly is null on the iOS simulator, contrary to the earlier assumption that iOS has one because the head has a managed Main. Nothing has confirmed that directly yet; the app had no logging (see "Diagnostics gap").

#3235 is on hold until this is understood. Narrowing it to Android is an option.

Background

Evidence

The affected tests, in src/Uno.Extensions.Reactive.UI.Tests/Given_HotReload.cs:

  • When_UpdateMvuxFeedSource_Then_NewViewModelReflectsUpdate
  • When_NewVMWithCtorDepsConstructedAfterHR_Then_ReflectsUpdate
  • When_UpdateInheritedParentModel_Then_ChildBindingsRefresh
  • When_AddDerivedFeedToModelWithStateAndCommand_Then_CommandUpdatesBoundState
  • When_UpdateStateValue_Then_NewViewModelReflectsUpdate

Each fails with System.TimeoutException: Operation has been cancelled after 0:00:05 in TestHelper.WaitFor: the bound value never changes to the edited one.

CI build Branch #3235 iOS result
239608 (3 attempts) #3238 no completes; the 5 tests fail, the method-body test passes
239627 (attempt 1) #3238, per-class launches no completes; 36 pass (the 5 excluded)
239648 #3238 no green, 36/36 (the 5 excluded)
239619 draft #3239 = #3238 + #3235 yes hangs: no result file in 1800s
239628 draft #3239, per-class launches yes hangs: the first launch (Reactive class) never writes results

Shape of the hang (both runs):

  • The app opens its two DevServer WebSocket connections, to 127.0.0.1:47100 and [::1]:47100; the client races both.
  • No ConfigureServer frame and no "App Connected" ever reach the DevServer, and the connections close after 12–60s.
  • No test sends a file edit.
  • The process stays alive: os_log shows Metal shader compiles up to 25 minutes in.

For comparison, every run without #3235: "App Connected" and ConfigureServer arrive within seconds, followed by dozens of UpdateFileRequest frames.

The same 5 tests on Android: 9/14 on main, 14/14 with #3235 locally, 0 MVUX failures with #3235 on CI (build 239619).

Reproducing on a Mac

The device script runs locally as-is.

  1. Branch: check out dev/sb/mobile-hr-lanes (ci: run hot-reload runtime tests on Android and iOS #3238). To test the fix, add fix(reactive): enable MVUX hot reload on Android #3235 on top with git cherry-pick 15065079c.
  2. Platform restriction: create DebugPlatforms.props at the repo root (git-ignored). The DevServer's own MSBuild workspace never sees -p: switches, so these must live in a file:
    <Project>
      <PropertyGroup>
        <Build_Android>false</Build_Android>
        <Build_iOS>true</Build_iOS>
        <Build_MacCatalyst>false</Build_MacCatalyst>
        <Build_Windows>false</Build_Windows>
        <Build_Web>false</Build_Web>
        <Build_Desktop>false</Build_Desktop>
        <UnoDisableHotDesign>true</UnoDisableHotDesign>
        <UnoDisableMCPSupport>true</UnoDisableMCPSupport>
        <UnoRemoteControlHost>127.0.0.1</UnoRemoteControlHost>
        <UnoRemoteControlPort>47100</UnoRemoteControlPort>
      </PropertyGroup>
    </Project>
  3. Build (Debug, simulator, no provisioning profile):
    dotnet build src/Uno.Extensions.RuntimeTests/Uno.Extensions.RuntimeTests/Uno.Extensions.RuntimeTests.csproj \
      -c Debug -f net10.0-ios -p:CodesignRequireProvisioningProfile=false
    Xcode must match the iOS workload: CI pins /Applications/Xcode_26.1.1.app (IosXCodeRoot in build/ci/.azure-pipelines.yml).
  4. Run the lane script, which boots the simulator, installs the app, starts the DevServer and launches once per filter:
    export DEV_SERVER_HOST_DLL="$(dotnet msbuild src/Uno.Extensions.RuntimeTests/Uno.Extensions.RuntimeTests/Uno.Extensions.RuntimeTests.csproj \
      -nologo -t:GetRemoteControlHostPath -p:TargetFramework=net10.0-ios \
      | sed -n 's:.*<RemoteControlHostPath>\(.*\)</RemoteControlHostPath>.*:\1:p' | head -n 1)"
    BUILD_SOURCESDIRECTORY="$PWD" \
    RuntimeTestsArtifactPath="$PWD/src/Uno.Extensions.RuntimeTests/Uno.Extensions.RuntimeTests/bin" \
    SIMULATOR_DEVICE="iPhone 16" SIMULATOR_RUNTIME_PREFIX="com.apple.CoreSimulator.SimRuntime.iOS-26-1" \
    DEV_SERVER_PORT=47100 RUN_TIMEOUT_SECONDS=1200 \
    TEST_FILTERS="Reactive.WinUI.Tests.Given_HotReload" \
    bash build/test-scripts/ios-simulator-runtime-tests.sh
    Adjust SIMULATOR_DEVICE and SIMULATOR_RUNTIME_PREFIX to what xcrun simctl list devices available shows.

Outputs: build/ios-runtime-tests/, containing:

  • the merged ios-runtime-tests-results.xml and one part-N.xml per launch
  • logs/devserver.log
  • logs/app-log.txt (os_log, last 30 min)

build/test-scripts/validate-runtime-test-results.py prints the failing tests.

Diagnostics gap

App.InitializeLogging() is only called from Platforms/Desktop/Program.cs. On iOS (and Android) the app has no logger, so none of the MVUX messages appear anywhere. For diagnosis, call it from Platforms/iOS/Main.iOS.cs before building the host. On iOS it routes to OSLogLoggerProvider. Then add filters so the relevant categories reach Information:

  • Uno.Extensions.Reactive (or Uno.Extensions.Reactive.Config and .Presentation.Bindings)
  • Uno.UI.RemoteControl, already Trace in InitializeLogging

The messages to look for:

  • Module '<name>' has enabled hot-reload support for MVUX., or ... but it is not the application module, request has been ignored. (ModuleFeedConfiguration.ConfigureHotReload).
  • Hot reload has been disabled. (BindableViewModelBase.HotPatch, Info). With fix(reactive): enable MVUX hot reload on Android #3235 this becomes a Warning naming the model.

The simplest direct check is a Console.WriteLine of Assembly.GetEntryAssembly()?.GetName().Name and FeedConfiguration.EffectiveHotReload (internal; use reflection or InternalsVisibleTo). Put it in MobileRuntimeTestsAutostart.StartIfRequested, whose output is already captured in os_log.

For the hang:

  • While the app is stuck, run sample <pid> 10 (the simulator process is a host process) or lldb -p <pid> then bt all, to see what the main thread and the RemoteControl thread are doing.
  • Check whether the handshake (ConfigureServer / AppLaunchMessage) waits on something that MVUX hot-reload initialization now blocks.

Code involved

Path Role
src/Uno.Extensions.Reactive/Config/ModuleFeedConfiguration.cs Entry-assembly check; #3235 changes it
src/Uno.Extensions.Reactive.Generator/HotReloadModuleInitializerGenerator.cs Emits a [ModuleInitializer] in every assembly that references Reactive, calling ConfigureHotReload("<assembly>", isEnabled). Note: test and library assemblies call it too, not just the head.
src/Uno.Extensions.Reactive/Config/FeedConfiguration.cs EffectiveHotReload
src/Uno.Extensions.Reactive/Presentation/Bindings/BindableViewModelBase.HotReload.cs HotPatch, the early return when disabled
src/Uno.Extensions.Reactive/Core/HotReload/HotReloadService.cs MetadataUpdateHandler; dispatches HotPatch and TryHotPatch
src/Uno.Extensions.Core/PlatformHelper.cs (~line 114) Documents GetEntryAssembly() as null on Android only
src/Uno.Extensions.RuntimeTests/Uno.Extensions.RuntimeTests/Platforms/iOS/Main.iOS.cs The iOS Main
src/Uno.Extensions.RuntimeTests/Uno.Extensions.RuntimeTests/MobileRuntimeTestsAutostart.cs In-app runner. UITEST_RUNTIME_IS_SECONDARY_APP runs [RunsInSecondaryApp] classes in-process and waits for the DevServer workspace first.

Hypotheses to check

  1. GetEntryAssembly() is null on the iOS simulator. This would explain the 5 failures (same root cause as [HR][Android] C# edits to an MVUX model are reported applied, but the app keeps running the old code uno#25417) and why fix(reactive): enable MVUX hot reload on Android #3235 changes iOS behavior at all.
  2. With fix(reactive): enable MVUX hot reload on Android #3235 on iOS, the "first module" isn't the app. Module initializers run lazily, when a module is first touched. On iOS a library (Uno.Extensions.Reactive.UI, Reactive.WinUI.Tests, ...) may configure first. That alone shouldn't hang, since every Debug module passes isEnabled: true, but confirm which module wins.
  3. Enabling MVUX hot reload starts something during app startup that blocks the DevServer client's handshake. The deadlock would sit between the MVUX hot-reload setup and RemoteControlClient, possibly on the UI thread. Example: a hot-reload handler or TryHotPatch running during startup.

Done when

Related

Activity

  1. added
    kind/bug
    on Oct 15, 2026
  2. changed the title [-]Hot reload on iOS: MVUX model updates don't apply (same 5 tests as #25417 on Android)[/-] [+]Hot reload on iOS: MVUX model updates don't apply (same 5 tests as unoplatform/uno#25417 on Android)[/+] on Oct 15, 2026
  3. kazo0 commented on Oct 15, 2026

    @kazo0
    ContributorAuthor

    Update: with #3235, the iOS app hangs (2 of 2 runs); without it, it completes (3 of 3).

    Run #3235 Result
    build 239608 (3 attempts) no completes; the 5 MVUX tests fail
    build 239627 attempt 1 (per-class launches) no completes; 36 passed, 2 failed (the 5 MVUX tests excluded)
    build 239619 (draft #3239) yes hangs: no results in 1800s
    build 239628 (draft #3239, per-class launches) yes hangs: the first launch (Reactive class) never writes results

    In both hung runs, the app opens its DevServer connections (127.0.0.1 and ::1), but no ConfigureServer or "App Connected" ever arrives, and the connections close after 12–60s. No test sends an edit. The app keeps rendering, so the process is alive.

    Interpretation (unverified): #3235 only changes behavior when Assembly.GetEntryAssembly() is null. That it changes iOS at all suggests the entry assembly is null on the iOS simulator. If so, MVUX hot reload is disabled on iOS for the same reason as Android (the 5 failures), and enabling it there then hangs something early, before the DevServer handshake.

    Next step: a local simulator run that logs GetEntryAssembly(), FeedConfiguration.EffectiveHotReload, and where the app is stuck (a thread dump while it hangs).

  4. changed the title [-]Hot reload on iOS: MVUX model updates don't apply (same 5 tests as unoplatform/uno#25417 on Android)[/-] [+]Hot reload on iOS: MVUX model updates don't apply, and #3235 hangs the app (needs Mac investigation)[/+] on Oct 15, 2026
  5. kazo0 commented on Oct 15, 2026

    @kazo0
    ContributorAuthor

    Update: #3235 is now merged into main (e059b8d). So main itself carries the change that hung the iOS test app in draft #3239: don't cherry-pick 15065079c, just use main or dev/sb/mobile-hr-lanes. #3238 has merged main and re-included the five tests on Android. Its iOS lane (MVUX tests still excluded) now shows whether the hang reproduces on main; I'll post the result here.

  6. kazo0 commented on Oct 15, 2026

    @kazo0
    ContributorAuthor

    New data point: with #3235 on main, the iOS lane does not hang when the five MVUX tests are excluded.

    #3238 at 1abdea627 (main with #3235 merged), build 239767:

    • iOS: 36/36 green in 23 min. Both launches connected and completed. The five tests are still excluded via IosTestFilters.
    • Android: 42/42 green, including the five MVUX tests.

    Compared with the two hung runs (draft #3239, builds 239619 and 239628): both had #3235 and the five MVUX tests in the first launch. Since the hang was observed before any ConfigureServer reached the DevServer, the earlier reading was "startup hang, independent of tests". This run weakens that: the same #3235 code doesn't hang when those tests aren't in the filter. Either the hang is tied to running the MVUX hot-reload tests with MVUX hot reload enabled on iOS, or 2/2 was a coincidence.

    Suggested first experiment on the Mac: on main, run the lane script with TEST_FILTERS="Reactive.WinUI.Tests.Given_HotReload" (the five included) and app logging enabled (see "Diagnostics gap"). Then run again with only When_UpdateMvuxFeedSource_Then_NewViewModelReflectsUpdate. If it hangs, take a sample / lldb bt all while it's stuck.

  7. kazo0 commented on Oct 15, 2026

    @kazo0
    ContributorAuthor

    Local Mac results: the root cause of the 5 failures is confirmed. The hang doesn't reproduce locally.

    The 5 MVUX failures: GetEntryAssembly() is null during module initialization on iOS

    I added temporary Console.WriteLines in ModuleFeedConfiguration.ConfigureHotReload, in the iOS Main and in StartIfRequested (os_log, iOS simulator, Debug, with #3235):

    14:50:59.635 ConfigureHotReload module=Uno.Extensions.RuntimeTests isEnabled=True cachedEntry=<null> liveEntry=<null> isApp=True tid=1
    14:50:59.640 Main liveEntry=Uno.Extensions.RuntimeTests
                 ConfigureHotReload module=Uno.Extensions.Reactive.WinUI.Tests isEnabled=True cachedEntry=<null> liveEntry=Uno.Extensions.RuntimeTests isApp=False
                 StartIfRequested liveEntry=Uno.Extensions.RuntimeTests effectiveHR=Enabled
    

    iOS does have an entry assembly, but Mono only sets it once Main starts, after the app's [ModuleInitializer] has run. ModuleFeedConfiguration._entryAssembly is captured when the type initializes, which happens inside that initializer, so it is null. Without #3235 the app module never matches and EffectiveHotReload stays Disabled: same symptom as Android, different reason. With #3235 the app's own module calls first (before Main), wins, and hot reload is Enabled. Library and test modules call later and are correctly ignored.

    Hypothesis 1 is confirmed, with that refinement. Hypothesis 2 doesn't apply: the app module is always first. Note that the issue's logging recipe can't show Module '<name>' has enabled..., because that message is logged from the module initializer, before Main can call InitializeLogging().

    The hang: not reproduced locally

    All runs used build/test-scripts/ios-simulator-runtime-tests.sh on an iOS 18.5 simulator (iPhone 16):

    Code Filter Result
    dev/sb/mobile-hr-lanes (has #3235) Reactive.WinUI.Tests.Given_HotReload 14/14, including the 5
    same IosTestFilters with the 5 re-included 41/41
    same, repeated same 41/41
    6acbf9ca1 (draft #3239, the commit that hung builds 239619/239628) its own IosTestFilters 42/42; all 3 launches connect to the DevServer

    The draft #3239 base also predates 3443f8683 (lane stabilization), but that commit doesn't touch the DevServer handshake, so it isn't an explanation. Since the exact hung commit completes locally, the hang is specific to the CI environment (iOS 26.1 on the hosted agent). Its cause is still unknown. #3251 re-includes the 5 tests on the iOS lane, so its CI run is the real test. It also turns on logging in the iOS and Android RuntimeTests heads, so a CI hang now leaves RemoteControl traces in app-log.txt.

    The iOS 27 simulator can't be used for this: the app is killed at launch by UIKit's scene-lifecycle check (_UIApplicationEvaluateRuntimeIssueForNoSceneLifecycleAdoption), a known separate issue.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/mvuxkind/bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions