jsmarcus / Xamarin.Plugins

Cross platform Xamarin and Windows controls and plugins
MIT License
195 stars 79 forks source link

TargetInvocationException on IconToolbarItem from Navigation.PushAsync #72

Closed Kilowhisky closed 7 years ago

Kilowhisky commented 7 years ago

I am loading a ContentPage via the command.

await Navigation.PushAsync(new ComposeMessagePage());

The content page looks like this.

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:iconize="clr-namespace:FormsPlugin.Iconize;assembly=FormsPlugin.Iconize"
             x:Class="MyApp.Views.CommPages.ComposeMessagePage"
             Title="Compose">
    <ContentPage.ToolbarItems>
        <iconize:IconToolbarItem Icon="fa-address-book-o" IconColor="White" Command="SendCommand"/>
        <iconize:IconToolbarItem Icon="fa-paper-plane-o"  IconColor="White" Command="SendCommand"/>
    </ContentPage.ToolbarItems>
    <ContentPage.Content>
        ETC
    </ContentPage.Content>
</ContentPage>

When i load the page it throws this a TargetInvocationException.

Here's the full stack trace.

    0x32 in Plugin.Iconize.Droid.Controls.IconDrawable..ctor at D:\Projects\GitHub\Xamarin.Plugins\Iconize\Plugin.Iconize.Droid\Controls\IconDrawable.cs:149,17 C#
    0x41 in FormsPlugin.Iconize.Droid.ToolbarItemExtensions.GetToolbarItemDrawable at D:\Projects\GitHub\Xamarin.Plugins\Iconize\FormsPlugin.Iconize.Droid\ToolbarItemExtensions.cs:33,13   C#
    0x7D in FormsPlugin.Iconize.Droid.ToolbarItemExtensions.UpdateToolbarItems at D:\Projects\GitHub\Xamarin.Plugins\Iconize\FormsPlugin.Iconize.Droid\ToolbarItemExtensions.cs:68,17   C#
    0xC in FormsPlugin.Iconize.Droid.IconNavigationRenderer.OnUpdateToolbarItems at D:\Projects\GitHub\Xamarin.Plugins\Iconize\FormsPlugin.Iconize.Droid\IconNavigationRenderer.cs:80,13    C#
    0xFFFFFFFFFFFFFFFF in System.Reflection.MonoMethod.InternalInvoke   C#
    0x38 in System.Reflection.MonoMethod.Invoke C#
    0x6 in System.Reflection.MethodBase.Invoke  C#
    0x95 in Xamarin.Forms.MessagingCenter.Subscription.InvokeCallback at C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\MessagingCenter.cs:78,5    C#
    0x6D in Xamarin.Forms.MessagingCenter.InnerSend at C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\MessagingCenter.cs:176,6 C#
    0x26 in Xamarin.Forms.MessagingCenter.Send<object> at C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\MessagingCenter.cs:101,4  C#
    0x6 in FormsPlugin.Iconize.IconToolbarItem.OnPropertyChanged at D:\Projects\GitHub\Xamarin.Plugins\Iconize\FormsPlugin.Iconize\IconToolbarItem.cs:79,13 C#
    0x12 in Xamarin.Forms.BindableObject.OnPropertyChanged at C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\BindableObject.cs:136,5   C#
    0x2 in Xamarin.Forms.Element.OnPropertyChanged at C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\Element.cs:380,4  C#
    0xFB in Xamarin.Forms.BindableObject.SetValueActual at C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\BindableObject.cs:589,5  C#
    0x164 in Xamarin.Forms.BindableObject.SetValueCore at C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\BindableObject.cs:386,5   C#
    0x73 in Xamarin.Forms.BindableObject.SetValue at C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\BindableObject.cs:539,4    C#
    0x5 in Xamarin.Forms.BindableObject.SetValue at C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\BindableObject.cs:83,4  C#
    0x7 in Xamarin.Forms.Internals.NameScope.SetNameScope at C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\Internals\NameScope.cs:54,4    C#
