When using async Methods of PCLStorage there is a strange behaviour on UWP.
In the Constructor of App I have to load a json file by PCLStorage. The first file Operation is a CheckFileAsync. As the App constructor is not an async method (it's ok if it blocks for a moment) I first tried this:
var catalogue =FreshTinyIOCBuiltIn.Current.Resolve<IStorageManager>().GetCatalogue(null).Result;
Which works fine on Android. But on UWP it blocks completely and never comes back.
If I do it this way:
Catalogue catalogue = null;
var t = Task.Run(async () =>
{
catalogue = await FreshTinyIOCBuiltIn.Current.Resolve<IStorageManager>().GetCatalogue(null);
});
t.Wait();
Everything is fine. What is the reason for this?