<PackageReference Include="Microsoft.Identity.Client" Version="4.85.1" />

Microsoft.Identity.Client.Platforms.Features.DesktopOs.StaTaskScheduler

Provides a scheduler that uses STA threads.
public StaTaskScheduler(int numberOfThreads)

Initializes a new instance of the StaTaskScheduler class with the specified concurrency level.

public void Dispose()

Cleans up the scheduler by indicating that no more tasks will be queued. This method blocks until all threads successfully shutdown.