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

[windows] Account for ObjectDisposedException coming from device tests for MauiWebView #21631

Closed
PureWeen opened this issue Apr 3, 2024 · 0 comments · Fixed by #21892
Closed

Comments

@PureWeen
Copy link
Member

PureWeen commented Apr 3, 2024

Description

After reviewing some crash dumps for WinUI we noticed an ObjectDisposedException

image

Currently we haven't found a way to detect for this beyond just catching and logging the exception.

I also wonder if we need the internal web view on this code and if that's complicated matters even more. That internal WebView was added 8 years ago for WinRT

xamarin/Xamarin.Forms#277

I started a branch here
https://github.com/dotnet/maui/tree/catch_disposed_exception

With a somewhat naive approach to just catch the exception for now and log it

But I'm curious if

  1. we can just remove that internal webview for simplifying purposes
  2. find a better solution then just catching the disposed exception
@PureWeen PureWeen added this to the .NET 8 SR4 milestone Apr 3, 2024
@PureWeen PureWeen modified the milestones: .NET 8 SR4, .NET 8 SR5 Apr 3, 2024
PureWeen added a commit that referenced this issue Apr 23, 2024
…bViewSource (#21892)

### Description of Change

This PR removes the use of a 2nd "hidden" WebView2 that was used to
parse and add a HTML `base` tag to the `head` tag when setting the HTML
source of a WebView to a string.

This was done by appending the `base` tag script to the start of the
user's HTML string, which the WebView then adds into the `head` element.
While this is technically not valid HTML, all current browsers correct
this behavior.

This is a work-around for the lack of being able to set the base URL
when navigating to a string using WebView2
(MicrosoftEdge/WebView2Feedback#530).

As a bonus, using `HtmlWebViewSource` should now be 2x faster 😅

### Issues Fixed

Fixes #21631
@github-actions github-actions bot locked and limited conversation to collaborators Jun 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.