-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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 assembly scanning from VisualTypeConverter #5102
Remove assembly scanning from VisualTypeConverter #5102
Conversation
// Check for visual assembly attributes after scanning for IVisual Types | ||
// this will let users replace the default visual names if they want to |
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 comment could use some updating, since we don't "scan for IVisual Types" anymore, so it isn't checked "after" anymore.
@@ -54,6 +55,8 @@ public void Register(Type tview, Type trender, Type[] supportedVisuals, short pr | |||
} | |||
else | |||
visualRenderers[supportedVisuals[i]] = (trender, priority); | |||
|
|||
RegisterVisual(supportedVisuals[i]); |
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.
You are probably getting ILLink warnings here since the supportedVisuals[i]
isn't annotated as PublicParameterlessConstructor
.
name = name.Substring(0, name.Length - 6); | ||
fullName = fullName.Substring(0, fullName.Length - 6); |
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.
Can we use ReadOnlySpan<char>
and Slice here instead? Then below, when doing the comparisons, use SequenceEqual
instead of ==
.
And also not creating a new string appending Visual
below. Just slice off "Visual" from visualName
.
string name = visualType.Name; | ||
string fullName = visualType.FullName; | ||
|
||
if (name.EndsWith("Visual", StringComparison.OrdinalIgnoreCase)) |
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.
It's odd that we use IgnoreCase here, but don't do IgnoreCase below when comparing visualName == $"{name}Visual"
Description of Change
builder.RegisterVisual
inside theMicrosoft.Maui.Controls.Compatibility.Hosting
namespace so 3rd party libraries can register visuals as part of their builder codeIssues Fixed
Fixes #4937