[Problem/Bug]: ignoreMemberNotFoundError can not prevent exception when accessing an non-existing function
What happened?
When using a host object, I was trying to check whether a function exists before calling it, according to ignoreMemberNotFoundError, I shall be able to use this option to prevent exception.
However, this option doesn't work in my end.
Here is the test case I was using.
Importance
Blocking. My app's basic functions are not working due to this issue.
Runtime Channel
Stable release (WebView2 Runtime)
Runtime Version
123.0.2420.97
SDK Version
1.0.2420.47
Framework
WPF
Operating System
Windows 10
OS Version
10.0.19045
Repro steps
- Create a C# host class
- Register the host object with
CoreWebView2.AddHostObjectToScript - Follow winrt-from-js sample, hook up JS with
AddScriptToExecuteOnDocumentCreatedAsync() - Start application, inspect state in debug console, see screenshot:
getIsEntitled()is a valid function from host C# object,fakeMethoddoesn't exist at all, however, sinceignoreMemberNotFoundErrorwas set totrue, I am expecting accessingfakeMethodshould return anundefinedinstead of throwing an exception
Repros in Edge Browser
No, issue does not reproduce in the corresponding Edge version
Regression
No, this never worked
Last working version (if regression)
No response
It seems that WebView2 implementation only covers DISP_E_MEMBERNOTFOUND and missed handling of DISP_E_UNKNOWNNAME. Created internal work item to track the issue.
The fix has been checked in and will be available in newer Edge builds with version >= 126.0.2562.0.