access issue (file is in use)

Questions, comments and suggestions concerning VintaSoft Imaging .NET SDK.

Moderator: Alex

Post Reply
danheskett
Posts: 1
Joined: Mon Nov 29, 2010 6:46 am

access issue (file is in use)

Post by danheskett »

I have an application that displays an image in the viewer control for the user to inspect, and then after making some keystrokes, the image is intended to be renamed.

The problem is that often / most of the time the rename function fails, an IOException thrown because the source file is in use.

I have tried:

- Dispose the image [viewer.Images.Item(0).Dispose()]
- Dispose of the whole thing [viewer.Images.ClearAndDisposeItems()[
- Both of the above
- All of the above with a forced GC.Collect / GC.WaitForPendingFinalizers
- All of that, plus some misc. sleep commands
- All of that, plus viewer.Dispose.

Any ideas? This is a real potential problem - how do I really, totally, completely close an image and be sure that I can access that file consistently?
Alex
Site Admin
Posts: 2303
Joined: Thu Jul 10, 2008 2:21 pm

Re: access issue (file is in use)

Post by Alex »

Hello,

Please send the demo application which demonstrates your problem to support@vintasoft.com.

Best regards, Alexander
techno
Posts: 1
Joined: Wed Dec 01, 2010 3:29 pm

Re: access issue (file is in use)

Post by techno »

Hello!

I have the same Problem.
I have an WinForm with one Thumbnailviewer and one Imageviewer. I show thumbs left side and the user can choose each picture to see it right in the imageviewer.
I added an contectMenu to the Thumbnailviewer with the "delete" option. Always i use delete i get the io exception with "file is in use"....
Where is my error?

Best regards,
Christian

Private Sub delete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles löschen.Click

Dim DateiName As String = ThumbnailViewer1.FocusedImage.SourceInfo.Filename

ThumbnailViewer1.Images.RemoveAt(ThumbnailViewer1.FocusedIndex)

If ImageViewer1.Images.Count > 0 Then
ImageViewer1.Images.ClearAndDisposeItems()
End If

ImageViewer1.ThumbnailViewer = Nothing

ThumbnailViewer1.Images.ClearAndDisposeItems()
ThumbnailViewer1.Refresh()
ThumbnailViewer1.Update()

If File.Exists(DateiName) Then
Try
File.Delete(DateiName)
Catch ex As Exception
MsgBox("Das Bild " & DateiName & " konnte nicht gelöscht werden!" & vbNewLine & ex.ToString, MsgBoxStyle.Critical)
End Try
End If
ImageViewer1.ThumbnailViewer = ThumbnailViewer1

Call Thumbs_ReNew()
End Sub
Alex
Site Admin
Posts: 2303
Joined: Thu Jul 10, 2008 2:21 pm

Re: access issue (file is in use)

Post by Alex »

Hello,

Thank you for your messages. We have fixed the bug in version 4.3.5.1 of VintaSoftImaging.NET SDK.

Best regards, Alexander
Post Reply