Documentation and samples are available here [ LINK ]
AppSubmissionUpdateSample.cs is a popular sample code from microsoft store api. In my experiment i found that sample code work fine in C# console app, but not in C# UWP App.
eg.
In C# Console APP
// Get authorization token
Console.WriteLine("Getting authorization token ");
var accessToken = IngestionClient.GetClientCredentialAccessToken(
tokenEndpoint,
clientId,
clientSecret,
resourceOrScope).Result;
Above line works and fetches the results. but the same line of code, makes the application hang in C# UWP.
As a workaround i tried to rewrite the code in following way in C# UWP app, it then works, but i have no understanding why i am forced to use async/await, if anybody can explain to make me understand what's going on.
In C# UWP App
// Get authorization token
Console.WriteLine("Getting authorization token ");
var accessTokenX = IngestionClient.GetClientCredentialAccessToken(
tokenEndpoint,
clientId,
clientSecret,
resourceOrScope);
var accessToken = await accessTokenX; <----- forced to use async/await to work in UWP
Can anyone thow some light please. Thanks in advance.
Derive from document: Asynchronous programming
Each programming language supports the asynchronous pattern for the UWP in its own way: