title: Unable to create BItmapImage inside separate Task
body: <p>I am working on an imaging application for WP8 (Lumia 920).
  I am coding in C# in the xaml layer.</p>
  
  <p>I experience problems while trying to create a new BitmapImage object in a separate task, which is expected to use the frames as they are generated by the camera app.</p>
  
  <p>Here is a reduced version of my code:</p>
  
  <pre><code>public void ProcessFrames(){
      while (true)
      {
          dataSemaphore.WaitOne();
          if (nFrameCount&gt;0)
          {
              MemoryStream ms = new MemoryStream(previewBuffer1);
  
              BitmapImage biImg = new BitmapImage();  // *******THROWS AN ERROR AT THIS LINE ********
              biImg.SetSource(ms);
  
              ImageSource imgSrc = biImg as ImageSource;
              capturedFrame.Source = imgSrc;
          }
      }
  }
  
  public MainPage()
  {
      InitializeComponent();
      T1 = new Thread(ProcessFrames);
      T1.Start();
  }
  </code></pre>
  
  <p>Now, the surprising part is that I don't get the error at "new BitmapImage()" in case I do the same inside one of the main functions, for example:</p>
  
  <pre><code>public MainPage()
  {
      InitializeComponent();
      BitmapImage biImg = new BitmapImage();    // ****** NO ERROR ***********
      T1 = new Thread(ProcessFrames);
      T1.Start();
  }
  </code></pre>
  
  <p>Can anyone help me understand the reason for such a behaviour. My requirement is to be able to use the preview buffer (previewBuffer1) and display it in one of the image frames. This requires me to create a new BitmapImage in the separate task.</p>