-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Use MetadataUpdateHandlerAttribute in Blazor #31817
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
Conversation
pranavkm
commented
Apr 14, 2021
- Annotate HotReloadManager to use the new attribute
- Add support for invoking the new attribute in WASM's hot reload
Ignore this. Our targets had a bug @Eilon I'm seeing an error building the Wpf app that suggests it's using an older targeting pack:
Just making sure it's not intentionally pointing to an older version. |
FYI @stephentoub |
eng/Workarounds.targets
Outdated
@@ -4,7 +4,7 @@ | |||
<!-- Reference base shared framework at incoming dependency flow version, not bundled sdk version. --> | |||
<FrameworkReference | |||
Update="Microsoft.NETCore.App" | |||
Condition=" '$(TargetFramework)' == '$(DefaultNetCoreTargetFramework)' AND '$(TargetLatestDotNetRuntime)' != 'false' " | |||
Condition=" (('$(TargetFramework)' == '$(DefaultNetCoreTargetFramework)') OR ('$(TargetFramework)' == '$(DefaultNetCoreTargetFramework)-windows')) AND '$(TargetLatestDotNetRuntime)' != 'false' " |
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.
Is this change related to #31817 (comment)? Maybe add a comment to clarify it here...
_handlerActions ??= GetMetadataUpdateHandlerActions(); | ||
var (beforeUpdates, afterUpdates) = _handlerActions.Value; | ||
|
||
beforeUpdates.ForEach(a => a(null)); |
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.
So, if I understand correctly beforeUpdates
and afterUpdates
are handlers that can be invoked before and after deltas are applied. What are some scenarios where they are used?
Also -- why does this take a null value instead of just being a parameterless method?
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.
What are some scenarios where they are used?
e.g. to clear corelib's reflection cache, to clear JsonSerializer's cache of reflection data, to refresh a binding in a UI, etc.
why does this take a null value instead of just being a parameterless method?
The plan is for the agent to pass an array of the types being updated, if available, but we don't have that information yet. The pattern will likely evolve over the next few months as we find out more about what various handlers need.
* Annotate HotReloadManager to use the new attribute * Add support for invoking the new attribute in WASM's hot reload
836ed82
to
3f7e920
Compare
Hello @pranavkm! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
@pranavkm Since I was out last week I missed whatever design discussions brought us here. It all looks good, but can I check my understanding of the high-level idea is correct? It looks as if:
If this is correct, it's totally fine, though there is of course a concern that different app frameworks might not all implement it in the same way. Not a massive issue but was there consideration given to putting this logic inside To be super clear I'm [update] not suggesting this is a problem - this is just me trying to get in sync with the groupthink on this subject. |
Is this missing a "not"? 😄
Each agent is. Some app models will have their own, some will share.
Yes, I'd actually suggested we do this. There was some concern expressed (I believe by @jkotas?) that this would tie the runtime too much to the specific pattern and make it harder to evolve. The attribute in the core library just specifies the type that implements the pattern, but doesn't dictate its shape. @jkotas? (As an aside, we need to lock down soon on the initial shape of the pattern. I'll open an issue for that.) |
Hi @stephentoub. It looks like you just commented on a closed PR. The team will most probably miss it. If you'd like to bring something important up to their attention, consider filing a new issue and add enough details to build context. |
Yes, sorry! Updated. Thanks for the additional info. |
Yes, see dotnet/runtime#49361 (comment) and other comments in that issue.
Nit: Assemblies that target netstandard should be able define a local copy of the attribute if they need to. |
Hi @jkotas. It looks like you just commented on a closed PR. The team will most probably miss it. If you'd like to bring something important up to their attention, consider filing a new issue and add enough details to build context. |