Bug 53309 - System.ArgumentException: No IAppIndexingProvider was provided after application second start
Summary: System.ArgumentException: No IAppIndexingProvider was provided after applicat...
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.3.3
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2017-03-14 13:53 UTC by Łukasz
Modified: 2017-08-16 23:15 UTC (History)
5 users (show)

Tags: android, ios, applink, crash ac
Is this bug a regression?: ---
Last known good build:

Sample project with the same error (172.64 KB, application/x-7z-compressed)
2017-03-21 08:58 UTC, Łukasz
Log file (188.36 KB, text/plain)
2017-03-21 09:16 UTC, Łukasz

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 53309 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 Łukasz 2017-03-14 13:53:26 UTC

I'm using Xamarin with VisualStudio Community 2015 and Xamarin.Forms and I'm currently trying to implement app indexing and deep linking. 
I'm facing the problem of registering links. When i make a fresh deploy (first application is manually uninstalled), everything is OK. But second time when I run the app, it crashes on Application.Current.AppLinks.RegisterLink method with "System.ArgumentException: No IAppIndexingProvider was provided" error. It behaves in the same way when i run the app from VisualStudio or from device. Here is my packages.config for Android project:

<?xml version="1.0" encoding="utf-8"?>
  <package id="AndHUD" version="1.2.0" targetFramework="MonoAndroid60" />
  <package id="ExifLib.PCL" version="1.0.1" targetFramework="MonoAndroid60" />
  <package id="Newtonsoft.Json" version="8.0.2" targetFramework="MonoAndroid60" />
  <package id="Plugin.Share" version="3.0.1" targetFramework="MonoAndroid60" />
  <package id="RestSharp" version="105.2.3" targetFramework="MonoAndroid60" />
  <package id="Xam.Plugins.Settings" version="2.1.0" targetFramework="MonoAndroid60" />
  <package id="Xamarin.Android.Support.Animated.Vector.Drawable" version="23.3.0" targetFramework="monoandroid70" />
  <package id="Xamarin.Android.Support.Design" version="23.3.0" targetFramework="monoandroid70" />
  <package id="Xamarin.Android.Support.v4" version="23.3.0" targetFramework="monoandroid70" />
  <package id="Xamarin.Android.Support.v7.AppCompat" version="23.3.0" targetFramework="monoandroid70" />
  <package id="Xamarin.Android.Support.v7.CardView" version="23.3.0" targetFramework="monoandroid70" />
  <package id="Xamarin.Android.Support.v7.MediaRouter" version="23.3.0" targetFramework="monoandroid70" />
  <package id="Xamarin.Android.Support.v7.RecyclerView" version="23.3.0" targetFramework="monoandroid70" />
  <package id="Xamarin.Android.Support.Vector.Drawable" version="23.3.0" targetFramework="monoandroid70" />
  <package id="Xamarin.FFImageLoading" version="2.2.8" targetFramework="monoandroid70" />
  <package id="Xamarin.FFImageLoading.Forms" version="2.2.8" targetFramework="monoandroid70" />
  <package id="Xamarin.FFImageLoading.Transformations" version="2.2.8" targetFramework="monoandroid70" />
  <package id="Xamarin.Forms" version="" targetFramework="monoandroid71" />
  <package id="Xamarin.Forms.AppLinks" version="" targetFramework="monoandroid71" />
  <package id="Xamarin.Forms.Maps" version="" targetFramework="monoandroid71" />
  <package id="Xamarin.GooglePlayServices.AppIndexing" version="" targetFramework="monoandroid71" />
  <package id="Xamarin.GooglePlayServices.Base" version="" targetFramework="monoandroid70" />
  <package id="Xamarin.GooglePlayServices.Basement" version="" targetFramework="monoandroid70" />
  <package id="Xamarin.GooglePlayServices.Maps" version="" targetFramework="monoandroid70" />
  <package id="Xamarin.Insights" version="1.11.3" targetFramework="MonoAndroid60" />
  <package id="XLabs.Core" version="2.0.5782" targetFramework="monoandroid71" />
  <package id="XLabs.Forms" version="2.0.5782" targetFramework="monoandroid71" />
  <package id="XLabs.IoC" version="2.0.5782" targetFramework="monoandroid71" />
  <package id="XLabs.Platform" version="2.0.5782" targetFramework="monoandroid71" />
  <package id="XLabs.Serialization" version="2.0.5782" targetFramework="monoandroid71" />
  <package id="XLabs.Serialization.JSON" version="2.0.5782" targetFramework="monoandroid71" />

I tried this functionality using AppCompat, XFormsApplicationDroid and FormsApplicationActivity with the same result.
Comment 1 Jimmy [MSFT] 2017-03-14 16:35:24 UTC
Thank you for filing this report! Let me try reproducing this issue with a sample project and I will update the report with my results.
Comment 2 Jimmy [MSFT] 2017-03-14 17:12:46 UTC
I wasn't able to reproduce this crash when testing with the Deep Linking sample[1]. In the sample, each time a new item is created Application.Current.AppLinks.RegisterLink() is also called. I was able to add new items successfully each time I launched the app.

Can you attach the complete debug output[2] and a reproduction project so we can continue looking into this? Thanks!