>   0x81 in HELink.Views.CommPages.ComposeMessagePage.InitializeComponent at C:\Projects\GIT\HeLink\HELink\obj\Debug\HELink.Views.CommPages.ComposeMessagePage.xaml.g.cs:20,9   C#
    0x9 in HELink.Views.CommPages.ComposeMessagePage..ctor at C:\Projects\GIT\HeLink\HELink\Views\CommPages\ComposeMessagePage.xaml.cs:19,13    C#
    0x12 in System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw    C#
    0x3E in System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess  C#
    0x29 in System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification C#
    0x9 in System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd  C#
    0x6 in System.Runtime.CompilerServices.TaskAwaiter.GetResult    C#
    0x1D4 in HELink.Views.CommPage.Navigate_NewMessage at C:\Projects\GIT\HeLink\HELink\Views\CommPage.xaml.cs:55,21    C#
    0x6 in System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.InvokeMoveNext C#
    0x73 in System.Threading.ExecutionContext.RunInternal   C#
    0x4 in System.Threading.ExecutionContext.Run    C#
    0x32 in System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.Run   C#
    0x6 in System.Threading.Tasks.AwaitTaskContinuation.InvokeAction    C#
    0x13 in System.Threading.Tasks.AwaitTaskContinuation.RunCallback    C#
    0x21 in System.Threading.Tasks.SynchronizationContextAwaitTaskContinuation.Run  C#
    0xB5 in System.Threading.Tasks.Task.FinishContinuations C#
    0x3D in System.Threading.Tasks.Task.FinishStageThree    C#
    0xD5 in System.Threading.Tasks.Task.FinishStageTwo  C#
    0x4 in System.Threading.Tasks.Task.Finish   C#
    0x25 in System.Threading.Tasks.Task<System.Threading.Tasks.VoidTaskResult>.TrySetException  C#
    0x2B in System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.Threading.Tasks.VoidTaskResult>.SetException  C#
    0x7 in System.Runtime.CompilerServices.AsyncTaskMethodBuilder.SetException  C#
    0x1E5 in Xamarin.Forms.NavigationPage.PushAsync at C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\NavigationPage.cs:182,4  C#
    0x6 in System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.InvokeMoveNext C#
    0x73 in System.Threading.ExecutionContext.RunInternal   C#
    0x4 in System.Threading.ExecutionContext.Run    C#
    0x32 in System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.Run   C#
    0x6 in System.Threading.Tasks.AwaitTaskContinuation.InvokeAction    C#
    0x13 in System.Threading.Tasks.AwaitTaskContinuation.RunCallback    C#
    0x21 in System.Threading.Tasks.SynchronizationContextAwaitTaskContinuation.Run  C#
    0xB5 in System.Threading.Tasks.Task.FinishContinuations C#
    0x3D in System.Threading.Tasks.Task.FinishStageThree    C#
    0xD5 in System.Threading.Tasks.Task.FinishStageTwo  C#
    0x4 in System.Threading.Tasks.Task.Finish   C#
    0x25 in System.Threading.Tasks.Task<System.Threading.Tasks.VoidTaskResult>.TrySetException  C#
    0x2B in System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.Threading.Tasks.VoidTaskResult>.SetException  C#
    0x7 in System.Runtime.CompilerServices.AsyncTaskMethodBuilder.SetException  C#
    0x12D in Xamarin.Forms.NavigationPage.PushAsyncInner at C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\NavigationPage.cs:364,5 C#
    0x6 in System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.InvokeMoveNext C#
    0x73 in System.Threading.ExecutionContext.RunInternal   C#
    0x4 in System.Threading.ExecutionContext.Run    C#
    0x32 in System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.Run   C#
    0x6 in System.Threading.Tasks.AwaitTaskContinuation.InvokeAction    C#
    0x13 in System.Threading.Tasks.AwaitTaskContinuation.RunCallback    C#
    0x21 in System.Threading.Tasks.SynchronizationContextAwaitTaskContinuation.Run  C#
    0xB5 in System.Threading.Tasks.Task.FinishContinuations C#
    0x3D in System.Threading.Tasks.Task.FinishStageThree    C#
    0x50 in System.Threading.Tasks.Task<bool>.TrySetResult  C#
    0x7 in System.Threading.Tasks.TaskCompletionSource<bool>.TrySetResult   C#
    0x7 in Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer. at C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\AppCompat\NavigationPageRenderer.cs:669,6    C#
    0x6 in Xamarin.Forms.Forms.AndroidPlatformServices. at C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\Forms.cs:424,6   C#
    0xE in Java.Lang.Thread.RunnableImplementor.Run C#
    0x8 in Java.Lang.IRunnableInvoker.n_Run C#
    0x11 in object.a6aff079-7ded-42a6-aebc-c50fa7d61442 C#

The page works if i don't use iconize component and the iconize component works if i wrap my new page in an IconNavigationPage. But doing so causes the navigation UI to double up.

Kilowhisky commented 7 years ago

Ok so this error is thrown when the icon cannot be found. I was attempting to use 4.7 version icons!

CRYPTIC!