MicrosoftEdge / MicrosoftEdge/WebView2Feedback
[Problem/Bug]: NavigateToString() fails with large content page that has embedded image (data: src)
Nobody has claimed this yet.
- Dominant language
- PowerShell
- Stars
- 526
- Forks
- 67
- PR merge metrics
- No merged PRs in 30d
Description
What happened?
I'm generating a simpe page to display output from an OpenAI generated image and using a data:image/png;b64 data stream to display the image. If I dump the HTML page with the embedded image to file and display it in any browser or in the WebView it works fine. However, if I display the same page that doesn't have external dependencies using NavigateToString() it fails.
Importance
Important. My app's user experience is significantly compromised.
Runtime Channel
Stable release (WebView2 Runtime)
Runtime Version
120.0.2210.77
SDK Version
1.0.2088.41
Framework
WPF
Operating System
Windows 11
OS Version
22631.2861
Repro steps
- Load an image from file
- Turn into b64 data string
- Embed into an image tag in an HTML page
- NavigateToString()
Something along the lines of this:
var sb = new StringBuilder();
sb.AppendLine("<html><body>");
// data:image/png;base64Data
var b64 = await prompt.GetBase64DataFromImageFile(prompt.ImageFileName);
if (!string.IsNullOrEmpty(b64))
{
sb.AppendLine("\t<div class='image-container'>");
sb.Append($"\t\t<img src='{b64}' />");
sb.AppendLine("\t</div>");
}
// This works fine (ie. small doc with online URL)
// sb.Append($"\t<img src='{prompt.ImageUrls.FirstOrDefault()}' />");
sb.AppendLine("</body></html>");
var html = sb.ToString();
// this fails
WebView.NavigateToString(html);
Repros in Edge Browser
No
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 WPF C# repro using WebView.NavigateToString(html), especially the embedded data:image/png content, and compare it with loading the same HTML from a file or with an external image URL. Confirm the behavior on the listed WebView2 Runtime and SDK versions; done means identifying the cause or documenting a verified workaround or fix.
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
- 35/100