title: Loading an image file in WinRT
body: <p>I have a WinRT project, and am getting an error when trying to preview an image.  I have set capabilities to allow access to the Pictures library, and am using the following code:</p>
  
  <pre><code> var file = await Windows.Storage.KnownFolders.PicturesLibrary.GetFileAsync(path);
   var fileStream = await file.OpenAsync(Windows.Storage.FileAccessMode.Read);
   var img = new BitmapImage();
   img.SetSource(fileStream);
  </code></pre>
  
  <p>This error occurs on the first line:</p>
  
  <pre><code>A first chance exception of type 'System.Runtime.InteropServices.COMException' occurred in mscorlib.dll
  
  Additional information: Error HRESULT E_FAIL has been returned from a call to a COM component.
  </code></pre>
  
  <p>I've tried other operations, such as <code>folder.GetFilesAsync()</code> with the same error.  Is there another or capability that I need to allow this functionality to work correctly?</p>
  
  <p>EDIT:</p>
  
  <p>Based on @L.T.s answer, I tried some other capabilities.  The following gives me the same error:</p>
  
  <pre><code>var folder = KnownFolders.PicturesLibrary;            
  var files = await folder.GetFilesAsync();
  </code></pre>
  
  <p>However (obviously, providing I provide the Music capability) this does not:</p>
  
  <pre><code>var testfolder = KnownFolders.MusicLibrary;
  var files = await testfolder.GetFilesAsync();
  </code></pre>
  
  <p>I don't doubt that this it something specific to my Pictures library, but I have no idea what that could be.</p>