Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Invalid cast exception on PlatformAddTags(string[] tags) #47

Open
3 tasks done
pablolop002 opened this issue Jan 20, 2021 · 0 comments
Open
3 tasks done

[BUG] Invalid cast exception on PlatformAddTags(string[] tags) #47

pablolop002 opened this issue Jan 20, 2021 · 0 comments

Comments

@pablolop002
Copy link

Describe the bug
App trows InvalidCastException when you call PlatformAddTags function on iOS.

Exception or Stack Trace

Unhandled Exception:
System.InvalidCastException: Specified cast is not valid.
  at Microsoft.Azure.NotificationHubs.Client.NotificationHub.PlatformAddTags (System.String[] tags) [0x00000] in /Users/pablolop002/Projects/Kairos/Microsoft.Azure.NotificationHubs.Client/NotificationHub.ios.cs:119 
  at Microsoft.Azure.NotificationHubs.Client.NotificationHub.AddTags (System.String[] tags) [0x00000] in /Users/pablolop002/Projects/Kairos/Microsoft.Azure.NotificationHubs.Client/NotificationHub.shared.cs:72 
  at kairos_mobile.Views.AppShell..ctor () [0x00087] in /Users/pablolop002/Projects/Kairos/kairos_mobile/Views/AppShell.xaml.cs:42 
  at kairos_mobile.App..ctor () [0x00151] in /Users/pablolop002/Projects/Kairos/kairos_mobile/App.xaml.cs:99 
  at Kairos.iOS.AppDelegate.FinishedLaunching (UIKit.UIApplication app, Foundation.NSDictionary options) [0x00007] in /Users/pablolop002/Projects/Kairos/Kairos.iOS/AppDelegate.cs:28 
  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/14.8.0.3/src/Xamarin.iOS/UIKit/UIApplication.cs:86 
  at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0000e] in /Library/Frameworks/Xamarin.iOS.framework/Versions/14.8.0.3/src/Xamarin.iOS/UIKit/UIApplication.cs:65 
  at Kairos.iOS.Application.Main (System.String[] args) [0x00001] in /Users/pablolop002/Projects/Kairos/Kairos.iOS/Main.cs:12 
2021-01-20 11:39:55.032 Kairos.iOS[5220:1836293] Unhandled managed exception: Specified cast is not valid. (System.InvalidCastException)
  at Microsoft.Azure.NotificationHubs.Client.NotificationHub.PlatformAddTags (System.String[] tags) [0x00000] in /Users/pablolop002/Projects/Kairos/Microsoft.Azure.NotificationHubs.Client/NotificationHub.ios.cs:119 
  at Microsoft.Azure.NotificationHubs.Client.NotificationHub.AddTags (System.String[] tags) [0x00000] in /Users/pablolop002/Projects/Kairos/Microsoft.Azure.NotificationHubs.Client/NotificationHub.shared.cs:72 
  at kairos_mobile.Views.AppShell..ctor () [0x00087] in /Users/pablolop002/Projects/Kairos/kairos_mobile/Views/AppShell.xaml.cs:42 
  at kairos_mobile.App..ctor () [0x00151] in /Users/pablolop002/Projects/Kairos/kairos_mobile/App.xaml.cs:99 
  at Kairos.iOS.AppDelegate.FinishedLaunching (UIKit.UIApplication app, Foundation.NSDictionary options) [0x00007] in /Users/pablolop002/Projects/Kairos/Kairos.iOS/AppDelegate.cs:28 
  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/14.8.0.3/src/Xamarin.iOS/UIKit/UIApplication.cs:86 
  at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0000e] in /Library/Frameworks/Xamarin.iOS.framework/Versions/14.8.0.3/src/Xamarin.iOS/UIKit/UIApplication.cs:65 
  at Kairos.iOS.Application.Main (System.String[] args) [0x00001] in /Users/pablolop002/Projects/Kairos/Kairos.iOS/Main.cs:12 

To Reproduce
Call NotificationHub.AddTags from the forms project.

Code Snippet

NotificationHub.NotificationMessageReceived += OnNotificationMessageReceived;
NotificationHub.InstallationSaved += OnInstallationSaved;
NotificationHub.InstallationSaveFailed += OnInstallationSaveFailed;
NotificationHub.Start(Constants.ListenConnectionString, Constants.NotificationHubName);
NotificationHub.AddTags(Constants.Tags);

Expected behavior
Tags added to notification hub.

Screenshots
If applicable, add screenshots to help explain your problem.

Setup (please complete the following information):

  • OS: iOS 14.x
  • IDE : Visual Studio for Mac 2019
  • Cloned repo

Additional context
Add any other context about the problem here.

Information Checklist
Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report

  • Bug Description Added
  • Repro Steps Added
  • Setup information Added
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant