Is async inside a dedicated thread a bad idea?
I've got a C# web app (REST) using System.Net.Http.HttpClient that streams video to a GUI via a multipart/x-mixed-replace REST endpoint, while simultaneously and continuously hitting a handful of other REST endpoints to obtain pseudo-realtime data to display over top of the video. Everything is async. When I allow the streaming video part to run on the UI thread, even though it's async it grinds everything else to a halt, the UI is entirely unresponsive. To solve that I moved all of the video streaming part into its own thread and presto problem solved, the UI works nicely. But all of that code inside its own thread is async with awaits on the parts that call to the web server. Since it's in a dedicated thread, is there any downside to either leaving it async, or changing it to all synchronous calls? i.e. changing await Stream.ReadAsync() to Stream.Read()? I tried it briefly but did not notice any obvious difference in performance, so I'm curious if there are any not-obvious pros or cons to using async in the worker thread?