MicrosoftEdge / MicrosoftEdge/WebView2Feedback
Webview2 not able to upload stream more than 65MB stream in "CoreWebView2.Environment.CreateWebResourceResponse(stream, 200, "OK", string.Empty);"
Nobody has claimed this yet.
- Dominant language
- PowerShell
- Stars
- 526
- Forks
- 67
- PR merge metrics
- No merged PRs in 30d
Description
Discussed in https://github.com/MicrosoftEdge/WebView2Feedback/discussions/4525
Originally posted by SajidMemon44 May 3, 2024
Hi,
I am using webview2 , i want to send file using "CoreWebView2.Environment.CreateWebResourceResponse(stream, 200, "OK", string.Empty);" file size is more than 70MB it was cause error
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
at System.Windows.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run(Window window)
at System.Windows.Application.Run()
at WinProjectE.App.Main()
System.Runtime.InteropServices.SEHException
HResult=0x80004005
Message=External component has thrown an exception.
Source=
StackTrace:
Method used :
private void CoreWebView2_WebResourceRequested(object sender, CoreWebView2WebResourceRequestedEventArgs e)
{
if (e.Request.Uri.Contains("/XXX/XXX/XXX/XXX/", StringComparison.OrdinalIgnoreCase))
{
string filename = Path.GetFileName(e.Request.Uri);
string filePath = Path.Combine(App.oGlobalInput.TempDirectory, filename);
if (File.Exists(filePath))
{
FileStream stream = File.OpenRead(filePath);
e.Response = parent.webView.CoreWebView2.Environment.CreateWebResourceResponse(stream, 200, "OK",
string.Empty);
}
else
{
e.Response =
parent.webView.CoreWebView2.Environment.CreateWebResourceResponse(null, 404, "File not found", string.Empty);
}
}
}
We try this approach as well but still same error : https://learn.microsoft.com/en-us/microsoft-edge/webview2/concepts/working-with-local-content?tabs=dotnetcsharp
Some additional Infos:
We use WPF, NetFramework 4.8,
Nuget: Microsoft.Web.WebView2: Versions tested: 1.0.1823.32 and 1.0.2151.40 (latest at moment of posting)
TestPC runs on Windows 11:
WebView2 Runtime: 128.0.2739.79 (latest at moment of posting)
Any suggestions or ideas how to fix it would be nice.
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 reproducing the failure in CoreWebView2_WebResourceRequested using the provided WPF/.NET Framework 4.8 method, tested WebView2 package versions, and runtime version. Compare the behavior with the linked local-content documentation; done means determining whether the stream-size failure is reproducible and identifying a documented fix or limitation.
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
- Needs clarification
- Newbie friendliness
- 25/100