Not able to send arguments from javascript to reflection object methods.

Vinodhkumar Arumugam 1 Reputation point
2021-09-06T11:27:12.167+00:00

Hi, I am working on a project to embed edge chromium in c# windows application. In this application I am trying to add reflection objejct for scripting but not able to receive method arguments from javascript.


public object InvokeMember(string name, BindingFlags invokeAttr, Binder binder, object target, object[] args, ParameterModifier[] modifiers, CultureInfo culture, string[] namedParameters)
{
}
}
-I created object and created delegate methods for the above clases and added object like
_webBrowser.CoreWebView2.AddHostObjectToScript("ChromeBrowser", dynamicPluginObject);

  • I am trying to call method from javascript like chrome.webview.hostObjects.sync.ChromeBrowser['GetCustomerID'] for this I am able to getting into Invokemember method and able execute.
  • Trying to call method with parameter like
    chrome.webview.hostObjects.sync.ChromeBrowser.['SetCustomerID'] .apply(null,argumentsList); I am getting null for args in the Invokemember.

Can anyone help me on this. How to add reflection object to edge chromium for scripting?

Thanks
Vinodh Kumar

Microsoft Edge
Microsoft Edge
A Microsoft cross-platform web browser that provides privacy, learning, and accessibility tools.
2,228 questions
{count} votes