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

Adjust Hot Reload for iOS/Catalyst/Android #15918

Open
jeromelaban opened this issue Mar 18, 2024 · 4 comments
Open

Adjust Hot Reload for iOS/Catalyst/Android #15918

jeromelaban opened this issue Mar 18, 2024 · 4 comments
Assignees
Labels
area/hot-reload Categorizes an issue or PR as relevant to hot reload difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. kind/enhancement New feature or request

Comments

@jeromelaban
Copy link
Member

jeromelaban commented Mar 18, 2024

What would you like to be added

C# Hot Reload for iOS/Catalyst fails with:

Cannot register two managed types ('unoapp.MainPage#2, unoapp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' and 'unoapp.MainPage#1, unoapp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null') with the same native name ('unoapp_MainPage').

While this particular validation does not happen in Android, this fails with iOS/Catalyst.

This particular behavior is handled by the source generator here:

var registerParamApple = _isHotReloadEnabled
? $"\"{typeSymbol.GetFullMetadataName(forRegisterAttributeDotReplacement: '_')}\""

And to work around it, we'll need to avoid using the CreateNewOnMetadataUpdate and rely on the newest Roslyn to handle lambda captures.

Additional information

The only catch for this feature is MetadataUpdateHanders not being supported yet on VS 2022 for iOS/Android (this, this), and updatedTypes not working on wasm (this), which means we still need a way to detect updated types.

Possibly, we could generate internal CreateNewOnMetadataUpdateAttribute tagged empty types that mirror the original modified types, so that we can determine what was actually changed and raise MetadataUpdateHandlers in Partial Reload.

Update: Android randomly fails for a similar reason, where duplicate types are not handled properly by the runtime.

@jeromelaban jeromelaban added kind/enhancement New feature or request difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. area/hot-reload Categorizes an issue or PR as relevant to hot reload labels Mar 18, 2024
@codesquatch
Copy link

@jeromelabanGiven that dotnet/runtime#93860 has been merged and you've confirmed Hot Reloading is working on that thread, do you have an expected release date for C# Markup Hot Reloading for iOS and Android apps?

@jeromelaban
Copy link
Member Author

@codesquatch Android should work better, though there's a fix that coming in the next release, iOS is still pending this specific issue.

@codesquatch
Copy link

codesquatch commented Jun 28, 2024

@jeromelaban Appreciate the quick response. Unfortunately Hot Reloading is not working for me even on the Android simulator. I'm on Mac OS, VS Code with Uno Platform extension installed and used to build/debug on a Pixel_3a_API_34. I'm using C# Markup instead of XAML for the UI.

@jeromelaban
Copy link
Member Author

jeromelaban commented Jun 28, 2024

Thanks. Note that hot reload on android only works when the debugger is not attached. We're waiting on this issue which should improve the story with the debugger on vscode (even if the issue is about VS windows).

@jeromelaban jeromelaban changed the title Adjust Hot Reload for iOS/Catalyst Adjust Hot Reload for iOS/Catalyst/Android Jul 16, 2024
@Youssef1313 Youssef1313 self-assigned this Jul 16, 2024
@dr1rrb dr1rrb mentioned this issue Dec 5, 2024
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/hot-reload Categorizes an issue or PR as relevant to hot reload difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. kind/enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants