A
Albert Greinöcker
Hi ng,
I have a very strange problem within my c# application:
One of the (background) Threads in my application is responsible for some
image processing tasks (like resizing, clipping, ..) on a list of files.
Therefore, some temporary files are created which should be deleted after
processing is finished.
This Thread is called several times. When I call it the first time,
everything's ok and no errors occur.
In the second call, I can observe very strange behaviour: I cannot delete
the temporary files created by this thread, but I'm sure that all image and
bitmap-objects are disposed after processing (with this method,which is, I
think more than should be necessary to release the file lock)
private static void DisposeImage(Image image)
{
image.Dispose();
image = null;
GC.Collect();
}
Did anyone observe similar behaviour? Does anyone have any ideas what could
be the reason for this annoying file locks (e.g. error in threading or
whatever..)
Or, how could a workaround look like (which means how can I unlock a file
which was created by the same thread)
thx,
Albert
I have a very strange problem within my c# application:
One of the (background) Threads in my application is responsible for some
image processing tasks (like resizing, clipping, ..) on a list of files.
Therefore, some temporary files are created which should be deleted after
processing is finished.
This Thread is called several times. When I call it the first time,
everything's ok and no errors occur.
In the second call, I can observe very strange behaviour: I cannot delete
the temporary files created by this thread, but I'm sure that all image and
bitmap-objects are disposed after processing (with this method,which is, I
think more than should be necessary to release the file lock)
private static void DisposeImage(Image image)
{
image.Dispose();
image = null;
GC.Collect();
}
Did anyone observe similar behaviour? Does anyone have any ideas what could
be the reason for this annoying file locks (e.g. error in threading or
whatever..)
Or, how could a workaround look like (which means how can I unlock a file
which was created by the same thread)
thx,
Albert