-
Notifications
You must be signed in to change notification settings - Fork 38
Closed
Labels
Milestone
Description
Describe the bug
There is a race condition issue when subscribing to ProviderManager.Instance.ProviderStateChanged. Currently this only works if you do this before ProviderManager.Instance.GlobalProvider is setup.
Steps to Reproduce
It is easy to see this in the UwpMsalProviderSample project. Change the constructor of LoginButton to this:
public LoginButton()
{
InitializeComponent();
_ = Task.Run(async () =>
{
await Task.Delay(2000);
_ = Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
{
ProviderManager.Instance.ProviderStateChanged += (s, e) => UpdateState();
UpdateState();
});
});
}
Now when the application is executed the text on the sign in button will not be updated.
Expected behavior
It should not matter when you subscribe to ProviderManager.Instance.ProviderStateChanged.
Additional context
I will create an PR for this.
shweaver-MSFT