Skip to content

Hot Reload does not work on iOS when running from Mac #115208

Open
@ivmirx

Description

@ivmirx

Description

I'm testing Hot Reload for a sample .NET 9 iOS app on macOS. Unfortunately, it does not work no matter what I try (simple method, timer-called method, timer-called Action)

Reproduction Steps

  1. Download the project HotApple.zip
  2. Run dotnet watch run --project HotApple/HotApple.csproj -f net9.0-ios /p:Platform=iPhoneSimulator /p:BuildIpa=false /p:MtouchFastDev=true /p:UseInterpreter=true
  3. Change label!.Text = $"Tick: {tickCount}" to label!.Text = $"Test: {tickCount}"
  4. See dotnet watch logging 🔥 [HotApple (net9.0-ios)] Hot reload succeeded.
  5. The label text is not updated (aside from the running count)

Expected behavior

The label changes the text before the count

Actual behavior

The label only changes the count when the timer runs

Regression?

No response

Known Workarounds

No response

Configuration

  • .NET 9.0.203
  • macOS 15.4.1
  • ARM64
  • Xcode 16.3
  • iOS 18.4 in Simulator

Other information

AppDelegate.cs:

namespace HotApple;

[Register ("AppDelegate")]
public class AppDelegate : UIApplicationDelegate {
	public override UIWindow? Window { get; set; }

	public override bool FinishedLaunching(UIApplication app, NSDictionary? launchOptions)
    {
        Window = new UIWindow(UIScreen.MainScreen.Bounds);
        Window.RootViewController = new TimerViewController();
        Window.MakeKeyAndVisible();
        return true;
    }
}
namespace HotApple;

public class TimerViewController : UIViewController
{
    UILabel? label;
    NSTimer? timer;
    int tickCount = 0;

    public override void ViewDidLoad()
    {
        base.ViewDidLoad();

        View.BackgroundColor = UIColor.SystemBackground;

        label = new UILabel(View.Bounds)
        {
            TextAlignment = UITextAlignment.Center,
            AutoresizingMask = UIViewAutoresizing.All,
            Text = "Starting..."
        };

        View.AddSubview(label);

        Action updateText = () =>
        {
            tickCount++;
            label!.Text = $"Tick: {tickCount}";
        };

        timer = NSTimer.CreateRepeatingScheduledTimer(1.0, _ => updateText());
    }
}

Metadata

Metadata

Assignees

Labels

area-EnC-monoHot Reload for WebAssembly, iOS/Android, etcneeds-further-triageIssue has been initially triaged, but needs deeper consideration or reconsideration

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions