Bug 58337 - WebViewRenderer should handle NSError codes in LoadFailed
Summary: WebViewRenderer should handle NSError codes in LoadFailed
Alias: None
Product: Forms
Classification: Xamarin
Component: iOS ()
Version: 2.3.5
Hardware: Other Other
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2017-07-24 14:57 UTC by Mikalai Daronin
Modified: 2017-07-26 23:43 UTC (History)
3 users (show)

Tags: ac webview
Is this bug a regression?: ---
Last known good build:

repro project (26.63 KB, application/zip)
2017-07-25 13:59 UTC, Jimmy [MSFT]

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and 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 Links.

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 for Bug 58337 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description Mikalai Daronin 2017-07-24 14:57:12 UTC
My Xamarin.Forms app contains a WebView and shows an error alert if the page fails to load for some reason. However, when a new page is requested (for instance by user tap) before the previous one is finished loading, "LoadFailed" method will be called on the UIWebView delegate with error code = "-999", which means "NSURLErrorCancelled". In that case I would prefer to ignore this error in my code, but "WebViewRenderer" handles it as all other errors and it makes impossible to figure out the cause of the error from "WebNavigatedEventArgs" argument in the cross-platform project.

Comment 1 Jimmy [MSFT] 2017-07-25 13:59:10 UTC
Created attachment 23786 [details]
repro project

I am attaching a project that demonstrates this issue. When the WebView loading is cancelled in order to load the new page, the cancellation is being reported as a failure. However the WebNavigationResult enum does already include a Cancel option[1] so it should be possible to report a more accurate result in this scenario. I am confirming the report so we can investigate further. 

### Version Tests
2.3.5-pre6	BAD	BAD

[1] https://github.com/xamarin/Xamarin.Forms/blob/master/Xamarin.Forms.Core/WebNavigationResult.cs