-
Notifications
You must be signed in to change notification settings - Fork 17
Load controls if they have tag prefixes #407
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
| } | ||
|
|
||
| AppDomain.CurrentDomain.AssemblyLoad += CurrentDomain_AssemblyLoad; | ||
| private void Initialize() |
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 couldn't figure out how to lazily load them since we need to actually load them into the current context without cycles... so I removed the lazily initialization
|
let me take this change locally and test the ajax toolkit controls before shipping... |
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.
PR Overview
This PR implements a new mechanism for loading controls by detecting assemblies with tag prefixes. Key changes include:
- Replacing the lazy-loaded assembly management with immediate initialization and control scanning in DynamicControlCollection.
- Updating the attribute lookup in WebForms-related files to use a generic extension method (HasAttribute).
- Adjusting the StaticControlCollection to use the generic attribute check and marking helper methods as static.
Reviewed Changes
| File | Description |
|---|---|
| src/Compiler.Dynamic/DynamicControlCollection.cs | Refactors assembly loading by introducing Initialize, SearchForControls, and LoadMetadataReference methods, and switches to using ImmutableDictionary-based storage for controls and metadata references. |
| src/WebForms/AssemblyAttributeUtility.cs | Replaces the string-based attribute lookup with a new generic version for improved type-safety. |
| src/WebForms/PreApplicationStartMethodExtensions.cs | Updates the attribute check to use the new generic HasAttribute method. |
| src/Compiler.Dynamic/StaticControlCollection.cs | Updates the control scanning logic to use the generic HasAttribute method and marks the helper method static. |
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
src/Compiler.Dynamic/StaticControlCollection.cs:37
- [nitpick] The method HasTagPrefix was updated to be static; please ensure that all its call sites are correctly updated to reflect its static nature.
private static bool HasTagPrefix(AssemblyMetadata assembly)
too much verbose ... ha ha.. |
|
So we are able to detect the .Configure<IMetadataProvider>((options, metadata) =>
{
foreach (var control in metadata.ControlAssemblies)
{
foreach (var tag in control.GetCustomAttributes<TagPrefixAttribute>())
{
options.DefaultTagNamespaceRegisterEntries.Add(new(tag.TagPrefix, tag.NamespaceName, control.FullName));
}
}
}); |
|
It loads the WebForms.SqlClient library just fine this way so I do see it working. Can you create a branch that just works to try it out so I don't have to build extra things? i.e. include the .dll in the branch. I just want to just run it |
ok.. let me do that.. |
This reverts commit e80e171.
birojnayak
left a comment
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.
approving as it find controls with tag prefix on dll's. As discussed, we can incrementally see if rendering would work and take actions accordingly.
No description provided.