Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

A first chance exception of type 'System.UnauthorizedAccessException' occurred in Microsoft.Phone.ni.dll

I have a windows phone 8 application running on its emulator from Visual Studio 2012 environment. I implemented the logic to be able to send toast push notifications to this app. When it comes to the code snippet below in the MainPage constructor, I receive the exception outlined in the subject line:

// try to find the channel
pushChannel = HttpNotificationChannel.Find(channelName);

Also, the information below is given out by the exception:

Access to Push Notifications requires ID_CAP_PUSH_NOTIFICATION to be defined in the manifest.

What could be wrong or what I am missing that I receive such an exception. Please note that I am running VS 2012 environment under administrator account with full privileges.

Thanks!

like image 902
Arash Avatar asked Dec 15 '22 11:12

Arash


1 Answers

In the Solution Explorer of the Visual Studio

  1. Expand the "Properties" node of the project.
  2. Open the "WMAppManifest.xml" file from the "Properties" panel.
  3. Navigate to the "Capabilities" tab
  4. Check the button "ID_CAP_PUSH_NOTIFICATION" if it is not checked.
like image 74
d.lavysh Avatar answered Jan 19 '23 19:01

d.lavysh