Skip to content

Commit 0e5c530

Browse files
committed
fix: Return correct result of ApiInformation.IsPropertyPresent
- Previous implementation of several ApiInformation.IsXYZPresent methods returned false for their second query causing inconsistencies, now the logic returns the cached found type
1 parent c3bb057 commit 0e5c530

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/TabViewTests/TabViewBasicPage.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
</controls:TabViewItem>
1919
<controls:TabViewItem Header="Document 1">
2020
<controls:TabViewItem.IconSource>
21-
<controls:SymbolIconSource Symbol="Document" />
21+
<controls:BitmapIconSource ShowAsMonochrome="False" UriSource="/Assets/ingredient1.png" />
2222
</controls:TabViewItem.IconSource>
2323
</controls:TabViewItem>
2424
<controls:TabViewItem Header="Document 2">

src/Uno.Foundation/Metadata/ApiInformation.cs

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -110,23 +110,25 @@ public static bool IsEnumNamedValuePresent(string enumTypeName, string valueName
110110
{
111111
lock (_assemblies)
112112
{
113-
if (!_typeCache.TryGetValue(typeName, out var type))
113+
if (_typeCache.TryGetValue(typeName, out var type))
114114
{
115-
foreach (var assembly in _assemblies)
116-
{
117-
type = assembly.GetType(typeName);
115+
return type;
116+
}
118117

119-
if (type != null)
120-
{
121-
_typeCache[typeName] = type;
118+
foreach (var assembly in _assemblies)
119+
{
120+
type = assembly.GetType(typeName);
122121

123-
return type;
124-
}
122+
if (type != null)
123+
{
124+
_typeCache[typeName] = type;
125+
126+
return type;
125127
}
126128
}
127-
}
128129

129-
return null;
130+
return null;
131+
}
130132
}
131133

132134
internal static void TryRaiseNotImplemented(string type, string memberName)

src/Uno.UI/UI/Xaml/Controls/BitmapIcon.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ public partial class BitmapIcon : IconElement
1515
public BitmapIcon()
1616
{
1717
this.SetValue(ForegroundProperty, SolidColorBrushHelper.Black, DependencyPropertyValuePrecedences.Inheritance);
18-
1918
}
2019

2120
protected override Size MeasureOverride(Size availableSize)

0 commit comments

Comments
 (0)