title: System.UnauthorizedAccessException' occurred in Microsoft.Xna.Framework.ni.dll raised Screenshot windows phone 8
body: <p>I am attempting to capture a screenshot and save it as jpeg into the <code>MediaLibrary</code> but received</p>
  
  <blockquote>
    <p>A first chance exception of type System.UnauthorizedAccessException
    occurred in Microsoft.Xna.Framework.ni.dll at
    lib.SavePicture(filePath, ms);</p>
  </blockquote>
  
  <p>My code: </p>
  
  <pre><code>public static void SaveToMediaLibrary(FrameworkElement element, string title)
  {
      using (MemoryStream ms = new MemoryStream())
      {
          bmp.SaveJpeg(ms, (int)element.ActualWidth, (int)element.ActualHeight, 0, 100);
          var lib = new MediaLibrary();
          var filePath = string.Format(title + ".jpg");
          ms.Seek(0, SeekOrigin.Begin); 
          lib.SavePicture(filePath, ms);
      }
  }
  </code></pre>
  
  <p>I am using Windows Phone 8 emulator for the test. What am I missing?</p>