When using the PhoneCallTask (below code snippet) in Windows Phone 8 , i got an error “An unhandled exception of type ‘System.UnauthorizedAccessException’ occurred in System.Windows.ni.dll”.
using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Shapes; using Microsoft.Phone.Controls; using Microsoft.Phone.Tasks; namespace PhoneApp3 { public partial class MainPage : PhoneApplicationPage { // Constructor public MainPage() { InitializeComponent(); // SK To demonstrate PhoneCall Task Error PhoneCallTask task = new PhoneCallTask(); task.PhoneNumber = "1111111111"; task.Show(); } } }
You could avoid this error in Windows Phone Project by enabling (checking) the option ID_CAP_PHONEDIALER in the WMAppManifest.xml file of your Windows Phone Project .
Save the project with the above changes and build and run the project . You should see no exception after this 🙂