Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 89864

Problem using Tasks with Spinners and Unit Tests

$
0
0

Hi, I'm having trouble with showing a spinner/running a unit test. My unit test seems to fail due to Xamarin not supporting Task.Run()? If I uncomment the Task.Run out then the test completes successfully but my spinner doesn't show initially when I want it to, i.e. immediately after a button click.

My SomeCodeAsync method contains an API call which retries if it fails the first time and it was this which forced my hand into using the Task.Run().

Button click event...
//Show loading spinner
LoadingVisible = true;

await Task.Run(async () =>
{
     await SomeAsyncTask();                
});

This is just massively frustrating, can anybody please advise on what options I have to solve this?
Thanks


Viewing all articles
Browse latest Browse all 89864

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>