❔ Fire and forget
Is there a recommended way to call an async void, or to run an async task as fire and forget? I havent been able to find any that doesent cause a warning, and i would rather not supress it.
5 Replies
simply dont await the task
eg
that will throw warning @cap5lut
you should do it with
_
discard
also why you made it async/await when you're not planning to await it?you get a warning because if the async method throws an exception and you don't await it
you won't catch the exception properly
is about the only proper way to go about fire&forget
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.