[NUI] Fix GetProperty ambiguousmatch exception
authorXianbing Teng <xb.teng@samsung.com>
Tue, 22 Feb 2022 08:04:00 +0000 (16:04 +0800)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Wed, 23 Feb 2022 08:21:36 +0000 (17:21 +0900)
src/Tizen.NUI/src/internal/EXaml/Operation/GatherProperty.cs

index 039e2e1..215e782 100755 (executable)
@@ -38,7 +38,23 @@ namespace Tizen.NUI.EXaml
         public void Do()
         {
             var type = globalDataList.GatheredTypes[typeIndex];
-            globalDataList.GatheredProperties.Add(type.GetProperty(propertyName));
+            PropertyInfo propertyInfo = null;
+            try
+            {
+                propertyInfo = type.GetProperty(propertyName);
+            }
+#pragma warning disable CA1031 // Do not catch general exception types
+            catch (Exception)
+#pragma warning restore CA1031 // Do not catch general exception types
+            {
+                propertyInfo = type.GetProperty(propertyName, BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.Instance);
+            }
+
+            if (null == propertyInfo)
+            {
+                throw new Exception($"Can't find property {propertyName} from type {type.FullName}");
+            }
+            globalDataList.GatheredProperties.Add(propertyInfo);
         }
 
         private int typeIndex;