Skip to content

fix: allow XAML HR when debugging with mono runtime#22696

Open
spouliot wants to merge 11 commits intomasterfrom
dev/spouliot/xaml-hr-debug-mono
Open

fix: allow XAML HR when debugging with mono runtime#22696
spouliot wants to merge 11 commits intomasterfrom
dev/spouliot/xaml-hr-debug-mono

Conversation

@spouliot
Copy link
Contributor

GitHub Issue: closes https://github.com/unoplatform/uno.vscode/issues/1240

PR Type:

  • 🐞 Bugfix

What is the current behavior? 🤔

When debugging with the mono runtime (e.g. iOS and Android) Hot Reload might not always work, e.g. modifying XAML.

What is the new behavior? 🚀

Hot Reload should always work, when debugging or not, whatever the runtime.

PR Checklist ✅

Please check if your PR fulfills the following requirements:

Other information ℹ️

  • use AsSpan instead of ToArray to reduce memory allocations
  • skip the creation of a MemoryStream and a BinaryWriter when the array is empty
  • needs more testing so it's a draft for the moment

Copilot AI review requested due to automatic review settings February 19, 2026 21:46
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request fixes Hot Reload for XAML when debugging with the mono runtime (specifically iOS and Android) in VS Code. The fix introduces a dual-channel approach where metadata deltas are applied through the debugger channel while updated type information is sent through the regular Hot Reload channel. The PR also includes memory optimizations using AsSpan() instead of ToArray() and eliminates unnecessary object allocations for empty arrays.

Changes:

  • Extracted metadata update handler logic into a separate ApplyUpdatedTypes method in HotReloadAgent to allow independent invocation
  • Modified validation logic to allow null metadata deltas when running with VSCode extension and mono debugger
  • Implemented dual-channel approach: metadata deltas via IDE channel, updated types via regular channel when debugging with mono runtime
  • Applied memory optimizations using AsSpan() for ImmutableArray<byte> conversions and early return for empty arrays

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/Uno.UI.RemoteControl/HotReload/MetadataUpdater/HotReloadAgent.cs Extracted ApplyUpdatedTypes method to enable separate invocation of metadata update handlers from delta application
src/Uno.UI.RemoteControl/HotReload/Messages/AssemblyDeltaReload.cs Updated validation to conditionally allow null delta properties when running with VSCode extension
src/Uno.UI.RemoteControl/HotReload/ClientHotReloadProcessor.Agent.cs Implemented conditional logic to skip delta application when debugging with mono runtime, while still applying updated types
src/Uno.UI.RemoteControl.Server.Processors/HotReload/ServerHotReloadProcessor.MetadataUpdate.cs Refactored to send deltas through IDE channel and types through regular channel when debugging; applied memory optimizations with AsSpan()

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@unodevops
Copy link
Contributor

🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-22696/wasm-skia-net9/index.html

@unodevops
Copy link
Contributor

🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-22696/wasm-skia-net9/index.html

@unodevops
Copy link
Contributor

⚠️⚠️ The build 198104 has failed on Uno.UI - CI.

@spouliot spouliot marked this pull request as ready for review February 24, 2026 22:17
Copilot AI review requested due to automatic review settings February 24, 2026 22:17
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI commented Feb 24, 2026

@spouliot I've opened a new pull request, #22727, to work on those changes. Once the pull request is ready, I'll request review from you.

@unodevops
Copy link
Contributor

🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-22696/wasm-skia-net9/index.html

Copilot AI and others added 2 commits February 24, 2026 22:39
… and non-debugger paths

Co-authored-by: spouliot <260465+spouliot@users.noreply.github.com>
test: add unit tests for AssemblyDeltaReload frame shapes in debugger and non-debugger HR paths
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ spouliot
❌ Copilot
You have signed the CLA already but the status is still pending? Let us recheck it.

@unodevops
Copy link
Contributor

🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-22696/wasm-skia-net9/index.html

Copy link
Contributor

Copilot AI commented Mar 3, 2026

@spouliot I've opened a new pull request, #22768, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI and others added 2 commits March 3, 2026 19:49
…pture

Co-authored-by: spouliot <260465+spouliot@users.noreply.github.com>
fix: eliminate race condition in HotReloadAgent.ApplyUpdatedTypes _handlerActions capture
Copilot AI review requested due to automatic review settings March 3, 2026 19:51
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (1)

src/Uno.UI.RemoteControl/HotReload/MetadataUpdater/HotReloadAgent.cs:241

  • GetMetadataUpdateTypes(...) returns a non-null Type[], but it’s stored in a nullable local (Type[]? updatedTypes). This unnecessarily widens the nullability and makes it easier to accidentally introduce null handling later. Consider using a non-null local (var updatedTypes = ...) to match the method contract.
			Type[]? updatedTypes = GetMetadataUpdateTypes(deltas);

			handlerActions.ClearCache.ForEach(a => a(updatedTypes));
			handlerActions.UpdateApplication.ForEach(a => a(updatedTypes));

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI commented Mar 3, 2026

@spouliot I've opened a new pull request, #22771, to work on those changes. Once the pull request is ready, I'll request review from you.

@unodevops
Copy link
Contributor

🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-22696/wasm-skia-net9/index.html

Copilot AI and others added 2 commits March 3, 2026 20:13
…ngthPrefixedArray

Co-authored-by: spouliot <260465+spouliot@users.noreply.github.com>
fix: replace MemoryStream/BinaryWriter with BinaryPrimitives in GetLengthPrefixedArray
@unodevops
Copy link
Contributor

🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-22696/wasm-skia-net9/index.html

@unodevops
Copy link
Contributor

⚠️⚠️ The build 199540 has failed on Uno.UI - CI.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants