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

[X] simpilfy and avoid duplication in conversion #7143

Merged
merged 2 commits into from
Aug 5, 2022
Merged

Conversation

StephaneDelcroix
Copy link
Contributor

Description of Change

Simplify, and unify in a single place, the way we look for
TypeConverters on BP, properties, and type.

Remove a unused IValueProvider, fix code here and there

Simplify, and unify in a single place, the way we look for
TypeConverters on BP, properties, and type.

Remove a unused IValueProvider, fix code here and there
@@ -6,9 +6,7 @@
namespace Microsoft.Maui.Controls
{
/// <include file="../../../docs/Microsoft.Maui.Controls/PropertyCondition.xml" path="Type[@FullName='Microsoft.Maui.Controls.PropertyCondition']/Docs" />
[ProvideCompiled("Microsoft.Maui.Controls.XamlC.PassthroughValueProvider")]
[AcceptEmptyServiceProvider]
public sealed class PropertyCondition : Condition, IValueProvider
Copy link
Contributor Author

@StephaneDelcroix StephaneDelcroix May 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no longer need to be IValueProvider (value conversion is done when setting the properties)

if (converterException != null && _hasdark)
binding.Dark = Dark.ConvertTo(propertyType, minforetriever, serviceProvider, out converterException);
if (converterException != null && _hasdefault)
binding.Default = Default.ConvertTo(propertyType, minforetriever, serviceProvider, out converterException);
Copy link
Contributor Author

@StephaneDelcroix StephaneDelcroix May 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this block was never executed

@Eilon Eilon added the legacy-area-perf Startup / Runtime performance label May 13, 2022
@rmarinho rmarinho requested review from mattleibow and Redth May 23, 2022 14:10
@rmarinho rmarinho merged commit b8ec9fb into main Aug 5, 2022
@rmarinho rmarinho deleted the fix_converters branch August 5, 2022 10:06
Eilon added a commit that referenced this pull request Aug 8, 2022
In this PR: #7143

Some code was removed that sets 'propertyType' based on some logic. That code is now gone and 'propertyType' is always null, which later causes a NullRef here:

Microsoft.Maui.Controls.Xaml.TypeConversionExtensions.ConvertTo(object value = ...value.., System.Type toType = null, System.Func<System.ComponentModel.TypeConverter> getConverter = {Method = {System.Reflection.RuntimeMethodInfo}}, System.IServiceProvider serviceProvider = {Microsoft.Maui.Controls.Xaml.Internals.XamlServiceProvider}, out System.Exception exception = null) Line 275
mattleibow added a commit that referenced this pull request Aug 9, 2022
mattleibow added a commit that referenced this pull request Aug 9, 2022
Simplify, and unify in a single place, the way we look for
TypeConverters on BP, properties, and type.

Remove a unused IValueProvider, fix code here and there

Co-authored-by: Matthew Leibowitz <mattleibow@live.com>
@mattleibow
Copy link
Member

Cherry picked to a new branch awaiting the XAML healer: https://github.com/dotnet/maui/tree/dev/reland-7143

@github-actions github-actions bot locked and limited conversation to collaborators Dec 21, 2023
@Eilon Eilon added the t/perf The issue affects performance (runtime speed, memory usage, startup time, etc.) label May 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
fixed-in-7.0.0-rc.1.6683 legacy-area-perf Startup / Runtime performance t/perf The issue affects performance (runtime speed, memory usage, startup time, etc.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants