How to debug context.GetAppAndOptionalStorePackageUpdatesAsync() method.

Jignesh Desai 106 Reputation points
2025-01-16T08:55:15.58+00:00

Hi

Original question asked was here, but i am being redirect to this forum.


Very basic thing I want to do is to check if there is new version of app available during debugging.

App was installed from the store long back and hence call to other store api works properly during debugging session.

Lets assume in the store current stable version is 2.1.2.0. Now in order to test below line of code during debugging, what i did was, manually changed package version number in Package.appxmanifest file to 1.1.0.0 before starting a debug session.

IReadOnlyList<StorePackageUpdate> updates = await context.GetAppAndOptionalStorePackageUpdatesAsync();

 if (updates.Count > 0)

 {

     StorePackageUpdate update = updates[0]; // Assuming single main package

     PackageVersion storePackageVersion = update.Package.Id.Version;

     string storeVersion = $"{storePackageVersion.Major}.{storePackageVersion.Minor}.{storePackageVersion.Build}.{storePackageVersion.Revision}";

}

But to my surprise string storeVersion always return 1.1.0.0. The call to store API "GetAppAndOptionalStorePackageUpdatesAsync" should get data from Microsoft Store, but for some reason it does not. Is this a bug ?

Regards

Microsoft Partner Center API
Microsoft Partner Center API
Microsoft Partner Center: A Microsoft website for partners that provides access to product support, a partner community, and other partner services.API: A software intermediary that allows two applications to interact with each other.
363 questions
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.