diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/TopLevelCommandManager.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/TopLevelCommandManager.cs index b4f6542c93..cf7954023f 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/TopLevelCommandManager.cs +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/TopLevelCommandManager.cs @@ -207,7 +207,10 @@ public partial class TopLevelCommandManager : ObservableObject, clone.InsertRange(startIndex, newItems); // now update the actual observable list with the new contents - ListHelpers.InPlaceUpdateList(TopLevelCommands, clone); + lock (TopLevelCommands) + { + ListHelpers.InPlaceUpdateList(TopLevelCommands, clone); + } } public async Task ReloadAllCommandsAsync()