title: Why can't my WritableBitmap be found through the IRandomAccessStream?
body: <p>I have a WritableBitmap that was created from a snapshot from a webcam. I want to load it into a BitmapDecoder so I can crop the image. Here is the code:</p>
  
  <pre><code>IRandomAccessStream ras = displaySource.PixelBuffer.AsStream().AsRandomAccessStream();
  BitmapDecoder decoder = await BitmapDecoder.CreateAsync(ras); //Fails Here
  </code></pre>
  
  <p>displaySource is the WritableBitmap from the webcam and the exception I get is</p>
  
  <p><em>{"The component cannot be found. (Exception from HRESULT: 0x88982F50)"}</em></p>
  
  <p>This is odd to me because I can load displaySource onto my GUI, I just can't use this code. I have tried switching it to InMemoryRandomAccessStream as well. There is not any stackoverflow solution for this exception from what I see.</p>
  
  <p>The displaySource is generated from this code:</p>
  
  <pre><code>                // Create a WritableBitmap for our visualization display; copy the original bitmap pixels to wb's buffer.
                  // Note that WriteableBitmap doesn't support NV12 and we have to convert it to 32-bit BGRA.
                  using (SoftwareBitmap convertedSource = SoftwareBitmap.Convert(previewFrame.SoftwareBitmap, BitmapPixelFormat.Bgra8))
                  {
                      displaySource = new WriteableBitmap(convertedSource.PixelWidth, convertedSource.PixelHeight);
                      convertedSource.CopyToBuffer(displaySource.PixelBuffer);
                  }
  </code></pre>
  
  <p>where preview frame is a VideoFrame setup from the webcam.</p>
  
  <p>Thanks in advance.</p>