-
Notifications
You must be signed in to change notification settings - Fork 196
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
Remove ItemCollection from TagHelperDescriptorProviderContext #10720
Merged
DustinCampbell
merged 8 commits into
dotnet:main
from
DustinCampbell:remove-item-collection
Aug 12, 2024
Merged
Remove ItemCollection from TagHelperDescriptorProviderContext #10720
DustinCampbell
merged 8 commits into
dotnet:main
from
DustinCampbell:remove-item-collection
Aug 12, 2024
Commits on Aug 8, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 53ec3ab - Browse repository at this point
Copy the full SHA 53ec3abView commit details -
Make Compilation a TagHelperDescriptorProviderContext property
Every single `TagHelperDescriptorProviderContext` created in Razor compiler or tooling code adds a valid compilation. So, adding the compilation to the `ItemsCollection` is pure overhead and no `ITagHelperDescriptorProvider` needs to check it for null. I removed a single test that verified the behavior if a compilation was never set. Now that a compilation is required, this test is no longer needed.
Configuration menu - View commit details
-
Copy full SHA for adff92a - Browse repository at this point
Copy the full SHA adff92aView commit details -
Configuration menu - View commit details
-
Copy full SHA for ec5cd16 - Browse repository at this point
Copy the full SHA ec5cd16View commit details -
Remove TagHelperDescriptorProviderContext.Items property
This can be safely removed now that there are no more references.
Configuration menu - View commit details
-
Copy full SHA for 45625bc - Browse repository at this point
Copy the full SHA 45625bcView commit details -
Configuration menu - View commit details
-
Copy full SHA for 9476634 - Browse repository at this point
Copy the full SHA 9476634View commit details -
Configuration menu - View commit details
-
Copy full SHA for eae0d53 - Browse repository at this point
Copy the full SHA eae0d53View commit details -
Clean up all ITagHelperDescriptorProviders a bit (and found a bug!)
- Enable nullability - Mark all as sealed - Use `Lazy<T>` for singleton `ITagHelperDescriptorProviders` - Introduce `TagHelperDescriptorProviderBase` - Inherit from `TagHelperDescriptorProviderBase` - Remove unnecessary properties - Remove unnecessary property setters In addition, I spotted a bug in `EventHandlerTagDescriptorProvider` while addressing nullability warnings. The buggy code is right here: https://github.com/dotnet/razor/blob/fb84ae5d9bb8132972c2c23cf209721161f81deb/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/CSharp/EventHandlerTagHelperDescriptorProvider.cs#L70-L76 When reading the constructor arguments of an `EventHandlerAttribute` it appears that we swap the last two arguments of the 4-argument variant. The constructor is defined like so: ```C# EventHandlerAttribute(string attributeName, Type eventArgsType, bool enableStopPropagation, bool enablePreventDefault); ``` Unfortunately, the compiler reads the third parameter as `enablePreventDefaeult` and the fourth parameter as `enableStopPropagation`. This has been broken since support for the 4-argument constructor variant was added in dotnet@7635bba. Fixing this bug is tracked by dotnet#10497.
Configuration menu - View commit details
-
Copy full SHA for 5fbfc0d - Browse repository at this point
Copy the full SHA 5fbfc0dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 9f6c7b6 - Browse repository at this point
Copy the full SHA 9f6c7b6View commit details
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.