Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Problem/Bug]: Exception 0xFFFF8300 is raised in await e.Response.GetContentAsync() #4663

Open
104kazu opened this issue Jul 5, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@104kazu
Copy link

104kazu commented Jul 5, 2024

What happened?

When I paste WebView2 into a form and request Navigate, in order to trace all the interaction with the other host, I use WebResourceResponseReceived to get the data received in await, but Await e.Response. GetContentAsync() may raise an exception. Is there any way to deal with this?
The operating environment is as follows (developed in VB.NET)
Windows10
NET Framework 4.8
WebView2 Runtime 126.0.2592.87
Microsoft.Web.WebView2 1.0.2592.61

`
Private Async Sub WebResourceResponseReceived(sender As Object, e As CoreWebView2WebResourceResponseReceivedEventArgs)

    Dim objUri As Uri
    Dim strContentType As String
    Try
        If e.Response.StatusCode >= 300 And e.Response.StatusCode <= 399 Then Exit Sub
        strContentType = Nothing
        For Each objHeader In e.Response.Headers
            If objHeader.Key.Equals("Content-Type", StringComparison.OrdinalIgnoreCase) Then
                strContentType = objHeader.Value
                Exit For
            End If
        Next
        Try
            objUri = New Uri(e.Request.Uri)
            If objUri.Scheme <> "https" Then Exit Sub
        Catch ex As Exception
            Exit Sub
        End Try
        If strContentType IsNot Nothing Then
            If Regex.IsMatch(strContentType, "(application/json|text/html|text/xml|text/plan)", RegexOptions.IgnoreCase) Then
                Using objStream = Await e.Response.GetContentAsync()
                    Using objReader As New StreamReader(objStream)
                        Await objReader.ReadToEndAsync()
                    End Using
                End Using
            End If
        End If
    Catch ex As Exception
        Debug.Print("●" & e.Request.Uri)
        Debug.Print(e.Response.StatusCode)
        Debug.Print("■" & ex.Message)
    End Try
End Sub

`
The error that occurs is as follows
Exception thrown: 'System.Runtime.InteropServices.COMException' (in mscorlib.dll)

Importance

Blocking. My app's basic functions are not working due to this issue.

Runtime Channel

Stable release (WebView2 Runtime)

Runtime Version

126.0.2592.87

SDK Version

No response

Framework

Winforms

Operating System

Windows 10

OS Version

No response

Repro steps

The following processes occur with high frequency (not always)
WebView21.CoreWebView2.Navigate("https://ja.aliexpress.com/item/1005005239744204.html")

Repros in Edge Browser

No, issue does not reproduce in the corresponding Edge version

Regression

No, this never worked

Last working version (if regression)

No response

@104kazu 104kazu added the bug Something isn't working label Jul 5, 2024
@104kazu
Copy link
Author

104kazu commented Nov 2, 2024

Can someone please provide a solution to this problem? Thank you in advance.

@charismafight
Copy link

I have the same problem.

@104kazu
Copy link
Author

104kazu commented Nov 21, 2024

Thank you for contacting us.
Please find attached a sample for your review.
Thank you in advance for your cooperation.
Uploading WebViewTest.zip…

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants