iOS app fails when deployed to TestFlight using NotificationHubClient
See original GitHub issueDescription
Maui for iOS works on debug when running visual studio 2022 preview for Mac on macbook and deploying on iPhone device but fails when installed on Iphone using TestFlight. Using NotificationHubClient
nuget package: Microsoft.Azure.NotificationHubs 4.1.0
These are the code snippets;
public async Task<bool> IsDeviceRegisteredForNotificationsAsync()
{
var list = await _client.GetRegistrationsByChannelAsync(CleanDeviceToken(), 100);
var deviceIsRegistered = list.Any();
return deviceIsRegistered;
}
public async Task RegisterForNotifications(IEnumerable<string> tags)
{
var trimmedDeviceToken = await SecureStorage.GetAsync(Constants.DeviceTokenKey);
if (trimmedDeviceToken == null || trimmedDeviceToken.Length == 0)
return;
var deviceRegisters = await _client.GetRegistrationsByChannelAsync(trimmedDeviceToken, 100);
if (!deviceRegisters.Any())
{
await _client.CreateAppleNativeRegistrationAsync(trimmedDeviceToken, tags);
await _client.CreateAppleTemplateRegistrationAsync(trimmedDeviceToken, Constants.APNTemplateBody, tags);
}
}
Steps to Reproduce
- Checked in working code to Azure Devops repository.
- Merged code to master branch
- CI pipelines kicks off
- IPA file is generated
- Run Release to deploy signed ipa file
- App is deployed to TestFlight
- Install the app to my iPhone.
- Open the app
- Successfully logged in
- Throws an error when it get to NotificationHubClient lines. Please see logs
System.Runtime.Serialization.XmlObjectSerializerReadContext.ThrowRequiredMemberMissingException(XmlReaderDelegator xmlReader, Int32 memberIndex, Int32 requiredIndex, XmlDictionaryString[] memberNames) System.Runtime.Serialization.SerializationException: ErrorInLine, 1, 1162 UnexpectedElementExpectingElements, Element, DeviceToken, http://schemas.microsoft.com/netservices/2010/10/servicebus/connect, PushVariables
Link to public reproduction project repository
N/A
Version with bug
6.0.424
Last version that worked well
6.0.424
Affected platforms
iOS
Affected platform versions
ios 15.7, ios 16
Did you find any workaround?
No
Relevant log output
* System.Runtime.Serialization.XmlObjectSerializerReadContext.ThrowRequiredMemberMissingException(XmlReaderDelegator xmlReader, Int32 memberIndex, Int32 requiredIndex, XmlDictionaryString[] memberNames)
System.Runtime.Serialization.XmlObjectSerializerReadContext.GetMemberIndexWithRequiredMembers(XmlReaderDelegator xmlReader, XmlDictionaryString[] memberNames, XmlDictionaryString[] memberNamespaces, Int32 memberIndex, Int32 requiredIndex, ExtensionDataObject extensionData)
System.Runtime.Serialization.ReflectionXmlReader.ReflectionReadMembers(XmlReaderDelegator , XmlObjectSerializerReadContext , XmlDictionaryString[] , XmlDictionaryString[] , ClassDataContract , Object& )
System.Runtime.Serialization.ReflectionReader.ReflectionReadClass(XmlReaderDelegator , XmlObjectSerializerReadContext , XmlDictionaryString[] , XmlDictionaryString[] , ClassDataContract )
System.Runtime.Serialization.ReflectionXmlClassReader.ReflectionReadClass(XmlReaderDelegator , XmlObjectSerializerReadContext , XmlDictionaryString[] , XmlDictionaryString[] )
System.Runtime.Serialization.ClassDataContract.ReadXmlValue(XmlReaderDelegator , XmlObjectSerializerReadContext )
System.Runtime.Serialization.XmlObjectSerializerReadContext.ReadDataContractValue(DataContract , XmlReaderDelegator )
System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, Type declaredType, DataContract& dataContract)
System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator xmlReader, Type declaredType, DataContract dataContract, String name, String ns)
System.Runtime.Serialization.DataContractSerializer.InternalReadObject(XmlReaderDelegator , Boolean , DataContractResolver )
System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator , Boolean , DataContractResolver )
System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator , Boolean )
System.Runtime.Serialization.DataContractSerializer.ReadObject(XmlReader )
Microsoft.Azure.NotificationHubs.Messaging.EntityDescriptionSerializer.Deserialize(XmlReader reader, String typeName)
Microsoft.Azure.NotificationHubs.NotificationHubClient.<ReadEntityAsync>d__205`1[[Microsoft.Azure.NotificationHubs.AppleRegistrationDescription, Microsoft.Azure.NotificationHubs, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]].MoveNext()
Microsoft.Azure.NotificationHubs.NotificationHubClient.<>c__DisplayClass195_0`1.<<CreateOrUpdateRegistrationImplAsync>b__0>d[[Microsoft.Azure.NotificationHubs.AppleRegistrationDescription, Microsoft.Azure.NotificationHubs, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]].MoveNext()
Microsoft.Azure.NotificationHubs.NotificationHubRetryPolicy.<RunOperation>d__4`1[[Microsoft.Azure.NotificationHubs.AppleRegistrationDescription, Microsoft.Azure.NotificationHubs, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]].MoveNext()
Microsoft.Azure.NotificationHubs.NotificationHubRetryPolicy.<RunOperation>d__4`1[[Microsoft.Azure.NotificationHubs.AppleRegistrationDescription, Microsoft.Azure.NotificationHubs, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]].MoveNext()
Microsoft.Azure.NotificationHubs.NotificationHubClient.<CreateOrUpdateRegistrationImplAsync>d__195`1[[Microsoft.Azure.NotificationHubs.AppleRegistrationDescription, Microsoft.Azure.NotificationHubs, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]].MoveNext()
App.Client.Core.Infrastructure.Notifications.NotificationManager.RegisterForNotifications(IEnumerable`1 tags)
App.Client.Maui.ViewModels.LoginPageViewModel.RequestLogin()
Issue Analytics
- State:
- Created 10 months ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
ios - Some registrations don't seem to be registered in ...
Once we switched the Notification Hub to the production APNS endpoint, all the TestFlight users were able to receive notifications because ...
Read more >Push notifications not reaching my device
To test that my Azure notification hub was working I sent a test message from www.pushtry.com and that said the message was sent...
Read more >[Resolve]-Azure Notifications hub .net api not working async
I have followed this tutorial to create a push notification hub for an IOS app. When i run the code private static async...
Read more >Azure Hub Notifications aren't received on iPhones
The notifications are received on iPhones when debugging in Debug mode, when the packages are created in Release mode, we see the notifications ......
Read more >Azure Notification Hub Application mode using production ...
When I am debugging locally, i am using a development provision profile, and I never managed to receive any notification. As for today,...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Thanks to @rolfbjarne and @jfversluis. I really appreciate your help.
Thanks @jfversluis