[1] https://developer.xamarin.com/samples/xamarin-forms/deeplinking/
[2] https://developer.xamarin.com/guides/cross-platform/troubleshooting/questions/version-logs/#debug-logs-for-xamarin-apps
Comment 3 Łukasz 2017-03-21 08:42:11 UTC
This is part of my Detailed debug output:

Thread started: <Thread Pool> #6
03-21 09:32:21.707 D/Mono    (26717): [0x93280300] worker starting
Thread started: <Thread Pool> #8
03-21 09:32:25.691 D/Mono    (26717): [0x9206d780] worker starting
Unhandled Exception:

System.ArgumentException: No IAppIndexingProvider was provided

03-21 09:32:32.828 D/Mono    (26717): DllImport attempting to load: '/system/lib/liblog.so'.
03-21 09:32:32.848 D/Mono    (26717): DllImport loaded library '/system/lib/liblog.so'.
03-21 09:32:32.858 D/Mono    (26717): DllImport searching in: '/system/lib/liblog.so' ('/system/lib/liblog.so').
03-21 09:32:32.858 D/Mono    (26717): Searching for '__android_log_print'.
03-21 09:32:32.858 D/Mono    (26717): Probing '__android_log_print'.
03-21 09:32:32.858 D/Mono    (26717): Found as '__android_log_print'.
03-21 09:32:32.888 I/MonoDroid(26717): UNHANDLED EXCEPTION:
03-21 09:32:32.898 I/MonoDroid(26717): System.ArgumentException: No IAppIndexingProvider was provided
03-21 09:32:32.898 I/MonoDroid(26717):   at Xamarin.Forms.Application.get_AppLinks () [0x00008] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Core\Application.cs:44 
03-21 09:32:32.898 I/MonoDroid(26717):   at MembersClub.EventListPage.RegisterAppLink () [0x0007d] in C:\GIT\ClevelandOrchestra_v2\cleveland-orchestra-app\MembersClub\EventListPage.xaml.cs:244 
03-21 09:32:32.898 I/MonoDroid(26717):   at MembersClub.EventListPage..ctor () [0x00123] in C:\GIT\ClevelandOrchestra_v2\cleveland-orchestra-app\MembersClub\EventListPage.xaml.cs:55 
03-21 09:32:32.898 I/MonoDroid(26717):   at MembersClub.App.SavePropertiesAsync () [0x0006e] in C:\GIT\ClevelandOrchestra_v2\cleveland-orchestra-app\MembersClub\App.xaml.cs:41 
03-21 09:32:32.898 I/MonoDroid(26717):   at MembersClub.Droid.MainActivity.OnCreate (Android.OS.Bundle bundle) [0x00051] in C:\GIT\ClevelandOrchestra_v2\cleveland-orchestra-app\Droid\MainActivity.cs:30 
03-21 09:32:32.898 I/MonoDroid(26717):   at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_savedInstanceState) [0x00011] in /Users/builder/data/lanes/4009/9578cdcd/source/monodroid/src/Mono.Android/platforms/android-25/src/generated/Android.App.Activity.cs:2550 
03-21 09:32:32.898 I/MonoDroid(26717):   at (wrapper dynamic-method) System.Object:23d4534d-6d80-42d3-a86c-2da7e30f31fc (intptr,intptr,intptr)
03-21 09:32:32.928 W/art     (26717): JNI RegisterNativeMethods: attempt to register 0 native methods for android.runtime.JavaProxyThrowable
03-21 09:32:32.948 D/Mono    (26717): DllImport searching in: '__Internal' ('(null)').
03-21 09:32:32.948 D/Mono    (26717): Searching for 'java_interop_jnienv_throw'.
03-21 09:32:32.948 D/Mono    (26717): Probing 'java_interop_jnienv_throw'.
03-21 09:32:32.948 D/Mono    (26717): Found as 'java_interop_jnienv_throw'.
An unhandled exception occured.

03-21 09:32:35.630 E/mono    (26717): 
03-21 09:32:35.630 E/mono    (26717): Unhandled Exception:
03-21 09:32:35.630 E/mono    (26717): System.ArgumentException: No IAppIndexingProvider was provided
03-21 09:32:35.640 E/mono-rt (26717): [ERROR] FATAL UNHANDLED EXCEPTION: System.ArgumentException: No IAppIndexingProvider was provided
Comment 4 Łukasz 2017-03-21 08:58:22 UTC
Created attachment 20489 [details]
Sample project with the same error

I cleaned up packages directory due to max attachment size. If you'll need this I can send full project in another way.
Comment 5 Łukasz 2017-03-21 09:16:51 UTC
Created attachment 20491 [details]
Log file
Comment 6 Jimmy [MSFT] 2017-03-21 23:51:10 UTC
Thank you for that information! I am able to reproduce this crash with the project attached in comment 4. This is happening with Forms and 2.3.4-pre5 and on iOS and Android. The app crashes at launch with

> System.ArgumentException: No IAppIndexingProvider was provided

This seems to be a timing issue with the initialization of index provider. Registering the AppLink inside OnAppearing() instead of the page constructor will _not_ result in a crash.

As the app link guide[1] does not explicitly mention that registration cannot not be done in the constructor, I am confirming this as a bug so the team can investigate and provide more information.

[1] https://developer.xamarin.com/guides/xamarin-forms/platform-features/deep-linking/
Comment 7 Łukasz 2017-03-23 10:16:42 UTC
Thans a lot! It works great now!