Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Reproducible native crash bug with WKWebView in latest Xamarin.iOS

$
0
0

I'm not sure where to report bugs anymore as Bugzilla is dead and "Report a problem" in VS is about the editor itself. If there's a better place please let me know, we really really really want this bug fixed as it's keeping us from shipping right now.

Short version: Loading a WKWebView with a HTML string twice using a WKNavigationDelegate that overrides DecidePolicy crashes Xamarin.

This is very specific but remove any of the conditions above and everything seems to work fine. Unfortunately for us, this is exactly what we need to do.

Long version:

Here's a test case that demonstrate the problem:

public class TestController : UIViewController
{
    class Navigator : WKNavigationDelegate
    {
        public override void DecidePolicy(WKWebView webView, WKNavigationAction navigationAction, Action<WKNavigationActionPolicy> decisionHandler) { }
    }

    WKWebView page;

    void AddPage()
    {
        page?.RemoveFromSuperview();
        page = new WKWebView(new CGRect(0, 0, 400, 400), new WKWebViewConfiguration());
        page.NavigationDelegate = new Navigator();
        page.LoadHtmlString("", new NSUrl(NSBundle.MainBundle.ResourceUrl + ""));

        View.AddSubview(page);

        Console.WriteLine("OK");
    }

    public override void ViewDidLoad()
    {
        UIButton button = new UIButton(new CGRect(200, 500, 0, 0));

        button.SetTitle("Add page", UIControlState.Normal);
        button.SizeToFit();
        button.TouchUpInside += (sender, e) => AddPage();

        View.AddSubview(button);
    }
}

Pressing the button should add an empty webview to the view controller and print "OK" to stdout. This works the first time, but waiting a second and pressing the button again will add the page, print "OK" and then either simply hang or crash the application

We're currently looking into finding some workaround so we can ship but hope to get this fixed, or some kind of update if that's not the case. Thank you!

Update: we're unable to find a 100% workaround, please help :(


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>