var di = new DirectoryInfo(Root);
var diList = di.GetDirectories();
The above crashes when accessing the text path 'Root' that is located on the network. I only occurs when a user first logs into Windows 7 (not tested on other OS's). If a user uses windows Explorer to navigate to the specified path, then di is able to retrieve the directories.
I know doing a catch and prompting the user to click a link that opens windows explorer and navigates to the path can be done but I'm not one for work arounds. I want my program to be able to establish the connection to the network path without requiring Windows explorer to do it first.
The exception:
System.IO.IOException: The network name cannot be found.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileSystemEnumerableIterator`1.CommonInit()
at System.IO.FileSystemEnumerableIterator`1..ctor(String path,string originalUserPath,
String searchPattern, SearchOption searchOption, SearchResultHandler`1 resultHandler,
Boolean checkHost)
at System.IO.DirectoryInfo.InternalGetDirectories(String searchPattern,
SearchOption searchOption) at Controls.ValidationControl.LoadDBox(Object sender,
RoutedEventArgs e)
in c:\Controls\ValidationControl.xaml.cs:line 1010
Thank you in advance for your support, John