dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22k stars 1.72k forks source link

Maui updates XAML code, Hotreload does not work #22383

Closed Jay-57blocks closed 4 months ago

Jay-57blocks commented 4 months ago

Description

Maui updates XAML code, Hotreload does not work

image

Steps to Reproduce

Hotload doesn't work in my project, but I create a new project and it works normally and I don't know how to make it work

Link to public reproduction project repository

No response

Version with bug

8.0.7 SR2

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android 13

Did you find any workaround?

I guess it might be the Mac version I was using, and I remember receiving a reminder telling me that hot updates were not working, but I accidentally clicked on the no longer reminder

image

Relevant log output

[4:57:56PM]  .NET Project references .NET MAUI.
[4:58:20PM]  Xaml Changed for 'Views/Setup/Welcome.xaml' in 'UNMC', sending to app...
[5:02:09PM]  Xaml Changed for 'Views/Setup/Welcome.xaml' in 'UNMC', sending to app...
[5:03:31PM]  .NET Project references .NET MAUI.
[5:04:53PM]  Xaml Changed for 'Views/Setup/SetupRequirements.xaml' in 'UNMC', sending to app...
[5:05:01PM]  Xaml Changed for 'Views/Setup/SetupRequirements.xaml' in 'UNMC', sending to app...
[5:05:32PM]  Xaml Changed for 'Views/Setup/SetupRequirements.xaml' in 'UNMC', sending to app...
[5:05:47PM]  Xaml Changed for 'Views/Setup/SetupRequirements.xaml' in 'UNMC', sending to app...
[11:27:50AM]  .NET Project references .NET MAUI.
[11:28:01AM]  .NET Project references .NET MAUI.
[11:29:57AM]  .NET Project references .NET MAUI.
[11:30:05AM]  Xaml Changed for 'Views/Setup/Welcome.xaml' in 'UNMC', sending to app...
[11:30:30AM]  Xaml Changed for 'Views/Setup/Welcome.xaml' in 'UNMC', sending to app...
[2:20:12PM]  Xaml Changed for 'Views/Setup/Welcome.xaml' in 'UNMC', sending to app...
[2:20:31PM]  Xaml Changed for 'Views/Setup/Welcome.xaml' in 'UNMC', sending to app...
github-actions[bot] commented 4 months ago

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

dotnet-policy-service[bot] commented 4 months ago

Thanks for the issue report @Jay-57blocks! This issue appears to be a problem with Visual Studio, so we ask that you use the VS feedback tool to report the issue. That way it will get to the routed to the team that owns this experience in VS.

If you encounter a problem with Visual Studio, we want to know about it so that we can diagnose and fix it. By using the Report a Problem tool, you can collect detailed information about the problem, and send it to Microsoft with just a few button clicks.

  1. Go to the Visual Studio for Windows feedback tool or Visual Studio for Mac feedback tool to report the issue
  2. Close this bug, and consider adding a link to the VS Feedback issue so that others can follow its activity there.
dotnet-policy-service[bot] commented 4 months ago

Thanks for the issue report @Jay-57blocks! This issue appears to be a problem with Visual Studio (Code), so we ask that you use the VS feedback tool to report the issue. That way it will get to the routed to the team that owns this experience in VS (Code).

If you encounter a problem with Visual Studio or the .NET MAUI VS Code Extension, we want to know about it so that we can diagnose and fix it. By using the Report a Problem tool, you can collect detailed information about the problem, and send it to Microsoft with just a few button clicks.

  1. Go to the Visual Studio for Windows feedback tool or .NET MAUI VS Code Extension repository to report the issue
  2. Close this bug, and consider adding a link to the VS Feedback issue so that others can follow its activity there.
jfversluis commented 4 months ago

For Visual Studio for Mac please use this link: https://learn.microsoft.com/visualstudio/mac/report-a-problem?view=vsmac-2022)

drasticactions commented 4 months ago

This is due to a breaking change in MAUI for scope validation, introduced in .NET 8, Hot Reload was pulling values from the service container (Specially Dispatcher) that broke, so the code within Xaml hot reload had to be updated which occurred for Visual Studio. Since Visual Studio for Mac received partial/kinda/sorta support for .NET 8 in general, and is heading on the path to deprecation, this fix was not brought forward to the Mac, as supported between VS and VSMac has diverged greatly since it started to be deprecated, patching it is not trivial.

I'm sorry, but most likely this will not be fixed for VSMac.

Jay-57blocks commented 4 months ago

@drasticactions So are there any temporary solutions? example,

  1. Change the project Net version to.Net7? But if I create a new project and it uses. net8, hot reload will work fine
  2. Or use VSCode? As far as I know, VSCode maui is currently only a preview and I'm not sure if it is stable enough.