Unauthorized exception error?

Mar 17, 2014 at 7:39 PM
Edited Mar 17, 2014 at 7:41 PM
Hi guys,

Quick question, I'm getting a "System Unauthorized Access Exception" in my SLARToolkit solution, I'm using a Windows Phone 8S Rio by HTC and using the ATT Nokia session solution code found HERE, I open a page from the main menu on my app which is meant to go straight to the camera which then shows the augmented reality view, the code checks out, no errors, however when I go to live testing on the device in debug mode, it throws up an error on a specific part of the code, that code being:
 // Check to see if the camera is available on the device.
            if ((PhotoCamera.IsCameraTypeSupported(CameraType.Primary) == true) ||
                 (PhotoCamera.IsCameraTypeSupported(CameraType.FrontFacing) == true))
            {
                InitiliseCaptureCamera();
            }
            else
            {
                // Notify user the camera is not supported on the device.
                this.Dispatcher.BeginInvoke(delegate()
                {
                    // Write message.
                    txtDebug.Text = "A Camera is not available on this device.";
                }); 
The specific code being thrown up and highlighted by the Unauthorized error is this
 // Check to see if the camera is available on the device.
            if ((PhotoCamera.IsCameraTypeSupported(CameraType.Primary) == true) ||
                 (PhotoCamera.IsCameraTypeSupported(CameraType.FrontFacing) == true))
I don't understand? It's a check to see if the device has a camera or not, implemented as a safeguard for Windows Phones that don't (I can't think of many) and looks good in my project as a means of validation as this is for my University dissertation. Any ideas on how I can resolve this? if any additional info is required please let me know. Thanks in advance.

Logix
Mar 17, 2014 at 8:05 PM
Edited Mar 17, 2014 at 8:09 PM
UPDATE: I've managed to resolve the above error, turns out it was to do with the capabilities for camera access being unchecked in the WMAppManifest.xml file. However now it's throwing up a "System.NullReferenceException occurred in SLARToolKitWinPhone.DLL" Error on this line of code found in a "Marker.cs" document:
 private static Marker LoadFromResource(string relativePath, int segmentsX, int segmentsY, double width, System.Reflection.Assembly assembly)
      {
         var asmName = new System.Reflection.AssemblyName(assembly.FullName).Name;
         using (var markerStream = Application.GetResourceStream(new Uri(asmName + ";component/" + relativePath, UriKind.Relative)).Stream)
         {
            return Load(markerStream, segmentsX, segmentsY, width);
         }
      }
Specifically highlighting, this line:
using (var markerStream = Application.GetResourceStream(new Uri(asmName + ";component/" + relativePath, UriKind.Relative)).Stream)
Any ideas?
Mar 18, 2014 at 5:14 PM
UPDATE 2: Also managed to solve this by simply importing the .PAT marker files into the library in the given folder structure (being data/MARKERFILE.PAT).
Marked as answer by logikurl on 3/18/2014 at 10:15 AM