From dfcd7b00f6acd3f5337cb04aa7498559069b24a6 Mon Sep 17 00:00:00 2001 From: Davide Giacometti Date: Fri, 21 Jul 2023 16:54:16 +0200 Subject: [PATCH] fix startup crash --- Main.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Main.cs b/Main.cs index ed86faf..a54b757 100644 --- a/Main.cs +++ b/Main.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation +// Copyright (c) Microsoft Corporation // The Microsoft Corporation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. @@ -65,8 +65,6 @@ public partial class Main : IPlugin, IPluginI18n, IContextMenu, ISettingProvider // constructor public Main() { - GetPackages(); - LoadInstalledList(); } private static void LoadInstalledList() @@ -102,7 +100,7 @@ public class WingetPackage public string Version { get; set; } } - private static async void GetPackages() + private static async Task GetPackagesAsync() { // Download packages list var packages = new List(); @@ -199,6 +197,9 @@ public void Init(PluginInitContext context) $"Plugin: {Properties.Resources.plugin_name}", errorMsgString); }; + + GetPackagesAsync().Wait(); + LoadInstalledList(); } public static void Winget(string cmd)