A Microsoft platform for building and publishing apps for Windows devices.
Hello, Welcome to Micorosoft Q&A,
But I can't await in an unsafe context.
I'm afraid you can't use await in unsafe block and it is by design. for your requirement, we suggest get the file synchronization like the following,
private unsafe void LoadMethod()
{
var file = Getfile().Result;
}
private Task<StorageFile> Getfile()
{
return Task.Run(async () =>
{
return await Package.Current.InstalledLocation.GetFileAsync("items");
});
}
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.