I want to have a method (Let's call it M1) execute some async
code in a loop (Let's call that second method M2). On every iteration - the UI should be updated with the result of M2.
In order to await M2, M1 needs to be async
. But M1 should run on the UI thread (to avoid race conditions) and therefore it will be called without an await
.
Am I correct in thinking that in this way, M1's updating of the UI will be on the UI thread?
(Extra: It seems OK to have an async void
in this case. Is this correct?)