Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.programming > #4830

Re: c# .net 4 unable to move file - file in use by another process (by itself)

Newsgroups comp.programming
Date 2014-10-16 12:59 -0700
References <4c284fb9-3878-43e0-9d11-85b7c33ce269@googlegroups.com> <20141016083723.39@kylheku.com>
Message-ID <d360a08c-6357-45df-8118-1fff01d8d4f4@googlegroups.com> (permalink)
Subject Re: c# .net 4 unable to move file - file in use by another process (by itself)
From lachlann@gmail.com

Show all headers | View raw


On Thursday, October 16, 2014 11:41:48 AM UTC-4, Kaz Kylheku wrote:
> On 2014-10-16, lachlann@gmail.com <lachlann@gmail.com> wrote:
> 
> > When i attempt to rename the file from .pending -> .failed i get an error
> 
> > "file is in use by another process". originally this service was
> 
> > multi-threaded so i assumed it was a collision with other threads however
> 
> > upon further investigation i've made it single-threaded and it is still
> 
> > failing. it even happens when stepping through the code using the debugger
> 
> > (VS2010). 
> 
> >
> 
> > I've moved all "file" logic into 3 methods:
> 
> > readfromfile
> 
> > writetofile
> 
> > movefile
> 
> 
> 
> Who closes the handle to release the file? Is it possible that you might be
> 
> leaving that responsibility to a finalization performed by the garbage
> 
> collector?

that should all be wrapped into the .NET 4 File.Move logic, i am not at any point getting the handle i'm simply providing a "from" and "to" filename. the Core method handles all the handles. No pun intended :)

Back to comp.programming | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

c# .net 4 unable to move file - file in use by another process (by itself) lachlann@gmail.com - 2014-10-16 08:08 -0700
  Re: c# .net 4 unable to move file - file in use by another process (by itself) Kaz Kylheku <kaz@kylheku.com> - 2014-10-16 15:41 +0000
    Re: c# .net 4 unable to move file - file in use by another process (by itself) lachlann@gmail.com - 2014-10-16 12:59 -0700
  Re: c# .net 4 unable to move file - file in use by another process (by itself) Justin Marshall <lachlann@gmail.com> - 2015-03-24 12:12 -0700
    Re: c# .net 4 unable to move file - file in use by another process (by itself) CarolHudson <CarolHudson0@yahoo.com> - 2015-04-22 21:05 +0200
  Re: c# .net 4 unable to move file - file in use by another process (by itself) Queego <tonyhecht@gmail.com> - 2015-08-14 19:14 -0500

csiph-web