When you call the method from the UI, deadlock is generally not caused by this. The ConfigureAwait method
isn’t special, it’s not recognized in any special way by the compiler or by the runtime. It is simply a method that returns a struct (a ConfiguredTaskAwaitable) that wraps the original task it was called on as well as the specified Boolean value. When you use ConfigureAwait(false)
, even if there is a current context or scheduler to call back to, it pretends as if there isn’t. So I think it's no need for you to use ConfigureAwait(false)
. For more details about ConfigureAwait , please refer to the Stephen's blog ConfigureAwait FAQ
By the way, I tested below code in my .Net core 5.0 project ,and both of them can detect the camera without disconnecting and reconnecting the camera.
var frameSourceGroups0 = await MediaFrameSourceGroup.FindAllAsync().AsTask().ConfigureAwait(false);
var frameSourceGroups1 = await MediaFrameSourceGroup.FindAllAsync();
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.