When my application wakes up, I use System.IO.Directory.Exists with
the UNC as a parameter. If the UNC is mapped, this works fine.
My problem occurs when the UNC does not exist, typically on weekends
when the UNC computer is shut down. I have the
System.IO.Directory.Exists wrapped in a Try Block and have code
execute if it is not found. However, the code is never executed and
it drops into my catch block which logs the exception. However, the
exception is empty.
If Not settingsIris.HL7ResultsFolder Is Nothing Then
If Not System.IO.Directory.Exists
(settingsIris.HL7ResultsFolderUNC) Then
'this code is never called
logger.Error("Results Folder Not Reachable - " &
settingsIris.HL7ResultsFolderUNC)
itsValid = False
End If
End If
If I test this on my pc within my network, and use a UNC that is not
connected, the appropriate code executes.
Is there another method i can use to determine that the Directory
exists?
I'm suspicious of the try catch issue you are having. Do you mean you have:
try
' the code you show...
Catch (ex as exception)
LoggerOrSomething(ex)
end try
and ex is nothing? Is ex _not_nothing_, but the stacktrace and message
properties are nothing?
--
Mike
I looked into the logfile and found these 2 rows:
2009-12-28 17:20:06.9618|TRACE|CLPThunder.CLPThunder|
CLPThunder.CLPThunder.GetSystemInfo|Unable to obtain free space.
Error #53.||EventHandler.Invoke => CLPThunder.CLPThunder_Load =>
CLPThunder.GetSystemInfo
2009-12-28 17:20:07.0087|ERROR|CLPThunder.CLPThunder|
CLPThunder.CLPThunder.ValidSettings|Results Folder Not Reachable - \
\scserver\garydesir\irisfiles\||CLPThunder.CheckForFiles =>
CLPThunder.GetFiles => CLPThunder.ValidSettings
they were not passing me the error portion:
Results Folder Not Reachable - \\scserver\garydesir\irisfiles\
in the email message
Thanx. i should have checked that first.
> Is there another method i can use to determine that the Directory
> exists?
Directory.Exists()?
your code attempts to create the directory reference and then test. You can
also test first and then avoid even trying to create it. I would still
leave an exception handler, as the chance of failure is pretty good.
peace and grace,
--
Gregory A. Beamer (MVP)
Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com
*******************************************
| Think outside the box! |
*******************************************