Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Problem/Bug]: ignoreMemberNotFoundError can not prevent exception when accessing an non-existing function #4497

Closed
richard-chen-coding opened this issue Apr 22, 2024 · 2 comments
Assignees
Labels
bug Something isn't working tracked We are tracking this work internally.

Comments

@richard-chen-coding
Copy link

richard-chen-coding commented Apr 22, 2024

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.
image

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, fakeMethod doesn't exist at all, however, since ignoreMemberNotFoundError was set to true, I am expecting accessing fakeMethod should return an undefined instead of throwing an exception image

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

AB#50274346

@richard-chen-coding richard-chen-coding added the bug Something isn't working label Apr 22, 2024
@LiangTheDev LiangTheDev added the tracked We are tracking this work internally. label Apr 22, 2024
@LiangTheDev
Copy link
Member

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.

@LiangTheDev
Copy link
Member

The fix has been checked in and will be available in newer Edge builds with version >= 126.0.2562.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working tracked We are tracking this work internally.
Projects
None yet
Development

No branches or pull requests

3 participants