Exception "Method not found: 'Void Microsoft.Web.WebView2.WinForms.WebView2.add_AcceleratorKeyPressed" when calling AcquireTokenInteractive
See original GitHub issueLogs and network traces Without logs or traces, it is unlikely that the team can investigate your issue. Capturing logs and network traces is described in Logging wiki.
Which version of MSAL.NET are you using? MSAL.NET 4.32.0
Platform .NET 4.6
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? Microsoft Edge WebView2 Runtime ver. 91.0.864.41
Is this a new or existing app? c. This is a new app or experiment.
Repro
IMsalHttpClientFactory factoryHttpClient = new MsalClientFactory("user agent");
IPublicClientApplication client = PublicClientApplicationBuilder
.Create("client Id")
.WithDesktopFeatures()
.WithHttpClientFactory(factoryHttpClient)
.WithAuthority("authority")
.Build();
var authResult = await client.AcquireTokenInteractive(scopes).WithUseEmbeddedWebView(true)
.WithLoginHint("loginHint").WithPrompt(Prompt.NoPrompt)
.ExecuteAsync(cancelToken).ConfigureAwait(true);
Expected behavior authResult returns access token
Actual behavior Exception: Method not found: ‘Void Microsoft.Web.WebView2.WinForms.WebView2.add_AcceleratorKeyPressed(System.EventHandler`1<Microsoft.Web.WebView2.Core.CoreWebView2AcceleratorKeyPressedEventArgs>)’.
Possible solution
Additional context / logs / screenshots Add any other context about the problem here, such as logs and screenshots.
<GetEwsToken>d__16.MoveNext, Line 270] : Error acquiring access token System.MissingMethodException: Method not found: ‘Void Microsoft.Web.WebView2.WinForms.WebView2.add_AcceleratorKeyPressed(System.EventHandler`1<Microsoft.Web.WebView2.Core.CoreWebView2AcceleratorKeyPressedEventArgs>)’. at Microsoft.Identity.Client.Platforms.Features.WebView2WebUi.WebView2WebUi.<AcquireAuthorizationAsync>d__3.MoveNext() — End of stack trace from previous location where exception was thrown — at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Identity.Client.Internal.AuthCodeRequestComponent.<FetchAuthCodeAndPkceInternalAsync>d__7.MoveNext() — End of stack trace from previous location where exception was thrown — at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Identity.Client.Internal.AuthCodeRequestComponent.<FetchAuthCodeAndPkceVerifierAsync>d__4.MoveNext() — End of stack trace from previous location where exception was thrown — at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Identity.Client.Internal.Requests.InteractiveRequest.<GetTokenResponseAsync>d__11.MoveNext() — End of stack trace from previous location where exception was thrown — at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Identity.Client.Internal.Requests.InteractiveRequest.<ExecuteAsync>d__8.MoveNext() — End of stack trace from previous location where exception was thrown — at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Identity.Client.Internal.Requests.RequestBase.<RunAsync>d__13.MoveNext() — End of stack trace from previous location where exception was thrown — at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Identity.Client.ApiConfig.Executors.PublicClientExecutor.<ExecuteAsync>d__2.MoveNext()
System.MissingMethodException: Method not found: ‘Void Microsoft.Web.WebView2.WinForms.WebView2.add_AcceleratorKeyPressed(System.EventHandler`1<Microsoft.Web.WebView2.Core.CoreWebView2AcceleratorKeyPressedEventArgs>)’. at Microsoft.Identity.Client.Platforms.Features.WebView2WebUi.WebView2WebUi.<AcquireAuthorizationAsync>d__3.MoveNext() — End of stack trace from previous location where exception was thrown — at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Identity.Client.Internal.AuthCodeRequestComponent.<FetchAuthCodeAndPkceInternalAsync>d__7.MoveNext() — End of stack trace from previous location where exception was thrown — at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Identity.Client.Internal.AuthCodeRequestComponent.<FetchAuthCodeAndPkceVerifierAsync>d__4.MoveNext() — End of stack trace from previous location where exception was thrown — at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Identity.Client.Internal.Requests.InteractiveRequest.<GetTokenResponseAsync>d__11.MoveNext() — End of stack trace from previous location where exception was thrown — at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Identity.Client.Internal.Requests.InteractiveRequest.<ExecuteAsync>d__8.MoveNext() — End of stack trace from previous location where exception was thrown — at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Identity.Client.Internal.Requests.RequestBase.<RunAsync>d__13.MoveNext() — End of stack trace from previous location where exception was thrown — at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Identity.Client.ApiConfig.Executors.PublicClientExecutor.<ExecuteAsync>d__2.MoveNext()
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (1 by maintainers)
Top GitHub Comments
@bgavrilMS Based on the https://github.com/MicrosoftEdge/WebView2Feedback/issues/1453#issuecomment-871711806, if we upgrade WebView2 SDK version, we’ll have to use
OnKeyDown
instead ofAcceleratorKeyPressed
.Another point is that these events block all shortcut keys like CTRL + V, arrow keys. I think we might need to update the event handler to allow copy, paste, and such. Another alternative is to maybe set
WebView2.CoreWebView2.Settings.AreBrowserAcceleratorKeysEnabled
which doesn’t disable all the keys.For reference: https://github.com/MicrosoftEdge/WebView2Feedback/issues/1453