Occasionally some users of our software report issues that are caused by wired DirectoryNotFoundException exceptions. This happens only to some users running Vista. Not all users running Vista have this problem. There were no reports of this issue from users running Win7 or XP (however that does not prove that this issue does not happen on these systems – we just don’t have such reports).
Our software stores some graphics data inside ProgramData folder. When program tries to read those files the following exception is thrown:
Message: Could not find a part of the path 'C:\ProgramData\My App Name\Subfolder\Subfolder'.
mscorlib
in System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
in System.IO.Directory.InternalGetFileDirectoryNames(String path, String userPathOriginal, String searchPattern, Boolean includeFiles, Boolean includeDirs, SearchOption searchOption)
in System.IO.Directory.GetFiles(String path, String searchPattern, SearchOption searchOption)
in System.IO.Directory.GetFiles(String path)
The path is C:\ProgramData\My App Name\Subfolder\Subfolder. Folder exists – I’m 100% sure. It was created by NSIS installer. It’s writeable to all users (or at least it should be as that’s how we set it with NSIS script). User confirms that the folder exists – he is able to navigate to that location using Windows Explorer.
At first I thought it was the UAC issue, but the exception says Could not find a part of the path. This drives me crazy as we are unable to reproduce the issue on our test systems. No matter the configuration. XP, Vista, Win7 – on our machines it just works.
Finally we found a user that had the same issue and was willing to help with testing. The root cause of this error seems to be the NSIS installer which creates folder with one wrong character. No one noticed that because that char looks almost identical to the one that was supposed to be created. So
DirectoryNotFoundExceptionwas indeed right.The NSIS was supposed to create a folder with ń char
but instead created a folder with ñ char
The wired part is that happens only on some machines and we could not reproduce that.
Lesson for today: never fully trust your users when it comes to debugging. Even screenshot provided by the user was misleading as it displayed only contents of the folder in question.