Hello,
I am writing out serialized objects every step of an application to achieve
state at all times in case the system fails for some reason.  Upon restart I
check for these state files, deserialize them and process.  I am getting the
following error however.  How can I get the file released so I can over
right it every step?

FILEWATCHER | FWE00000 | a0547dc1-840c-4bfb-9b83-0edcba893514 | TDF02 - An
Error Occurred In File Watcher: CopyMoveDelete: Precopy: The process cannot
access the file "C:\TEMP\FileWatcher\TravisDFalls\State\IDs\TDF02.state"
because it is being used by another process. at 8/8/2005 8:39:38 PM

//Class level Variable
private static object syncRoot2 = new Object();


public void DoSerialize(String Path, object o) {
        lock (syncRoot2) {
                DoMessaging("FW000016", Path, DateTime.Now);
                FileInfo fi = new FileInfo(Path);
                if (this.DoesFileExist(fi)) 
                        fi.Delete();    
                Stream myFileStream = fi.Create();
                BinaryFormatter serializer = new BinaryFormatter();
                serializer.Serialize(myFileStream, o);
                
                myFileStream.Close();           
                serializer = null;
                myFileStream = null;
                fi = null;
                DoGarbageCollection();
        }
}


*************************************************************************
PRIVILEGED AND CONFIDENTIAL: This communication, including attachments, is
for the exclusive use of addressee and may contain proprietary,
confidential and/or privileged information.  If you are not the intended
recipient, any use, copying, disclosure, dissemination or distribution is
strictly prohibited.  If you are not the intended recipient, please notify
the sender immediately by return e-mail, delete this communication and
destroy all copies.
*************************************************************************



------------------------ Yahoo! Groups Sponsor --------------------~--> 
<font face=arial size=-1><a 
href="http://us.ard.yahoo.com/SIG=12hv9kol5/M=362335.6886445.7839731.1510227/D=groups/S=1705006764:TM/Y=YAHOO/EXP=1123555403/A=2894361/R=0/SIG=13jmebhbo/*http://www.networkforgood.org/topics/education/digitaldivide/?source=YAHOO&cmpgn=GRP&RTP=http://groups.yahoo.com/";>In
 low income neighborhoods, 84% do not own computers. At Network for Good, help 
bridge the Digital Divide!</a>.</font>
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to