Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] VS Code on Mac: Cannot use Hot Reload in .NET Maui 9 apps #1748

Closed
cklumph opened this issue Feb 6, 2025 · 4 comments
Closed

[BUG] VS Code on Mac: Cannot use Hot Reload in .NET Maui 9 apps #1748

cklumph opened this issue Feb 6, 2025 · 4 comments
Assignees
Labels
area-hotreload Issues with Hot Reload experiences area-maui bug Something isn't working mac MacOS

Comments

@cklumph
Copy link

cklumph commented Feb 6, 2025

Describe the Issue

I was just dialoguing with James Montemagno on X about this issue (https://x.com/JamesMontemagno/status/1887277494841319562). I have all the latest .NET 9 MAUI workloads (9.0.100), XCode 16.2, and C#/Maui extensions. I'm using latest VS Code on MacOS Sequoia (15.3). I have the Hot Reload options turned on in my extension settings. I create a "dotnet new" bot template and debug on an iOS simulator (iPhone 16, iOS 18.2). While I can hit breakpoints and debug that way, I cannot use Hot Reload. I make a change in the XAML (for example, a Label's text) and when I save or hit Hot Reload, it says "No code changes detected" in the Hot Reload output window. I've tried targetting MacCatalyst with the same result. Have not tried Android.

Steps To Reproduce

  1. Create new MAUI template project.
  2. Open MainPage.xaml.cs to bring up the {} squiggles in the bottom right of VS Code
  3. Select an iOS simulator (I used iPhone 16, iOS 18.2), and the net9.0-ios target framework
  4. Start debugging with F5 (select "C#" debugger if it asks)
  5. Once running, change the "Hello world" Label text to something else.
  6. Save the document or hit the Hot Reload button in the debugging toolbar
  7. UI does not change. If you view the ".NET Hot Reload" output window, it says "No code changes were found".
  8. If you stop the app and re-launch, now the code changes are seen, but Hot Reload still does not work.

Expected Behavior

The UI should update when you save the XAML document.

Environment Information

MacOS Sequoia (15.3)
XCode 16.2 (managed through XCodes app)
Maui workload 9.0.100 (maui, maui-ios, and maui-maccatalyst)
VS Code 1.96.4
Extension: .NET MAUI v1.8.5
Extension: C# Dev Kit v1.17.4

@BretJohnson
Copy link
Member

@cklumph - Can you look in the Debug Console output pane (while the app is running) and search for Hot Reload there, to see if there are any Hot Reload related error messages.

Also, would you mind checking Android as well, as knowing whether or not that works can give additional clues.

Finally, is Catalyst / iOS XAML Hot Reload something that used to work on your machine, then stopped working at some point? If that's the case, any idea what may have changed?

Thx.

@cklumph
Copy link
Author

cklumph commented Feb 6, 2025

Hi @BretJohnson, thanks for the help.

  1. There is nothing in the Debug Console related to Hot Reload when running (every entry is simply "Loaded XYZ DLL..."). The "Hot Reload" output window in VS Code has the following:

2025-02-06 09:01:32.189 [info] XAML: Started Hot Reload connection listener on 127.0.0.1:53198
2025-02-06 09:01:37.151 [info] XAML: Started Hot Reload connection listener on 127.0.0.1:53215
2025-02-06 09:03:16.878 [info] No code changes were found.
2025-02-06 09:03:47.913 [info] XAML: Started Hot Reload connection listener on 127.0.0.1:53524
2025-02-06 09:05:46.093 [info] XAML: Started Hot Reload connection listener on 127.0.0.1:53861
2025-02-06 09:07:01.284 [info] No code changes were found.

  1. I just now tried this on the Android emulator and had the same results: the Hot Reload output window just says "No code changes were found."

  2. As for whether Hot Reload used to work: I'm not sure. I DO know it works from Windows. I've been using VS2022 on a Windows computer connected to my Mac to do my Maui development and now I'm moving to VS Code on the Mac instead. Hot Reload works via VS2022 on Windows (deploying to the same iOS simulator as my tests above, displaying on the Mac), which is interesting. Same code base on the Windows and Mac machines, but somehow Visual Studio is able to get Hot Reload working from Windows, but VS Code can't from the Mac.

If there are other detailed logs what would be helpful, please let me know and I'll help out.

Thanks!

@cklumph
Copy link
Author

cklumph commented Feb 6, 2025

Note: I tried it on the new VS Code version that came out today (1.97.0) with the same results of Hot Reload not working.

@AllenD-MSFT AllenD-MSFT added the area-hotreload Issues with Hot Reload experiences label Feb 12, 2025
@cklumph
Copy link
Author

cklumph commented Feb 17, 2025

UPDATE: Working now. I uninstalled and then re-installed everything, and now Hot Reload with .NET MAUI 9 projects is working.

The details: I uninstalled VS Code, VS Code user preferences, all .NET SDKs, and MAUI workloads. I then re-installed the .NET 9 SDK, VS Code, MAUI workloads, normal extensions (C#, C# Dev Kit, and .NET MAUI (all Release versions)), turned on the "Experimental: Hot reload" setting, and now Hot Reload is working.

@cklumph cklumph closed this as completed Feb 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-hotreload Issues with Hot Reload experiences area-maui bug Something isn't working mac MacOS
Projects
None yet
Development

No branches or pull requests

4 participants