From 6d74e04457d92c79335df1ee17257c4ff1f4dd32 Mon Sep 17 00:00:00 2001 From: Jeffrey Jangli Date: Thu, 24 May 2018 09:52:49 +0200 Subject: [PATCH] Fixes #441: InvalidOperationException on Directory.EnumerateFileSystemEntries() --- AlphaFS/Filesystem/FindFileSystemEntryInfo.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/AlphaFS/Filesystem/FindFileSystemEntryInfo.cs b/AlphaFS/Filesystem/FindFileSystemEntryInfo.cs index a739b3b5a..527a09a27 100644 --- a/AlphaFS/Filesystem/FindFileSystemEntryInfo.cs +++ b/AlphaFS/Filesystem/FindFileSystemEntryInfo.cs @@ -297,10 +297,9 @@ private SafeFindFileHandle FindFirstFile(string pathLp, out NativeMethods.WIN32_ ThrowPossibleException((uint) lastError, pathLp); } - // When the handle is null and we are still here, it means the ErrorHandler is active, - // preventing the Exception from being thrown. + // When the handle is null and we are still here, it means the ErrorHandler is active, preventing the Exception from being thrown. - if (null != handle) + if (null != handle && lastError != Win32Errors.NO_ERROR) VerifyInstanceType(win32FindData); }