title: how Dispose / close stream of "TiffBitmapDecoder"
body: <pre><code>var filePath= @&quot;c:\user\image.tif&quot;;
  TiffBitmapDecoder TifDec = new TiffBitmapDecoder(new Uri(path), BitmapCreateOptions.IgnoreImageCache, BitmapCacheOption.OnDemand);
  File.Delete(pathFile);
  </code></pre>
  <p>is throw exception &quot;System.IO.IOException: 'The process cannot access the file 'c:\user\image.tif' because it is being used by another process.&quot;</p>
  <p>this code not working</p>
  <pre><code>var filePath = @&quot;c:\user\image.tif&quot;;
  TiffBitmapDecoder TifDec = new TiffBitmapDecoder(new Uri(filePath), BitmapCreateOptions.IgnoreImageCache, BitmapCacheOption.OnDemand);
  TifDec.Dispatcher.InvokeShutdown();
  TifDec.Dispatcher.DisableProcessing();
  while (!TifDec.Dispatcher.HasShutdownFinished)
      Thread.Sleep(10);
  File.Delete(filePath);
  </code></pre>
  <p><a href="https://i.stack.imgur.com/n0vFy.png" rel="nofollow noreferrer">Error screenshot</a></p>