Skip to content

Commit

Permalink
Merge pull request #18661 from unoplatform/mergify/bp/release/stable/…
Browse files Browse the repository at this point in the history
…5.5/pr-18658

fix: Fix regression in XAML Trimming (backport #18658)
  • Loading branch information
jeromelaban authored Nov 2, 2024
2 parents ec99b3b + be00f29 commit ccf0614
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ where field.IsStatic
writer.AppendLineIndented("[global::System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Maintainability\", \"CA1505:AvoidUnmaintainableCode\", Justification = \"Must be ignored even if generated code is checked.\")]");
using (writer.BlockInvariant("internal static global::Uno.UI.DataBinding.IBindableType Build(global::Uno.UI.DataBinding.BindableType parent)"))
{
RegisterHintMethod($"MetadataBuilder_{typeInfo.Index:000}", ownerType, "global::Uno.UI.DataBinding.IBindableType Build(global::Uno.UI.DataBinding.BindableType)");
RegisterHintMethod($"MetadataBuilder_{typeInfo.Index:000}", ownerType, "Uno.UI.DataBinding.IBindableType Build(Uno.UI.DataBinding.BindableType)");

writer.AppendLineInvariantIndented(
@"var bindableType = parent ?? new global::Uno.UI.DataBinding.BindableType({0}, typeof({1}));",
Expand All @@ -327,7 +327,7 @@ where field.IsStatic
writer.AppendLineIndented(@"bindableType.AddActivator(CreateInstance);");
postWriter.AppendLineIndented($@"private static object CreateInstance() => new {ownerTypeName}();");

RegisterHintMethod($"MetadataBuilder_{typeInfo.Index:000}", ownerType, "global::System.Object CreateInstance()");
RegisterHintMethod($"MetadataBuilder_{typeInfo.Index:000}", ownerType, "System.Object CreateInstance()");
}
}

Expand All @@ -341,12 +341,12 @@ where field.IsStatic
writer.AppendLineIndented("bindableType.AddIndexer(GetIndexer, SetIndexer);");

postWriter.AppendLineIndented($@"private static object GetIndexer(object instance, string name) => (({ownerTypeName})instance)[name];");
RegisterHintMethod($"MetadataBuilder_{typeInfo.Index:000}", ownerType, "global::System.Object GetIndexer(global::System.Object, global::System.String)");
RegisterHintMethod($"MetadataBuilder_{typeInfo.Index:000}", ownerType, "System.Object GetIndexer(System.Object, System.String)");

if (property.SetMethod != null)
{
postWriter.AppendLineIndented($@"private static void SetIndexer(object instance, string name, object value) => (({ownerTypeName})instance)[name] = ({propertyTypeName})value;");
RegisterHintMethod($"MetadataBuilder_{typeInfo.Index:000}", ownerType, "global::System.Void SetIndexer(global::System.Object, global::System.String, global::System.Object)");
RegisterHintMethod($"MetadataBuilder_{typeInfo.Index:000}", ownerType, "System.Void SetIndexer(System.Object,System.String,System.Object)");
}
else
{
Expand Down Expand Up @@ -386,8 +386,8 @@ where field.IsStatic
postWriter.AppendLineIndented($@"private static void Set{propertyName}(object instance, object value, global::Microsoft.UI.Xaml.DependencyPropertyValuePrecedences? precedence) => (({ownerTypeName})instance).{propertyName} = ({propertyTypeName})value;");
}

RegisterHintMethod($"MetadataBuilder_{typeInfo.Index:000}", ownerType, $"global::System.Object Get{propertyName}(global::System.Object, global::System.Nullable`1<global::Microsoft.UI.Xaml.DependencyPropertyValuePrecedences>)");
RegisterHintMethod($"MetadataBuilder_{typeInfo.Index:000}", ownerType, $"global::System.Void Set{propertyName}(global::System.Object, global::System.Object, global::System.Nullable`1<global::Microsoft.UI.Xaml.DependencyPropertyValuePrecedences>)");
RegisterHintMethod($"MetadataBuilder_{typeInfo.Index:000}", ownerType, $"System.Object Get{propertyName}(System.Object,System.Nullable`1<Microsoft.UI.Xaml.DependencyPropertyValuePrecedences>)");
RegisterHintMethod($"MetadataBuilder_{typeInfo.Index:000}", ownerType, $"System.Void Set{propertyName}(System.Object,System.Object,System.Nullable`1<Microsoft.UI.Xaml.DependencyPropertyValuePrecedences>)");

}
else if (HasPublicGetter(property))
Expand All @@ -396,7 +396,7 @@ where field.IsStatic

postWriter.AppendLineIndented($@"private static object Get{propertyName}(object instance, global::Microsoft.UI.Xaml.DependencyPropertyValuePrecedences? precedence) => (({ownerTypeName})instance).{propertyName};");

RegisterHintMethod($"MetadataBuilder_{typeInfo.Index:000}", ownerType, $"global::System.Object Get{propertyName}(global::System.Object, global::System.Nullable`1<global::Microsoft.UI.Xaml.DependencyPropertyValuePrecedences>)");
RegisterHintMethod($"MetadataBuilder_{typeInfo.Index:000}", ownerType, $"System.Object Get{propertyName}(System.Object,System.Nullable`1<Microsoft.UI.Xaml.DependencyPropertyValuePrecedences>)");
}
}

Expand Down

0 comments on commit ccf0614

Please sign in to comment.