Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] [WAM] Using WAM when a console app is started as an exe results in exception because of null sync context #2608

Closed
pmaytak opened this issue May 6, 2021 · 1 comment
Assignees
Milestone

Comments

@pmaytak
Copy link
Contributor

pmaytak commented May 6, 2021

Which version of MSAL are you using?
Latest 4.30.1

Platform
NetFx/Net5 console app using WAM

Repro

  1. Build NetFxConsoleApp.
  2. Run the app executable directly (not from Visual Studio).

Expected behavior
WAM account picker control is shown.

Actual behavior
An exception is thrown because the sync context is null here:

{
throw new MsalClientException(
MsalError.WamUiThread,
"AcquireTokenInteractive with broker must be called from the UI thread when using the Windows broker." +
WamBroker.ErrorMessageSuffix);
}

Possible solution
Add a check if _synchronizationContext is null in UseSplashScreen().

@pmaytak pmaytak added this to the 4.31.0 milestone May 6, 2021
@pmaytak pmaytak self-assigned this May 6, 2021
@pmaytak pmaytak added Fixed and removed In PR labels May 10, 2021
@pmaytak
Copy link
Contributor Author

pmaytak commented May 11, 2021

This is included in MSAL 4.31.0 release.

@pmaytak pmaytak closed this as completed May 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant