[Enhancement] Maui Framework should respond to C# Hot Reload events
- Dominant language
- C#
- Stars
- 23.3k
- Forks
- 2k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 290
Description
### Description
Maui does not have an implementation of MetadataUpdateHandler so the UI does not automatically refresh after a code change has been applied
- The code is there in the framework to react to the messages. There are two mechanisms - Roslyn attribute to inject new classes, and method body replacement
- The runtime shipped the metadataupdate attribute as part of .NET 6
We need to write the “glue” code that handles the metadataupdate notification and passes them down to MAUI so a UI refresh occurs
@Joaquin Jares @Jon Dick @Stephane Delcroix
Stephane started an email thread with the summary of the work to be done (Piggy backing on XAML HR for .NET HR communication). This has nothing to do with the runtime proper, but it does require work in both the application side and on the VS side.
VS Side: a message with some payload is send when a .NET HotReload happened
XAML HR Bridge: that message is passed along the debug channel, and received on the running agent
XAML HR agent: when receiving such a message, it triggers an event on the runtime looks for the MetadataUpdateHandlerAttribute in all loaded assemblies and collects the methods to be called (either cache clearing or other update handling) and calls all the methods (first cache clearing, then update handling)
MAUI framework listen to the runtime event, and refreshes pages accordingly registers such a handler to trigger a page referesh.
### Public API Changes
N/A
### Intended Use-Case
C# Hot Reload on Maui
Contributor guide
Assessment
This issue has not been assessed yet.