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

Add support for tag helper checksums #9018

Merged
merged 15 commits into from
Aug 1, 2023

Conversation

DustinCampbell
Copy link
Member

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.

@DustinCampbell DustinCampbell requested review from a team as code owners July 24, 2023 19:31
Copy link
Member

@davidwengier davidwengier left a 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.

@DustinCampbell
Copy link
Member Author

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.

I expect to eventually move the checksum calculations directly onto the tag helper classes.

Copy link
Member

@333fred 333fred left a 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.

using System.IO;
#if NETCOREAPP
using System.Runtime.CompilerServices;
#endif
Copy link
Member Author

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.

Copy link
Member

@davidwengier davidwengier Aug 1, 2023

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.

Copy link
Member

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?

Copy link
Member Author

@DustinCampbell DustinCampbell Aug 1, 2023

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.

Copy link
Member

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
Copy link
Member Author

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.

@DustinCampbell
Copy link
Member Author

@333fred: Let me know if you have further feedback. I believe that I've addressed all of your concerns.

Copy link
Member

@333fred 333fred left a 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.

@DustinCampbell DustinCampbell merged commit 3667367 into dotnet:main Aug 1, 2023
@ghost ghost added this to the Next milestone Aug 1, 2023
@Cosifne Cosifne modified the milestones: Next, 17.8 P3 Sep 25, 2023
@DustinCampbell DustinCampbell deleted the tag-helper-checksums branch April 23, 2024 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants