Azure Notification Hub not working in WUP app made on Unity3D

I’m trying to use Azure Notification Hub to handle my MPNS WUP app notifications on a Unity3D generated project.

I used the following article to setup it in Visual Studio 2015 on the generated project: Getting started with Notification Hubs for Windows Universal Platform Apps

The app compiles and once it runs the following async code…

var result = await hub.RegisterNativeAsync(channel.Uri);

…the console prints the following log:

Exception thrown: 'System.Runtime.InteropServices.COMException' in Microsoft.WindowsAzure.Messaging.Managed.dll
WinRT information: ResourceMap Not Found.

Exception thrown: 'System.TypeInitializationException' in Microsoft.WindowsAzure.Messaging.Managed.dll
Exception thrown: 'System.AggregateException' in mscorlib.ni.dll
Exception thrown: 'System.AggregateException' in mscorlib.ni.dll
Exception thrown: 'System.AggregateException' in mscorlib.ni.dll
Exception thrown: 'Microsoft.WindowsAzure.Messaging.RegistrationException' in Microsoft.WindowsAzure.Messaging.Managed.dll
Exception thrown: 'Microsoft.WindowsAzure.Messaging.RegistrationException' in mscorlib.ni.dll
Exception thrown: 'Microsoft.WindowsAzure.Messaging.RegistrationException' in mscorlib.ni.dll
Exception thrown: 'Microsoft.WindowsAzure.Messaging.RegistrationException' in mscorlib.ni.dll
Exception thrown: 'Microsoft.WindowsAzure.Messaging.RegistrationException' in mscorlib.ni.dll
OnWebCamTextureToMatHelperDisposed
(Filename: C:\buildslave\unity\build\artifacts/generated/Metro/runtime/UnityEngineDebugBindings.gen.cpp Line: 45)


Exception thrown: 'Microsoft.WindowsAzure.Messaging.RegistrationException' in mscorlib.ni.dll
Unhandled 'Platform.COMException' exception caught! - 'The text associated with this error code could not be found.

The type initializer for 'Microsoft.WindowsAzure.Messaging.Http.Resources' threw an exception.', Sender: '<null>'. Missing try/catch blocks.
(Filename: C:\buildslave\unity\build\PlatformDependent/MetroPlayer/MetroDebug.cpp Line: 41)

My current setup is:

  • Unity3D 5.4.3p4
  • Visual Studio 2015
  • WindowsAzure.Messaging.Managed 0.1.7.9 (I also tried with 0.1.7.8 that is used in the getting started article)
1 Like

This doesn’t really look like something Unity could affect. Did you try debugging it? Does the same not happen in a UWP application without Unity? Are you sure you’re calling that API from the correct thread?

Hello @Tautvydas-Zilys thanks for your answer.
After that we tested on a native WUP project using the same how-to article and had the same problem.

In the end we discovered it was not related to Unity at all but to the Azure Account.
The Pricing Tier on the the Microsoft Azure Notification Hub was defined as Free (limit to 500 Active Devices), after changing it to Basic (limit to 200K Active Devices) the exception is gone.

This was a really bad experience and took some days for our team to find out the reason as the exception has no real link to the actual issue nor the Microsoft Azure Dashboard has any notification related to the limit on the push registrations.

Hi guys,
I’m trying to find a solution to integrate Notification Hubs to my unity app. So do you guys have any guide about it?