-
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
[release/9.0] Update HtmlAttributePropertyHelper
to correctly follow the MetadataUpdateHandlerAttribute
contract
#59908
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tmat
approved these changes
Jan 17, 2025
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
Open
3 tasks
Just merged 2 more fixes that should unblock CI |
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
Java tests unrelated |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area-mvc
Includes: MVC, Actions and Controllers, Localization, CORS, most templates
pending-ci-rerun
When assigned to a PR indicates that the CI checks should be rerun
Servicing-approved
Shiproom has approved the issue
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Backport of #58558 to release/9.0
/cc @MackinnonBuck
Update
HtmlAttributePropertyHelper
to correctly follow theMetadataUpdateHandlerAttribute
contractFixes an issue where, when running a Blazor, Razor Pages, or MVC app in .NET 9 via
dotnet watch
, a warning gets logged on each hot reload edit.Description
A change was made in the .NET 9 SDK that logs a warning at runtime when a type claiming to implement hot reload functionality does not correctly follow the
MetadataUpdateHandlerAttribute
contract. This change revealed that theHtmlAttributePropertyHelper
class had incorrectly implemented this contract since .NET 7 (since a warning was getting logged on each hot reload edit). Some customers also claim that this bug worsens hot reload performance by adding additional delays between hot reload edits, although this detail is only anecdotal.The fix is simple: Subtly change the signature of a method in the
HtmlAttributePropertyHelper
class to conform to the metadata update handler contract.Fixes https://github.com/dotnet/AspNetCore-ManualTests/issues/3202
Customer Impact
The biggest known impact is that Blazor, Razor Pages, and MVC apps running with
dotnet watch
will log a warning each time a hot reload edit is made.In addition, since the
HtmlAttributePropertyHelper
's reflection cache was not getting cleared after a hot reload edit, certain hot reload edits may either 1) not apply or 2) cause an exception to get thrown (especially when utilizing theHtmlHelper.AnonymousObjectToHtmlAttributes()
API). We don't currently have data on how common that particular issue is in practice. This would have been an issue since .NET 7.Some customers also claim that this bug worsens hot reload performance, but this detail is only anecdotal.
Regression?
The newly-logged warning is a regression from .NET 8.
However, the reflection cache failing to clear is not a regression, as this has been an issue since hot reload support was initially added for this type in .NET 7. However, it's not clear what the customer impact of this problem is.
Risk
The change is extremely trivial. Manual testing vendors have validated that the fix resolves the warning.
Verification
Packaging changes reviewed?