❔ While loop stuck
Hey, someone has an idea why after running a method my while loop just stops
? thank you
12 Replies
Tasks are not long-running unless you specify them to be
(also, nice discarded task)
is that ironic ?
I'am doing this in an other method, could you explain why it does't work here ?
For the time being, yes. Tasks should, generally, be awaited. But you might have reasons to fire&forget it, dunno
so you have any idea how to solve my issue ?
could use thread
You can spawn a Thread instead of a Task, as you pretty much have no reason to use Task.
for the first example
why not the second one ?
There's no particular advantage to using a Thread object instead of a Task object and Thread has a much less ergonomic API. Just use Task.Factory.StartNew with the TaskCreationOptions.LongRunning flag.
(To avoid burning a thread pool thread unnecessarily)
is it clean now ?
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.