From 12d725b6695a75e915461981840f8ed21db913b3 Mon Sep 17 00:00:00 2001 From: tznind Date: Tue, 30 Aug 2022 14:30:00 +0100 Subject: [PATCH] Add ToArray to prevent 'Collection has been modified' Exception in older runtimes --- Terminal.Gui/Core/View.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Terminal.Gui/Core/View.cs b/Terminal.Gui/Core/View.cs index 170289c7f8..e59ae60a67 100644 --- a/Terminal.Gui/Core/View.cs +++ b/Terminal.Gui/Core/View.cs @@ -1820,7 +1820,7 @@ public void ClearKeybinding (Key key) /// public void ClearKeybinding (params Command [] command) { - foreach (var kvp in KeyBindings.Where (kvp => kvp.Value.SequenceEqual (command))) { + foreach (var kvp in KeyBindings.Where (kvp => kvp.Value.SequenceEqual (command)).ToArray()) { KeyBindings.Remove (kvp.Key); } }