MicrosoftEdge / MicrosoftEdge/WebView2Feedback

CoreWebView2WebResourceResponseReceivedEventArgs and CoreWebView2WebResourceRequestedEventArgs null Content

Open
#3,083 28 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

c#/WPF

When using WebView.CoreWebView2.WebResourceRequested or WebResourceResponseReceived

agrs.Request.Content.
or
agrs.Response.Content

Always return null. According to documentation, e.g. https://learn.microsoft.com/en-us/dotnet/api/microsoft.web.webview2.core.corewebview2webresourceresponse.content?view=webview2-dotnet-1.0.1462.37#microsoft-web-webview2-core-corewebview2webresourceresponse-content

I can do get and set. Set happens fine and is handled, but get is not possible because the stream is always empty.
The headers are always passed.

When used:
CoreWebView2WebResourceResponseReceivedEventArgs
And there is a POST request, then Request.Content is filled in perfectly.

If you open the other documentation:
https://learn.microsoft.com/en-us/microsoft-edge/webview2/how-to/webresourcerequested?tabs=dotnet
Section: Example: Overriding a response, to proactively replace it
Great example, but the task is to take args.Response and replace <html with <HTML, for example. But this can't be done because args.Response=null

Maybe I don't understand the logic of these methods correctly.

Version
SDK: 1.0.1462.37
Runtime: 1.0.1462.37
Framework: WPF
OS: Windows 10

AB#42896031

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.

Research direction

Start with the WebResourceRequested and WebResourceResponseReceived event paths and compare Request.Content and Response.Content against the linked WebView2 documentation for SDK/runtime 1.0.1462.37. Reproduce the WPF POST and response-replacement cases; done means establishing whether the null or empty streams are expected or a confirmed defect, with the affected API behavior documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.