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

Microsoft.Identity.Client.Utils.MacMainThreadScheduler

public class MacMainThreadScheduler
This class implements a main thread scheduler for macOS applications. It should be also working on other platforms, but it is primarily designed for macOS. It is mainly designed for internal use to support the MSAL library in "switching to the main thread anytime". However, external users can also call it if needed.

Gets the singleton instance of MacMainThreadScheduler

Check if the current thread is the main thread.

public bool IsRunning()

Check if the message loop is currently running.

public Task RunOnMainThreadAsync(Func<Task> asyncAction)

Run on the main thread asynchronously.

public void StartMessageLoop()

Start the message loop on the main thread to process actions

public void Stop()

Stop the main thread message loop