-
Notifications
You must be signed in to change notification settings - Fork 199
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 tag helper checksums #9018
Add support for tag helper checksums #9018
Conversation
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 reviewed the bits I understood 👍
Would be interesting to see how hard it would be to use reflection to iterate through tag helper descriptor properties, setting random values, and making sure the checksum changes at each step, to protect against someone forgetting to change this code when new properties are added.
src/Razor/src/Microsoft.AspNetCore.Razor.ProjectEngineHost/CompilationTagHelperResolver.cs
Show resolved
Hide resolved
...hared/Microsoft.AspNetCore.Razor.Utilities.Shared/PooledObjects/PooledDictionaryBuilder`2.cs
Show resolved
Hide resolved
I expect to eventually move the checksum calculations directly onto the tag helper classes. |
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.
Couple of small comments.
...enchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/Checksums/TagHelperChecksumBenchmark.cs
Outdated
Show resolved
Hide resolved
src/Razor/src/Microsoft.AspNetCore.Razor.ProjectEngineHost/Utilities/Checksum.cs
Outdated
Show resolved
Hide resolved
src/Razor/src/Microsoft.AspNetCore.Razor.ProjectEngineHost/Utilities/Checksum.cs
Outdated
Show resolved
Hide resolved
src/Razor/src/Microsoft.AspNetCore.Razor.ProjectEngineHost/Serialization/JsonDataWriter.cs
Outdated
Show resolved
Hide resolved
using System.IO; | ||
#if NETCOREAPP | ||
using System.Runtime.CompilerServices; | ||
#endif |
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.
@davidwengier: Just wanted to note that this is now necessary due to #9014. Not sure if you expected that for multi-targeted projects.
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 hit something similar in that PR, but decided to push on since it was only one case. If it becomes more prevalent or annoying to you, I have no objection to relaxing the rules again.
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.
Why is this necessary? Is one TFM including a global using the other isn't?
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.
This using brings in MemoryMarshal
for the #if NETCOREAPP
code below, so it's unneeded on other TFMs.
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.
Ah, gotcha.
using System; | ||
#if !NETCOREAPP | ||
using System.Collections.Generic; | ||
#endif |
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.
@davidwengier: Just wanted to note that this is now necessary due to #9014. Not sure if you expected that for multi-targeted projects.
@333fred: Let me know if you have further feedback. I believe that I've addressed all of your concerns. |
src/Razor/src/Microsoft.AspNetCore.Razor.ProjectEngineHost/Utilities/Checksum.HashData.cs
Outdated
Show resolved
Hide resolved
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.
Generally LGTM. Couple of small questions, but nothing blocking merge.
This pull request adds a generalized checksum system based on SHA-256 and derived from a similar system employed in Roslyn. This system isn't used yet, but subsequent PRs will take advantage of checksums to dedupe tag helpers and avoid reconstituting them when unnecessary during serialization.