MicrosoftEdge / MicrosoftEdge/WebView2Feedback
[.Net] ExecuteScriptAsync / PostWebMessageAsJson / PostWebMessageAsString with buffer - not string
Nobody has claimed this yet.
- Dominant language
- PowerShell
- Stars
- 526
- Forks
- 67
- PR merge metrics
- No merged PRs in 30d
Description
Is your feature request related to a problem? Please describe.
With a certain frequency (~ 2 seconds), we need to execute some rather large scripts in WebView2. Because ExecuteScriptAsync only takes a string as a parameter, and the string in .Net is an immutable type, then we can't use a buffer for this. As a result every time we need to create a new one, and most of the time the garbage collector collects these strings, which naturally leads to lags (not visual of course, but significant for us) :(
Describe the solution you'd like and alternatives you've considered.
Create an overload of ExecuteScriptAsync / PostWebMessageAsJson / PostWebMessageAsString that will take some buffer as input parameter (ReadOnlyMemory<char> / char[]). For example:
public System.Threading.Tasks.Task<string> ExecuteScriptAsync (ReadOnlyMemory<char> script);
May be some other workaround exists that I missed?
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 by reviewing the requested overloads for ExecuteScriptAsync, PostWebMessageAsJson, and PostWebMessageAsString, along with the proposed ReadOnlyMemory or char[] inputs. Then locate the corresponding .NET WebView2 API definitions and assess the buffer-lifetime and interop requirements. Done means the API change is specified and implemented consistently for all three methods, with validation for large, recurring calls.
Written by the indexing model from the issue text.
Assessment
- Domain
- api, desktop
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100