-
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
Design time type converters are needed #18383
Comments
I would suggest we don't do this. And instead start using the runtime converters at design-time. So for example, we could unify:
The runtime one has a lot of performance work done, such as f8a272d. I would think the It feels a bit odd to implement 2x of every XAML converter. |
@jonathanpeppers Using runtime converters is fine as long as they behave correctly in "developer environment" processes like VS, VS Code LSP process, etc. Invoking TypeConverter.IsValid and CanConvertFrom should not throw and return correct result. If calling IsValid triggers loading MAUI netstandard 2.0 assemblies into "developer environment" process, then there should be guarantee that assemblies properly load without additional help from devenv process. Finally, those converters should still be exposed via RegisterMetadata as that is the only way to opt into loading arbitrary type converters. |
If the runtime converters don't work, that is even worse. That means it wouldn't work at runtime in a developer's app!
Can you explain this? Do we have documentation on how VS loads |
@etvorun thoughts? |
Hi @etvorun. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time. |
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. If it is closed, feel free to comment when you are able to provide the additional information and we will re-investigate. |
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. If it is closed, feel free to comment when you are able to provide the additional information and we will re-investigate. |
Description
[update] alternative approach is to update RegisterMetadata to use netsandart 2.0 type converters, the ones used during msbuild. We would need to make sure that NS2 assemblies are loaded into VS/VSCode process. Without XAML parser dealing with assembly loading.
MAUI provides a handful of type converters used by VS to validate XAML while user edits it, e.g. see ColorDesignTypeConverter. The converters are exposed to VS via RegisterMetadata class. Ideally all runtime type converters should have matching design time type converter. Here is a list of most important type converters which should have design time counterparts:
Microsoft.Maui.Controls.AcceleratorTypeConverter
Microsoft.Maui.Controls.Button.ButtonContentTypeConverter
Microsoft.Maui.Controls.BindablePropertyConverter
Microsoft.Maui.Controls.BoundsTypeConverter
Microsoft.Maui.Converters.ConstraintTypeConverter
Microsoft.Maui.Converters.CornerRadiusTypeConverter
Microsoft.Maui.Controls.FileImageSourceConverter
Microsoft.Maui.Controls.FontAttributesConverter
Microsoft.Maui.Controls.FontTypeConverter
Microsoft.Maui.Controls.ImageSourceConverter
Microsoft.Maui.Controls.ListStringTypeConverter
Microsoft.Maui.Graphics.Converters.PointTypeConverter
Microsoft.Maui.Graphics.Converters.RectTypeConverter
Microsoft.Maui.Controls.RDSourceTypeConverter
Microsoft.Maui.Controls.TextAlignmentConverter
Microsoft.Maui.Controls.TextDecorationConverter
Microsoft.Maui.Converters.ThicknessTypeConverter
Microsoft.Maui.Controls.UriTypeConverter
Microsoft.Maui.Controls.VisualElement.VisibilityConverter
Microsoft.Maui.Controls.WebViewSourceTypeConverter
Public API Changes
Implement and register design time type converters
Intended Use-Case
To be used by VS XAML editor as well as C# DevKit XAML editor
The text was updated successfully, but these errors were encountered: