Is there a reason why a coroutine lambda wouldn't be executed after launch is called on it? I have ...
t
Is there a reason why a coroutine lambda wouldn't be executed after launch is called on it? I have a KMP project and on iOS, the launch function is called, but the lambda isn't executed. I'm pulling at threads trying to figure out why this isn't working. I don't have any errors in my project when ran.
j
What dispatcher are you launching the coroutine in? It might be due to thread starvation
t
The viewModel just instantiates the scope using:
Copy code
val viewModelScope = MainScope()
I noticed just noticed that calling viewModelScope.isActive before I call launch returns false.
j
Do you have a small reproducible example you could share?
t
I think I see my problem. I believe that the viewModel is getting cleared before my call. That cancels the main scope.
👍 1
j
That would indeed explain what you see, and be expected behavior
t
Thanks for listening. 🙂
j
I like being a duck 🦆
rubber duck 5
😀 4