.NET BitmapSource is locking file
I am using this C# code to access an image file in order to read metadata from it.

    BitmapSource img = BitmapFrame.Create(uri);

Unfortunately the image file specified by `uri` becomes locked until the program ends. How do I prevent the image from being locked?
.NET BitmapSource is locking file
===

I am using this C# code to access an image file in order to read metadata from it.

    BitmapSource img = BitmapFrame.Create(uri);

Unfortunately the image file specified by `uri` becomes locked until the program ends. How do I prevent the image from being locked?