Description
What happened?
When setting the value of AllowHostInputProcessing of a CoreWebView2ControllerOptions, an error is thrown.
I am using version 1.0.3351.48, which is the first stable release which has this property. It was available in 1.0.3344-prerelease, and when using that pre-release version I get no error.
This screenshot is from the attached sample app to reproduce the error :
Line 25 is the one causing the error.
Importance
Important. My app's user experience is significantly compromised.
Runtime Channel
Stable release (WebView2 Runtime)
Runtime Version
137.0.3296.93
SDK Version
1.0.3351.48
Framework
Winforms
Operating System
Windows 10
OS Version
19045.4651
Repro steps
Repro steps and sample app
How to repro:
Build and start the sample app
Expected:
A form containing a WebView which displays google.com page is opened. No error thrown.
Actual:
The app throws the following error then crashes :
System.Reflection.TargetInvocationException
HResult=0x80131604
Message=Une exception a été levée par la cible d'un appel.
Source=mscorlib
Arborescence des appels de procédure :
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) in f:\dd\ndp\clr\src\BCL\system\reflection\methodinfo.cs:line 761
at System.Delegate.DynamicInvokeImpl(Object[] args) in f:\dd\ndp\clr\src\BCL\system\delegate.cs:line 123
at System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry tme) in System.Windows.Forms\Control.cs:line 11075
at System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(Object obj) in System.Windows.Forms\Control.cs:line 11035
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) in f:\dd\ndp\clr\src\BCL\system\threading\executioncontext.cs:line 980
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) in f:\dd\ndp\clr\src\BCL\system\threading\executioncontext.cs:line 927
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) in f:\dd\ndp\clr\src\BCL\system\threading\executioncontext.cs:line 916
at System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry tme) in System.Windows.Forms\Control.cs:line 11018
at System.Windows.Forms.Control.InvokeMarshaledCallbacks() in System.Windows.Forms\Control.cs:line 11097
at System.Windows.Forms.Control.WndProc(Message& m) in System.Windows.Forms\Control.cs:line 16349
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) in System.Windows.Forms\Control.cs:line 136
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) in System.Windows.Forms\Control.cs:line 164
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) in System.Windows.Forms\NativeWindow.cs:line 765
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData) in System.Windows.Forms\Application.cs:line 305
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) in System.Windows.Forms\Application.cs:line 1235
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) in System.Windows.Forms\Application.cs:line 1151
at System.Windows.Forms.Application.Run(Form mainForm) in System.Windows.Forms\Application.cs:line 3253
at TestWebView2.Program.Main() in C:\Users\hienmarc\source\repos\TestWebView2\Program.cs:line 19
Cette exception a été levée à l'origine dans cette pile des appels :
Microsoft.Web.WebView2.Core.CoreWebView2ControllerOptions._nativeICoreWebView2ControllerOptions4.get() dans CoreWebView2ControllerOptions.cs
Exception interne 1 :
NotImplementedException : Unable to cast to Microsoft.Web.WebView2.Core.Raw.ICoreWebView2ControllerOptions4.
This may happen if you are using an interface not supported by the version of the WebView2 Runtime you are using.
For instance, if you are using an experimental interface from an older SDK that has been modified or removed in a newer runtime.
Or, if you are using a public interface from a newer SDK that wasn't implemented in an older runtime.
For more information about WebView2 versioning please visit the following: https://learn.microsoft.com/microsoft-edge/webview2/concepts/versioning
Exception interne 2 :
InvalidCastException : Impossible d'effectuer un cast d'un objet COM de type 'System.__ComObject' en type d'interface 'Microsoft.Web.WebView2.Core.Raw.ICoreWebView2ControllerOptions4'. Cette opération a échoué, car l'appel QueryInterface sur le composant COM pour l'interface avec l'IID '{21EB052F-AD39-555E-824A-C87B091D4D36}' a échoué en raison de l'erreur suivante : Cette interface n’est pas prise en charge (Exception de HRESULT : 0x80004002 (E_NOINTERFACE)).
Repros in Edge Browser
No, issue does not reproduce in the corresponding Edge version
Regression
Regression in newer SDK
Last working version (if regression)
1.0.3344-prerelease