This is a migrated thread and some comments may be shown as answers.

Trial does not work with Xamarin Forms AppShell

2 Answers 222 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Brad
Top achievements
Rank 1
Brad asked on 09 May 2019, 01:54 PM

Any components used in iOS will result in an app crash if AppShell is used. I have an example project if it's helpful, but it's simply the Visual Studio 2019 App Shell starter project with the AboutPage's button replaced with a RadButton. I'm using Forms v3.6.

The exception appears to happen when the trial popup is attempted to be shown. The page actually loads just fine. It works fine on Android.

Here is the exception:

{System.InvalidCastException: Specified cast is not valid.<br>  at Xamarin.Forms.Platform.iOS.Platform.PageIsChildOfPlatform (Xamarin.Forms.Page page) [0x00008] in <7402bf39df944a9ebf61606e5f9c45a4>:0 <br>  at Xamarin.Forms.Platform.iOS.Platform.<.ctor>b__7_1 (Xamarin.Forms.Page sender, Xamarin.Forms.Internals.AlertArguments arguments) [0x00000] in <7402bf39df944a9ebf61606e5f9c45a4>:0 <br>  at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&)<br>  at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0003b] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.8.0.2/src/Xamarin.iOS/mcs/class/corlib/System.Reflection/MonoMethod.cs:305 }

And the stack trace:

  at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0004f] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.8.0.2/src/Xamarin.iOS/mcs/class/corlib/System.Reflection/MonoMethod.cs:313
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.8.0.2/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/reflection/methodbase.cs:229
  at Xamarin.Forms.MessagingCenter+Subscription.InvokeCallback (System.Object sender, System.Object args) [0x00064] in D:\a\1\s\Xamarin.Forms.Core\MessagingCenter.cs:94
  at Xamarin.Forms.MessagingCenter.InnerSend (System.String message, System.Type senderType, System.Type argType, System.Object sender, System.Object args) [0x0006b] in D:\a\1\s\Xamarin.Forms.Core\MessagingCenter.cs:217
  at Xamarin.Forms.MessagingCenter.Xamarin.Forms.IMessagingCenter.Send[TSender,TArgs] (TSender sender, System.String message, TArgs args) [0x00013] in D:\a\1\s\Xamarin.Forms.Core\MessagingCenter.cs:115
  at Xamarin.Forms.MessagingCenter.Send[TSender,TArgs] (TSender sender, System.String message, TArgs args) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\MessagingCenter.cs:108
  at Xamarin.Forms.Page.DisplayAlert (System.String title, System.String message, System.String accepHeret, System.String cancel) [0x0001f] in D:\a\1\s\Xamarin.Forms.Core\Page.cs:150
  at Xamarin.Forms.Page.DisplayAlert (System.String title, System.String message, System.String cancel) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Page.cs:141
  at Telerik.XamarinForms.Common.TelerikLicense+<>c__DisplayClass6_0.<ShowLicenseMessage>b__0 () [0x00000] in <0302126de1354584b6d9ea691c6c524a>:0
  at Telerik.XamarinForms.Common.Dispatcher+<>c__DisplayClass6_0.<ProcessItemsInQueue>b__0 () [0x00036] in <0302126de1354584b6d9ea691c6c524a>:0
  at Foundation.NSAsyncActionDispatcher.Apply () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.8.0.2/src/Xamarin.iOS/Foundation/NSAction.cs:152
--- End of stack trace from previous location where exception was thrown ---
 
  at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
  at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.8.0.2/src/Xamarin.iOS/UIKit/UIApplication.cs:79
  at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0002c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.8.0.2/src/Xamarin.iOS/UIKit/UIApplication.cs:63
  at LivePersonAuto.iOS.Application.Main (System.String[] args) [0x00001] in /Users/bdean/code/LivePersonAuto/LivePersonAuto.iOS/Main.cs:17

 

Is there any fix or workaround for this? It's making it impossible for us to evaluate Telerik beyond our logon screen. Thank you.

 

2 Answers, 1 is accepted

Sort by
0
Pavel R. Pavlov
Telerik team
answered on 10 May 2019, 08:10 AM
Hello Brad,

Thank you for contacting us on that matter.
I downloaded the latest Visual Studio 2019 and prepared a Shell project with our trial binaries. I confirm that the exception is present with the latest official Xamarin.Forms version 3.6.0.344457. This indeed is a major issue for all out customers. The good news is that the issue origins from the XamarinForms source code and it has already been fixed. You can see this pull request for more details.

To take advantage of this fix you will have to upgrade the XamarinForms version of your project to 4.0.0.394984-pre10.
This can be done through the NuGet manager of your solution. First check the "Include prerelease" checkbox and then install the mentioned version.



Please give this approach a try and let me know if it works for you. 

Regards,
Pavel R. Pavlov
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Brad
Top achievements
Rank 1
answered on 10 May 2019, 12:25 PM
Thanks Pavel, it does indeed work with v4. We can't use this in production, of course, but I can try it out in a branch.
Tags
General Discussions
Asked by
Brad
Top achievements
Rank 1
Answers by
Pavel R. Pavlov
Telerik team
Brad
Top achievements
Rank 1
Share this question
or