component-detection
component-detection copied to clipboard
Make Component Detection entrypoints asynchronous
Currently our standalone executable^1 and our library^2 entrypoints are implemented synchronously. However, further down the stack we call an asynchronous method with GetAwaiter().GetResult()
https://github.com/microsoft/component-detection/blob/8e8c3a4557380c22bd337b7c7f0b650ea27216e8/src/Microsoft.ComponentDetection.Orchestrator/Orchestrator.cs#L154
This pattern is called 'sync over async' and can easily cause deadlocks. The problem is described well in Stephen Toub's article "Should I expose synchronous wrappers for asynchronous methods?" from 2012^3
We should convert both entrypoints to true asynchronous calls all the way down the stack. Asynchronous Main methods have been a feature of C# since 7.1^4