Xamarin.forms: [macOS] WebView can't navigate

Created on 3 Nov 2018  ·  3Comments  ·  Source: xamarin/Xamarin.Forms

Description

WebView on macOS loads a page but can't navigate within the page. I think it happens when loads a SPA, it always go to home.
Also, first time webview doesn't load the page, always at second time.

It worked OK at 3.0 but the issue happens at 3.1 and upper.

Steps to Reproduce

  1. Add a WebView on a new ContentPage
  2. Put Source property with value https://santafepubliclibrary.odilo.us/opac/
  3. Navigate to new page via Navigation.PushAsync

Expected Behavior

Page loads at first time and be able to navigate inside page, as it does on XF 3.0

Actual Behavior

Page loads at second time and is not be able to navigate inside page.

Basic Information

  • Version with issue: Xamarin.Forms 3.3.0.967583
  • Last known good version: Xamarin.Forms 3.0.0.561731
  • IDE: Visual Studio for Mac 7.6.11 (build 9)
  • Platform Target Frameworks:

    • macOS: 10.13.6

Screenshots

webview_spa

Reproduction Link

https://github.com/joseluisct/WebViewIssues

webview 2 good first issue help wanted inactive macOS up-for-grabs

All 3 comments

The reproduction (which works for the other issue which was reported) actually crashes when trying to navigate back on 3.3 with an NRE. Was anything changed that would cause this?

(Closed by accident)

I've tested again at 3.3 (last stable) and I've found the NRE, it happens when you navigate to page with WebView and click back button fast. Both issues use same WebView and nothing is done when come back.

I think the NRE is related to this other issue: #4001 that has been done at 3.4 #4188
Stack trace of NRE (same as referenced issue):
Object reference not set to an instance of an object at Xamarin.Forms.Platform.MacOS.WebViewRenderer+FormsWebFrameDelegate.FinishedLoad (WebKit.WebView sender, WebKit.WebFrame forFrame) [0x00017] in <1d80e21b8be74ba38bdf2bd5d3e4d5a0>:0 at (wrapper managed-to-native) AppKit.NSApplication.NSApplicationMain(int,string[]) at AppKit.NSApplication.Main (System.String[] args) [0x00040] in /Library/Frameworks/Xamarin.Mac.framework/Versions/5.0.0.0/src/Xamarin.Mac/AppKit/NSApplication.cs:100 at WebViewIssues.macOS.MainClass.Main (System.String[] args) [0x00017] in /Volumes/VMware Shared Folders/Compartido/WebViewIssues/WebViewIssues/WebViewIssues.macOS/Main.cs:11

But I've found that if I wait a bit more and come back, no NRE happens and issue happens as in the description (top/right button in the reproduction)
In 3.0 everything is OK. (also OK in UWP)

I am trying to use WebView in a Xamarin.Mac App and I have also this issue!, cant navigate between pages,
on Xamarin.Forms 3.0 seems to be ok the navigation, but navigating event is never fired, in Xamarin.Forms 3.1 navigating event is fired, but cant navigate between pages.

Was this page helpful?
0 / 5 - 0 ratings