[Bug] When explorer.exe process is not set as shell then WAM throws exception
See original GitHub issueLogs 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
- 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”.
- Logout and Login, so that notepad.exe is the new shell.
- Run the sample WPF starter application to connect to a tenant using PublicClientApp.AcquireTokenInteractive.
- Set this option to true when building the IPublicClientApplication: WithWindowsBroker(true)
- 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.
- 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()
- 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:
- Created 5 months ago
- Comments:11 (2 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hello @MSamWils, Any plans to fix this bug, if yes, when can we expect the fix?