Repository: unoplatform/uno
File: src/Uno.UI/UI/Xaml/FrameworkElementExtensions.cs (C#)

Code before:
		{
			PropertyInfo propertyInfo = null;
			var currentType = element.GetType();

			do
			{
				propertyInfo = GetProperty(currentType, property + "Property");

				if (propertyInfo == null)
				{
					currentType = currentType.GetTypeInfo().BaseType;
				}

			} while (currentType != null && propertyInfo == null);

			if (propertyInfo != null)
			{
				var dependencyProperty = (DependencyProperty)propertyInfo.GetMethod.Invoke(null, Array.Empty<object>());
				return dependencyProperty;
			}


			return null;

			[UnconditionalSuppressMessage("Trimming", "IL2070", Justification = "TODO")]
			[UnconditionalSuppressMessage("Trimming", "IL2075", Justification = "TODO")]
			static PropertyInfo GetProperty(Type type, string propertyName)
				=> type.GetTypeInfo().GetDeclaredProperty(propertyName);
		}

		public static T Binding<T>(this T element, string property, string propertyPath) where T : DependencyObject
		{
			var path = new PropertyPath(propertyPath.Replace("].[", "]["));
			var binding = new Microsoft.UI.Xaml.Data.Binding { Path = path };

			return element.Binding(property, binding);
		}

		public static Microsoft.UI.Xaml.Documents.Run Binding(
			this Microsoft.UI.Xaml.Documents.Run element,
			string property,
			string propertyPath
		)
		{
			propertyPath = propertyPath.Replace("].[", "][");

			if (property == "Text")
			{
				var templateString = "<Run xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\" Text=\"{{Binding {0}}}\" />";

				return (Microsoft.UI.Xaml.Documents.Run)Microsoft.UI.Xaml.Markup.XamlReader.Load(templateString.InvariantCultureFormat(propertyPath));

Review comment (suggestion):
```suggestion
			[UnconditionalSuppressMessage("Trimming", "IL2070", Justification = "Expected behavior, the XamltypeInfo generator takes care of this")]
			[UnconditionalSuppressMessage("Trimming", "IL2075", Justification = "Expected behavior, the XamltypeInfo generator takes care of this")]
```

Code after:
		{
			PropertyInfo propertyInfo = null;
			var currentType = element.GetType();

			do
			{
				propertyInfo = GetProperty(currentType, property + "Property");

				if (propertyInfo == null)
				{
					currentType = currentType.GetTypeInfo().BaseType;
				}

			} while (currentType != null && propertyInfo == null);

			if (propertyInfo != null)
			{
				var dependencyProperty = (DependencyProperty)propertyInfo.GetMethod.Invoke(null, Array.Empty<object>());
				return dependencyProperty;
			}


			return null;

			[UnconditionalSuppressMessage("Trimming", "IL2070", Justification = "`Uno.UI.SourceGenerators/BindableTypeProviders` / `BindableMetadata.g.cs` ensures the property exists.")]
			[UnconditionalSuppressMessage("Trimming", "IL2075", Justification = "`Uno.UI.SourceGenerators/BindableTypeProviders` / `BindableMetadata.g.cs` ensures the property exists.")]
			static PropertyInfo GetProperty(Type type, string propertyName)
				=> type.GetTypeInfo().GetDeclaredProperty(propertyName);
		}

		public static T Binding<T>(this T element, string property, string propertyPath) where T : DependencyObject
		{
			var path = new PropertyPath(propertyPath.Replace("].[", "]["));
			var binding = new Microsoft.UI.Xaml.Data.Binding { Path = path };

			return element.Binding(property, binding);
		}

		public static Microsoft.UI.Xaml.Documents.Run Binding(
			this Microsoft.UI.Xaml.Documents.Run element,
			string property,
			string propertyPath
		)
		{
			propertyPath = propertyPath.Replace("].[", "][");

			if (property == "Text")
			{
				var templateString = "<Run xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\" Text=\"{{Binding {0}}}\" />";

				return (Microsoft.UI.Xaml.Documents.Run)Microsoft.UI.Xaml.Markup.XamlReader.Load(templateString.InvariantCultureFormat(propertyPath));