MicrosoftEdge / MicrosoftEdge/WebView2Feedback
[Problem/Bug]: In IFrame, when WebResourceResponseReceived , var res = await e.Response.GetContentAsync() will make thread suspend
Nobody has claimed this yet.
- Dominant language
- PowerShell
- Stars
- 526
- Forks
- 67
- PR merge metrics
- No merged PRs in 30d
Description
What happened?
The scenario is as follows:
within an HTML page (index1.html), there exists an IFrame that has its own index2.html.
In the CoreWebView2_FrameCreated event, I have added a WebResourceResponseReceived handler, which successfully gets called back.
wbiframe.WebResourceResponseReceived += Wbiframe_WebResourceResponseReceived;
Debug.WriteLine($"IFrame:{e.Response.StatusCode} {e.Request.Uri}");
var patHasIndex = @"index\.html\?";
var found = Regex.IsMatch(e.Request.Uri, patHasIndex, RegexOptions.IgnoreCase);
var found2 = e.Request.Uri.Contains("index.html");
if (found2)
{
Debug.WriteLine("step 1>>>>>>>>>>>>>>> found " + found);
//todo: find .data .wasm index.txt
// var res2 = e.Response.GetContentAsync().Result; // it gets stuck or hangs.
Debug.WriteLine("step 2>>>>>>>>>>>>>>> GetContentAsync.result " + e.Response.Headers.GetHeader("Content-Type"));
var res = await e.Response.GetContentAsync(); // it's better, but never run to step 3
Debug.WriteLine("step 3>>>>>>>>>>>>>>> GetContentAsync " + found); //Never reaches here
StreamReader sr = new StreamReader(res);
var html = await sr.ReadToEndAsync();
Debug.WriteLine("step 4>>>>>>>>>>>>>>> ReadToEndAsync ");
var r1 = Regex.Match(html, @"[a-f0-9]{32}\.data", RegexOptions.IgnoreCase);
Debug.WriteLine("step 5>>>>>>>>>>>>>>>" + r1.Value);
I'm using to fetch the content of the outer HTML ,it works fine. However, it gets stuck only when fetching the content within an iframe.
webview2 1.0.2365.46
.net framework 4.8
Importance
Blocking. My app's basic functions are not working due to this issue.
Runtime Channel
Stable release (WebView2 Runtime)
Runtime Version
No response
SDK Version
No response
Framework
Winforms
Operating System
Windows 10
OS Version
No response
Repro steps
in IFrame,
WebResourceResponseReceived
await e.Response.GetContentAsync();
Repros in Edge Browser
No, issue does not reproduce in the corresponding Edge version
Regression
Don't know
Last working version (if regression)
No response
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 WebResourceResponseReceived handler added in CoreWebView2_FrameCreated and reproduce the WinForms case on .NET Framework 4.8 with an outer HTML document and an iframe. Check whether e.Response.GetContentAsync() completes for the iframe while the equivalent outer-document request succeeds, using the supplied logging points. Done means the iframe behavior is explained and a confirmed resolution or reproducible limitation is documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, html
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100