title: WPF BitmapSource ImageSource
body: <p>I am binding an Image.Source property to the result of the property shown below. </p>
  
  <pre><code>public BitmapSource MyImageSource
  {
      get
      {
          BitmapSource source = null;
  
          PngBitmapDecoder decoder;
          using (var stream = new FileStream(@"C:\Temp\logo.png", FileMode.Open, FileAccess.Read, FileShare.Read))
          {
              decoder = new PngBitmapDecoder(stream, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.None);
  
              if (decoder.Frames != null &amp;&amp; decoder.Frames.Count &gt; 0)
                  source = decoder.Frames[0];
          }
  
          return source;
      }
  }
  </code></pre>
  
  <p>For some reason this is failing during the rendering of the image (Deep in the PresentationCore assembly). I am certain the image is not corrupt as I can successfully show the same image w/o the binding </p>
  
  <pre><code>&lt;Image Name="FooImage" Source="/logo.png" /&gt;
  </code></pre>
  
  <p>I have to bind the image source in code because I will eventually be creating the image stream from a base64 string. </p>
  
  <p>Anyone know if this is a bug w/ WPF? or am I doing something incorrectly?</p>