Re: File locked problem in c#

From: QPatrik_L=F6wendahl_=5BC=23_MVP=5D=22?= (patrik.lowendahl.no.freakin.spam_at_home.se)
Date: 01/23/05


Date: Sun, 23 Jan 2005 15:21:37 +0100

You should always make sure that you close the streams used to load the
images as well.

Maybe that is the problem you're experiencing?

-- 
Patrik Löwendahl [C# MVP]
http://www.lowendahl.net/ || http://www.cshrp.net
Albert Greinöcker wrote:
> 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
> 
> 
> 


Relevant Pages

  • Re: What happened to this NIC? Any ideas?
    ... Doesn't work in the linux machine afterwards, ... First time that I observe such strange behaviour, ...
    (Linux-Kernel)
  • Re: File locked problem in c#
    ... Albert Greinöcker wrote:> Thanks for your response... ... >>> GC.Collect;>>>}>>>>>>Did anyone observe similar behaviour? ...
    (microsoft.public.dotnet.general)
  • File locked problem in c#
    ... I have a very strange problem within my c# application: ... I can observe very strange behaviour: ... think more than should be necessary to release the file lock) ...
    (microsoft.public.dotnet.general)
  • Re: The Queen and Michelle Obama [OT!]
    ... who knows) was the first time she'd been proud to be an ... will be quite careful about protocol. ... under some slight obligation to observe these medieval shibboleths. ... kissing, obeisance", which rather gives your particular snippy ...
    (rec.music.opera)
  • Re: File locked problem in c#
    ... > Albert Greinöcker wrote: ... some temporary files are created which should be deleted after ... When I call it the first time, ... I think more than should be necessary to release the file lock) ...
    (microsoft.public.dotnet.general)

Loading