title: How do I detect a BitmapImage failing to load?
body: <p>I have the following code to load an image from a url.  If the url doesn't exist, a placeholder should be loaded instead.</p>
  
  <pre><code>public BitmapImage Image
  {
      get
      {
          if (m_image == null)
          {
              try
              {
                  BitmapImage image = new BitmapImage();
                  image.BeginInit();
                  image.UriSource = new Uri(m_photoPath);
                  image.DecodePixelHeight = s_imagePixelHeight;
                  image.EndInit();
                  m_image = image;
              }
              catch (FileNotFoundException)
              {
                  BitmapImage image = new BitmapImage();
                  image.BeginInit();
                  image.UriSource = new Uri(c_placeholderImagePath);
                  image.DecodePixelHeight = s_imagePixelHeight;
                  image.DecodePixelWidth = s_imagePixelWidth;
                  image.EndInit();
                  m_image = image;
              }
          }
          return m_image;
      }
  }
  </code></pre>
  
  <p>I'm getting the weirdest error - when <code>m_photoPath</code> is a url which causes a 404 in any browser, no exception is thrown.  I've tried checking if the file exists by using an <code>HttpWebRequest</code>, but everytime I call <code>[HttpWebRequest instance].GetResponse()</code>, there's a really, really long timeout (possibly infinite - I haven't waited around to find out).  So <code>HttpWebRequest</code> isn't an option.  Any ideas?</p>