Note that there are some explanatory texts on larger screens.

plurals
  1. POCompact framework - cannot read directory contents - winioerror
    text
    copied!<p>I have many Windows CE 5 devices in the field, running our software. </p> <p>Part of their duty is to zip up some directories, and send to the server. </p> <p>On about 3 (of several hundred) devices, I get this error, consistently, when trying to zip up a directory. The zipping process involves descending through every subdirectory and adding the files.</p> <pre><code>System.IO.IOException: IOException at System.IO.__Error.WinIOError(Int32 errorCode, String str) at System.IO.Directory.InternalGetFileDirectoryNames(String fullPath, Boolean file) at System.IO.Directory.InternalGetDirectories(String path, String searchPattern) at System.IO.Directory.GetDirectories(String path, String searchPattern) </code></pre> <p>This happens every time on this device - not random. </p> <p>Copying the directory contents to my development device, and running the same (on the same directory contents) does NOT cause the error. I do not have the actual device to debug interactively.</p> <p>Of course, this WinIOError is not very useful in terms of determining actual cause. Can anyone give me any hints as to what could cause the CF to fail so spectacularly when just trying to read the directory contents?</p> <p>As you can see below, common things like the directory no longer existing are handled by a specific exception to that effect - not the generic WinIOError. </p> <p>Many thanks for any clues.</p> <p>Below is the disassembled function:</p> <pre><code>// System.IO.Directory internal static string[] InternalGetFileDirectoryNames(string fullPath, bool file) { char c = fullPath[fullPath.Length - 1]; if (c == Path.DirectorySeparatorChar || c == Path.AltDirectorySeparatorChar || c == Path.VolumeSeparatorChar) { fullPath += '*'; } string[] array = new string[10]; int num = 0; HostNative.FIND_DATA fIND_DATA = new HostNative.FIND_DATA(); if (!Directory.Exists(Path.GetDirectoryName(fullPath))) { throw new DirectoryNotFoundException(); } int handle; int num2 = PAL.File_OpenAndReadDir(fullPath, out handle, fIND_DATA); if (num2 != 0) { if (num2 == -2147479552 || num2 == -2147479545) { return new string[0]; } __Error.WinIOError(num2, Path.GetDirectoryName(fullPath)); } int num3 = 0; do { bool flag; if (file) { flag = (0 == (fIND_DATA.dwFileAttributes &amp; 16)); } else { flag = (0 != (fIND_DATA.dwFileAttributes &amp; 16)); if (flag &amp;&amp; (fIND_DATA.cFileName.Equals(".") || fIND_DATA.cFileName.Equals(".."))) { flag = false; } } if (flag) { num3++; if (num == array.Length) { string[] array2 = new string[array.Length * 2]; Array.Copy(array, 0, array2, 0, num); array = array2; } array[num++] = fIND_DATA.cFileName; } num2 = PAL.File_ReadDir(handle, fIND_DATA); } while (num2 == 0); PAL.File_CloseDir(handle); if (num2 != 0 &amp;&amp; num2 != -2147479545) { __Error.WinIOError(num2, Path.GetDirectoryName(fullPath)); } if (!file &amp;&amp; num3 == 1 &amp;&amp; (fIND_DATA.dwFileAttributes &amp; 16) != 0) { return new string[] { fIND_DATA.cFileName }; } if (num == array.Length) { return array; } string[] array3 = new string[num]; Array.Copy(array, 0, array3, 0, num); return array3; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload