Desktop Bridge app got an error code when request update: 0x769e4192

Victor Chen 106 Reputation points
2020-04-30T01:18:13.78+00:00

The following is the code I refer to here and here. btnRequestUpdate_Click can be executed and can correctly ask me if I need to download the update, when I click "OK", I will get an error: "0x769e4192 (located in appName.exe) exception: Microsoft C++ exception: winrt::hresult_error, located in memory location 0x06a8f0a0"

I tried to use RequestDownloadStorePackageUpdatesAsync, but got the same error.

So how can I solve this problem? thanks a lot.

[ComImport]
[Guid("3E68D4BD-7135-4D10-8018-9FB6D9F33FA1")]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IInitializeWithWindow
{
    void Initialize(IntPtr hwnd);
}

private async void btnRequestUpdate_Click(object sender, RoutedEventArgs e)
{
    var context = StoreContext.GetDefault();
    IInitializeWithWindow initWindow = (IInitializeWithWindow)(object)context;
    initWindow.Initialize(System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle);

    IReadOnlyList<StorePackageUpdate> storePackageUpdates =
        await context.GetAppAndOptionalStorePackageUpdatesAsync();
    if (storePackageUpdates.Count == 0) return;
    IAsyncOperationWithProgress<StorePackageUpdateResult, StorePackageUpdateStatus> downloadOperation =
        context.RequestDownloadAndInstallStorePackageUpdatesAsync(storePackageUpdates);
    downloadOperation.Progress = (asyncInfo, progress) =>
    {
        Consolo.WriteLine($"progress: {progress}");
    };
}
Universal Windows Platform (UWP)
{count} votes