MicrosoftEdge / MicrosoftEdge/WebView2Feedback

Can't access host object member using DISPID_VALUE (DISPID == 0)

Open
#1,920 11 comments 0 reactions 1 assignee View on GitHub

@champnic is already working on this.

Since Nov 12, 2021.

bug tracked
Dominant language
PowerShell
Stars
526
Forks
67
PR merge metrics
No merged PRs in 30d

Description

Description
Member not found error when accessing any properties or methods from a COM object, even though others work fine.

Error message:
Uncaught Error: Member not found. (0x80020003)
at RemoteMessenger.postSyncRequestMessage (<anonymous>:1:10533)
at Function.getHostProperty (<anonymous>:1:23331)
at Function._getAmbiguous (<anonymous>:1:13956)
at Object.get (<anonymous>:1:15574)
at <anonymous>:1:3

Code:

// throws error
chrome.webview.hostObjects.sync.unity.ShellSecurity.Stream.UserID

// also throws error
var s = chrome.webview.hostObjects.sync.unity.ShellSecurity.Stream;
s.UserID

There are numerous other objects, methods, properties off the unity object that all work fine. There is nothing special about the object's IDL, or the C++ class that implements it. It uses the same IDispatch implementation as all of the other objects.

When I debug the C++ code for the object it is not calling GetIDsOfNames, but instead calls Invoke with a DISPID of zero and a parameter of "UserID". The other objects that work fine first call GetIDsOfNames and then invoke with the returned DISPID.

Version
SDK: 1.0.818.41
Runtime: 95.0.1020.44
Framework: WPF
OS: Win10 20H2 19042.1348

Repro Steps

Screenshots

Additional context
IDL Excerpt:

[uuid(...), oleautomation, dual]
interface ISecurity : IDispatch
{
  [id(1), helpstring("method Deserialize")]
  HRESULT Deserialize([in] BSTR EncodedString);

  [id(2), propget, helpstring("property UserID")]
  HRESULT UserID([out, retval] long * UserID);

  ...
}

AB#37256935

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.