zimmer9
asked on
How to handle an IO Exception in code because when the error "System.IO.IOException" occurs, the exe continues to run and the operator has to manually kill the process on the windows server?
I created an exe from the attached source code (see attached B.TXT file). Do you know how I could revise this code to have the executable end gracefully when the following exception occurs?
Unhandled Exception: System.IO.IOException: The process cannot access the file because it is being used by another process.
at System.IO.__Error.WinIOErr or(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalMov e(String sourceFileName, String destFileName, Boolean checkHost)
at System.IO.File.Move(String sourceFileName, String destFileName)
at ReadXML2.FileTest.ProcessF ile(String filePathIn, String filePathOut1, String filePathOut2, String filePathOut3)
at ReadXML2.FileTest.Main()
B.txt
Unhandled Exception: System.IO.IOException: The process cannot access the file because it is being used by another process.
at System.IO.__Error.WinIOErr
at System.IO.File.InternalMov
at System.IO.File.Move(String
at ReadXML2.FileTest.ProcessF
at ReadXML2.FileTest.Main()
B.txt
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.