question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] When explorer.exe process is not set as shell then WAM throws exception

See original GitHub issue

Logs and network traces I have captured MSAL logs Which version of MSAL.NET are you using? 4.49.1.0

Platform .net framework 4.8

What authentication flow has the issue?

  • Desktop / Mobile
    • [x ] Interactive
    • Integrated Windows Authentication
    • Username Password
    • Device code flow (browserless)
  • Web app
    • Authorization code
    • On-Behalf-Of
  • Daemon app
    • Service to Service calls

Other?

Is this a new or existing app?

c. This is a new app or experiment. –>

Repro

  1. Set any other process other than explorer.exe process as a shell by changing the registry HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\Shell as “notepad.exe”.
  2. Logout and Login, so that notepad.exe is the new shell.
  3. Run the sample WPF starter application to connect to a tenant using PublicClientApp.AcquireTokenInteractive.
  4. Set this option to true when building the IPublicClientApplication: WithWindowsBroker(true)
  5. When the default option of the explorer.exe process is the shell then everything works fine but if any other process like for example notepad.exe is the shell then WAM gives the error and can’t connect to AzureAD.
  6. Error as captured by MSAL logging: Microsoft.Identity.Client.MsalServiceException: WAM Error Microsoft.Identity.Client.Platforms.Features.WamBroker.AadPlugin Error Code: WAM_aad_provider_error_2147746132 Error Message:
    WAM Error Message:
    Internal Error Code: 2147746132 Is Retryable: False Possible causes:
  • Invalid redirect uri - ensure you have configured the following url in the AAD portal App Registration: ms-appx-web://microsoft.aad.brokerplugin/25356a13-d1c9-43cb-858e-88fc11631b29
  • No Internet connection Please see https://aka.ms/msal-net-wam for details about Windows Broker integration at Microsoft.Identity.Client.Platforms.Features.WamBroker.WamAdapters.CreateMsalResponseFromWamResponse(IWebTokenRequestResultWrapper wamResponse, IWamPlugin wamPlugin, String clientId, ILoggerAdapter logger, Boolean isInteractive) at Microsoft.Identity.Client.Platforms.Features.WamBroker.WamBroker.<AcquireInteractiveWithAadBrowserAsync>d__16.MoveNext()
  1. Redirect URI is configured as everything works fine if explorer.exe is set as shell, and I can reproduce the issue easily using the starter MSAL.net application, also if needed I can upload my application also.
IPublicClientApplication clientApp = PublicClientApplicationBuilder.Create(ClientId)
                    .WithDefaultRedirectUri()
                    .WithAuthority(AzureCloudInstance.AzurePublic, TenantId)
                    .WithWindowsBroker(true)
                    .WithLogging(new MSALLogger(), true)
                    .Build();
authResult = await clientApp .AcquireTokenInteractive(scopes)
                        .WithAccount(accounts.FirstOrDefault())
                        .WithPrompt(Prompt.SelectAccount)
                        .ExecuteAsync();

**Expected behavior**
It should launch the Microsoft Account selection form.

**Actual behavior**
WAM exception is thrown

**Possible solution**
<!--- Only if you have suggestions on a fix for the bug -->

**Additional context/logs / screenshots/links to code**
Reproduction steps are easy and I can provide my sample application which is the same as given as the starter WPF application for MSAL.NET.

Issue Analytics

  • State:open
  • Created 5 months ago
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
common-taskscommented, May 6, 2023
  1. We have done most of the testing using the version of the library which has this issue, I can try changing the library version now, but it will need complete testing. I will get back to this by next week as it will need testing.
  2. Our product “ZENworks” is used by some organizations like hospitals and schools where we display our desktop application as a shell, so that is the only application running for the end user, and the end-user launches other custom applications using that desktop application, for example, one school application, etc. It is a big use case for us.
0reactions
common-taskscommented, May 17, 2023

Hello @MSamWils, Any plans to fix this bug, if yes, when can we expect the fix?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Explorer.exe problem at startup. The Default Shell on ...
I have search for [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\Shell ] ..... but the Shell does not exists.
Read more >
How do I replace the system shell (explorer.exe) with ...
This is stored in the key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\Shell. Replace this with whatever you ...
Read more >
How to Fix All Explorer.exe Errors in Windows 11 [Solution]
The explorer. exe process is the Windows Graphical User Interface shell ... Explorer. exe error Windows 11 startup – Another common time for ......
Read more >
How to Fix All Explorer.Exe Errors in Windows 11 [Tutorial]
Explorer. exe application error the instruction at referenced memory at the memory could not be read – Users claimed to get this message ......
Read more >
How to Fix "Explorer.EXE" Element Not Found in Windows 10
If explorer. exe crashes, the process can be terminated or restarted through ... not found" error on Windows 10, it is an explorer....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found