From d34d6372f1e5216dbbdc55a797555187b6d6de8a Mon Sep 17 00:00:00 2001 From: LalithaNadimpalli Date: Wed, 7 Sep 2022 11:10:27 -0700 Subject: [PATCH] AttachedDropShadowCrashFix Adding a null reference check to AttachedDropShadow crash issue --- Microsoft.Toolkit.Uwp.UI/Shadows/AttachedShadowBase.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Microsoft.Toolkit.Uwp.UI/Shadows/AttachedShadowBase.cs b/Microsoft.Toolkit.Uwp.UI/Shadows/AttachedShadowBase.cs index b78e2a771fc..dccd84e2121 100644 --- a/Microsoft.Toolkit.Uwp.UI/Shadows/AttachedShadowBase.cs +++ b/Microsoft.Toolkit.Uwp.UI/Shadows/AttachedShadowBase.cs @@ -174,9 +174,12 @@ public AttachedShadowElementContext GetElementContext(FrameworkElement element) /// public IEnumerable EnumerateElementContexts() { - foreach (var kvp in ShadowElementContextTable) + if (ShadowElementContextTable != null) { - yield return kvp.Value; + foreach (var kvp in ShadowElementContextTable) + { + yield return kvp.Value; + } } }