MicrosoftEdge / MicrosoftEdge/WebView2Feedback
Does hostobject support array from JavaScript
Nobody has claimed this yet.
- Dominant language
- PowerShell
- Stars
- 526
- Forks
- 67
- PR merge metrics
- No merged PRs in 30d
Description
My code in C#
[ComVisible(true)]
public class JavaScriptBridge
{
public int Sum(int[] items)
{
return items.Sum();
}
}
My Coe in JavaScript:
alert(await bridge.Sum([3, 5, 8]));
But it didn't work.

I understand that I can work around this issue by using JSON.stringify() to convert an array in JavaScript to a plain string, and pass it to JavaScriptBridge. I just want to know whether there is a more graceful approach?
Thanks.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the C# JavaScriptBridge.Sum(int[]) example and the JavaScript bridge.Sum([3, 5, 8]) call shown in the issue. Compare the observed failure with WebView2 host-object interop behavior and determine whether arrays are supported; done means confirming supported marshaling or documenting a graceful supported approach.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, javascript
- Domain
- api, desktop
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100