This project has moved and is read-only. For the latest updates, please go here.

Problem with file: uri

Dec 5, 2013 at 4:09 AM
Hi Clemens et all,

I´ve been using 1.3.8 version with file: uri without problems. Today I´ve moved to the latest version and noticed that this types of uri are not recognized.
What I see is that:
        private static ImageSource CreateImage(string path)
            ImageSource image = null;

            if (File.Exists(path))
                    using (var stream = new FileStream(path, FileMode.Open, FileAccess.Read))
                        image = BitmapFrame.Create(stream, BitmapCreateOptions.None, BitmapCacheOption.OnLoad);
                catch (Exception ex)
                    Trace.TraceWarning("Creating tile image failed: {0}", ex.Message);

            return image;
fails on the File.Exists check.

For exmaple, when calling the method with:
Which exists on my local drive, the check will return false.

Any clue why could this be happening?

Thanks & regards,
Dec 5, 2013 at 9:20 AM
Hi Fernando,

The problem is that the current version uses Uri.AbsolutePath to get the local file name, which does not replace %20 by a space character. It should use Uri.LocalPath instead. I will provide a new release tonight, which fixes the problem.

Dec 5, 2013 at 11:36 AM
Thanks Clemens ... and sorry, I´ve just noticed that this was already discussed on the previous thread.
Dec 5, 2013 at 5:03 PM
Please check out the latest version.