-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
Add support for updatedTypes in metadata updates #55347
Add support for updatedTypes in metadata updates #55347
Conversation
Note, I'm not sure how to test this properly on the CI's side, considering it requires an integration from the SDK as well. Thanks for the reviews! |
@@ -43,7 +43,7 @@ internal static async Task InitializeAsync() | |||
/// For framework use only. | |||
/// </summary> | |||
[JSInvokable(nameof(ApplyHotReloadDelta))] | |||
public static void ApplyHotReloadDelta(string moduleIdString, byte[] metadataDelta, byte[] ilDelta, byte[] pdbBytes) | |||
public static void ApplyHotReloadDelta(string moduleIdString, byte[] metadataDelta, byte[] ilDelta, byte[] pdbBytes, int[] updatedTypes) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure how the public API policy works here. The JS invoker will likely be able to invoke the method without a type, but there may be a need for a separate method that matches previous versions of VS (which injects the browserlink payload).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than having two separate methods, could we allow the updatedTypes
parameter to be an int[]?
? It seems like this logic should still work even if the updated types are not provided by the scripts injected by the SDK. And we could make updated Blazor._internal.applyHotReload
implementation pass updatedTypes ?? null
in the call to dispatcher.invokeDotNetStaticMethod
.
This is technically a breaking API change, but that should be fine in this case because the API is meant for framework use only (customers should not be relying on it).
If you are able to open the solution in VS, there should be a codefix to update the PublicAPI.*.txt
files to reflect the public API changes. If you don't have this set up, I'd be happy to update those files and add the changes to this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review! I was indeed able to run the code fix, it added an entry in the unshipped file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution, @jeromelaban!
Note, I'm not sure how to test this properly on the CI's side, considering it requires an integration from the SDK as well. Thanks for the reviews!
We should be able to merge each PR separately without breaking things. If the code in this PR accounts for the possibility that updatedTypes
is null
, then we should be able to merge it before we merge the change in the SDK.
Have you been able to manually verify the changes from both PRs end-to-end?
@@ -43,7 +43,7 @@ internal static async Task InitializeAsync() | |||
/// For framework use only. | |||
/// </summary> | |||
[JSInvokable(nameof(ApplyHotReloadDelta))] | |||
public static void ApplyHotReloadDelta(string moduleIdString, byte[] metadataDelta, byte[] ilDelta, byte[] pdbBytes) | |||
public static void ApplyHotReloadDelta(string moduleIdString, byte[] metadataDelta, byte[] ilDelta, byte[] pdbBytes, int[] updatedTypes) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than having two separate methods, could we allow the updatedTypes
parameter to be an int[]?
? It seems like this logic should still work even if the updated types are not provided by the scripts injected by the SDK. And we could make updated Blazor._internal.applyHotReload
implementation pass updatedTypes ?? null
in the call to dispatcher.invokeDotNetStaticMethod
.
This is technically a breaking API change, but that should be fine in this case because the API is meant for framework use only (customers should not be relying on it).
If you are able to open the solution in VS, there should be a codefix to update the PublicAPI.*.txt
files to reflect the public API changes. If you don't have this set up, I'd be happy to update those files and add the changes to this PR.
Co-authored-by: Mackinnon Buck <mackinnon.buck@gmail.com>
@MackinnonBuck I just saw that I missed part of your question. I have not been able to validate the changes end-to-end, as it requires a change that I cannot make in visual studio. |
It's possible to verify the changes via @jeromelaban, could you provide some clarity on what the motivating scenario for this fix is (i.e., does it benefit Uno)? That will help us prioritize getting this PR tested and merged. Blazor WebAssembly shouldn't really be impacted by this bug today, since its built-in metadata update handlers don't rely on the |
Thanks!
This is impacting us because of the way we detect updated types to perform selective hot reload. We need to know which types have been changed in order to change displayed elements specifically based on their types (particularly for C# markup). Currently, we're using a process that scans the whole set of loaded types in the AppDomain in order to find types tagged with |
Thanks for the info @jeromelaban, that helps a lot. We currently have some other high-priority items that need to be addressed in the short-term, but I'll optimistically slot this into .NET 9 preview 7 for planning. |
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
Add support for
updatedTypes
in metadata updatesDescription
This PR passes along the updateTypes parameter from browserlink, in order for the MetadataUpdateHandler types to be invoked properly.
Related to #52937, corresponding sdk PR: dotnet/sdk#40416