Bug 60431 - Xamarin Forms WebView Crashes for Android when used with Forms Embedding
Summary: Xamarin Forms WebView Crashes for Android when used with Forms Embedding
Alias: None
Product: Forms
Classification: Xamarin
Component: Android ()
Version: 2.5.0
Hardware: Macintosh Mac OS
: Normal major
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2017-10-30 09:50 UTC by Prasun Singha Roy
Modified: 2017-11-14 00:48 UTC (History)
3 users (show)

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

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 60431 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 Prasun Singha Roy 2017-10-30 09:50:32 UTC

I have created a simple forms Content Page with a WebView in it. It points to "www.google.com".
I tried Forms Embedding to start the Forms page from Android as a Fragment and as a ViewController in iOS.
It works fine in iOS however it crashes in Android with the following error on the line where I create the fragment:
Value cannot be null.
Parameter name: startActivityForResult

The Code for android is shown below:
BaseActivity mainActivity = (BaseActivity)Activity;
FragmentManager fragmentManager = mainActivity.CurrentFragmentManager();
Forms.Init(mainActivity, null);
Fragment webViewPage = new WebViewPage().CreateFragment(mainActivity);
fragmentManager.BeginTransaction().Replace(Resource.Id.accountHelp_container, webViewPage, "Webview").AddToBackStack(null).Commit();