Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
Developer Community or GitHub with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
Created attachment 13293 [details]
Take the testApp attached and change the targetUrl in WebPage.cs to a working Url (like www.xamarin.com). In MyWebView, add breakpoints to ln 10 (Navigated += OnLoadFinished) and ln 15 (first line of OnLoadFinished) then run. The first breakpoint will be hit, the second one will not, and the Alert will not display.
You're replacing the existing WebViewClient with your own:
// lets get a reference to the native control
var nativeWebView = Control;
XF's implementation of WebViewClient does all the plumbing such as raising the Navigated event. It might be possible to expose a WebViewClient property so it can be overridden, but you'd still be responsible for hooking things up properly.
Why would you want a custom WebViewClient?
Yes, that is because I had to override ShouldOverrideUrlLoading. I see that is now marked as obsolete, how should that be handled instead?
You should continue overriding the deprecated method (for apis <24) as well as the new one (for apis >= 24).
I need to look at Xamarin's implementation, but the new one should look something like this:
public override bool ShouldOverrideUrlLoading(AWebView view, IWebResourceRequest request)
You could get the previous string parameter like so: request.Url.ToString().
I can reproduce this issue using the attached repro project with Forms 220.127.116.117 and 18.104.22.168. However, as mentioned in comment #1, this is due to using a custom renderer to replace the default WebViewClient so the Navigated event is never sent. Without the custom renderer, the app runs as expected.