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

fix: Fix regression in XAML Trimming #18658

Merged
merged 1 commit into from
Nov 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading