Async, Blocking and .Result
2 min
Issue
Using .Result with Async calls may result in blocking the current thread, deadlocks and high consumption of CPU.
Solution
"The Result property is a blocking property. If you try to access it before its task is finished, the thread that's currently active is blocked until the task completes and the value is available. In most cases, you should access the value by using Await or await instead of accessing the property directly."
Instead of using .Result, use Activate AsyncUtils to get the result value.
AsyncUtils.ExecSync(() => p.GraphClient.Users[azureUpn].Request().UpdateAsync(u));