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.

Exception "Method not found: 'Void Microsoft.Web.WebView2.WinForms.WebView2.add_AcceleratorKeyPressed" when calling AcquireTokenInteractive

See original GitHub issue

Logs 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:closed
  • Created 2 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
pmaytakcommented, Jul 1, 2021

@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 of AcceleratorKeyPressed.

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.

1reaction
pmaytakcommented, Jun 30, 2021
Read more comments on GitHub >

github_iconTop Results From Across the Web

Deployed C# app using WebView2 cannot find the Runtime
I created a C# DLL based on .NET 4.6.1 that has a form containing an element of type Microsoft.Web.WebView2.WinForms.WebView2. It uses the latest...
Read more >
Why my coreWebView2 which is object of webView2 is null?
Use the EnsureCoreWebView2Async method to initialize the underlying CoreWebView2 property. This is documented on MSDN. This property is null ...
Read more >
Taking the new Chromium WebView2 Control for a Spin in .NET
This is Part 1 of a two part article that gives an overview of the new WebView2 Web browser control that is based...
Read more >
WebView2 | Playwright Java
WebView2 is a WinForms control, which will use Microsoft Edge under the hood to render web content. It is a part of the...
Read more >
Microsoft Edge Webview2 Runtime is a huge problem
Problem freaking solved instantly. I love Edge Chromium. However, this needs to stop auto-installing until it is not broken, please, since it is ......
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