diff --git a/src/Controls/src/Core/Handlers/Items/Android/Adapters/ItemsViewAdapter.cs b/src/Controls/src/Core/Handlers/Items/Android/Adapters/ItemsViewAdapter.cs index 34dfa5981b4c..43408e333924 100644 --- a/src/Controls/src/Core/Handlers/Items/Android/Adapters/ItemsViewAdapter.cs +++ b/src/Controls/src/Core/Handlers/Items/Android/Adapters/ItemsViewAdapter.cs @@ -113,9 +113,7 @@ public override int GetItemViewType(int position) var id = template?.Id ?? ItemViewType.TemplatedItem; // Cache the data template for future use - if (!_viewTypeDataTemplates.ContainsKey(id)) - _viewTypeDataTemplates.Add(id, template); - + _viewTypeDataTemplates.TryAdd(id, template); return id; } diff --git a/src/Core/src/.editorconfig b/src/Core/src/.editorconfig index 61762f96e25f..55bb5ffa7e5e 100644 --- a/src/Core/src/.editorconfig +++ b/src/Core/src/.editorconfig @@ -16,5 +16,6 @@ dotnet_diagnostic.CA1846.severity = error dotnet_diagnostic.CA1847.severity = error dotnet_diagnostic.CA1859.severity = error dotnet_diagnostic.CA1860.severity = error +dotnet_diagnostic.CA1864.severity = error dotnet_diagnostic.CA1865.severity = error dotnet_diagnostic.CA2249.severity = error diff --git a/src/Core/src/VisualDiagnostics/VisualDiagnosticsOverlay.Windows.cs b/src/Core/src/VisualDiagnostics/VisualDiagnosticsOverlay.Windows.cs index df3f70a987dc..e78491f45b5f 100644 --- a/src/Core/src/VisualDiagnostics/VisualDiagnosticsOverlay.Windows.cs +++ b/src/Core/src/VisualDiagnostics/VisualDiagnosticsOverlay.Windows.cs @@ -20,9 +20,8 @@ public void AddScrollableElementHandler(IScrollView scrollBar) if (nativeScroll != null && nativeScroll is ScrollViewer viewer) { - if (!_scrollViews.ContainsKey(scrollBar)) + if (_scrollViews.TryAdd(scrollBar, viewer)) { - _scrollViews.Add(scrollBar, viewer); viewer.ViewChanging += OnViewChanging; } }