alphaleonis / AlphaFS

AlphaFS is a .NET library providing more complete Win32 file system functionality to the .NET platform than the standard System.IO classes.
http://alphafs.alphaleonis.com/
MIT License
558 stars 99 forks source link

Alphaleonis.Win32.Filesystem.DeviceNotReadyException bug #531

Open semwarden opened 1 year ago

semwarden commented 1 year ago

Hello everyone, we are using version of the library AlphaFS 2.2.5 and we are facing this exception. Is there any fix for this bug? Or can someone describes, how they solved this bug?

According on the StackTrace, it seems like the bug is inside Alphaleonis.Win32.Filesystem.Directory.ExistsDriveOrFolderOrFile function.

Thank you

Type: Alphaleonis.Win32.Filesystem.DeviceNotReadyException

Message: (21) The device is not ready: [PATH]

Data: HResult=80070015 -2147024875 [2147942421] ErrorCode=00000015 21 [ERROR_NOT_READY]

StackTrace: at Alphaleonis.Win32.Filesystem.Directory.ExistsDriveOrFolderOrFile(KernelTransaction transaction, String path, Boolean isFolder, Int32 lastError, Boolean throwIfDriveNotExists, Boolean throwIfFolderOrFileNotExists) at Alphaleonis.Win32.Filesystem.FindFileSystemEntryInfo.FindFirstFile(String pathLp, WIN32_FIND_DATA& win32FindData, Boolean suppressException) at Alphaleonis.Win32.Filesystem.FindFileSystemEntryInfo.d__88`1.MoveNext()

DomagojJugovich commented 10 months ago

I just came here for the same reason, I use the latest version and get the same error.

here is excerpt from my log

2023-09-12 09:28:27 PATH1: D:_ARGOSY_PROD\EXEDIR\Argosy_2023_08_21__12_12_12\DevExpress.XtraGrid.v22.1.dll PATH2: \homer.du.laus.hr\ARGOSY\EXEDIR\Argosy_2023_08_21__12_12_12 MSG:Transaction not active. at Alphaleonis.Win32.NativeError.ThrowException(UInt32 errorCode, String readPath, String writePath) in C:\Users\jjangli\Documents\GitHub\AlphaFS\AlphaFS\NativeError.cs:line 156 at Alphaleonis.Win32.Filesystem.File.GetSizeCore(KernelTransaction transaction, SafeFileHandle safeHandle, String path, PathFormat pathFormat) in C:\Users\jjangli\Documents\GitHub\AlphaFS\AlphaFS\Filesystem\File Class\File.GetSize.cs:line 119 at Alphaleonis.Win32.Filesystem.File.CopyMoveCore(KernelTransaction transaction, Boolean driveChecked, Boolean isFolder, String sourcePath, String destinationPath, Nullable1 copyOptions, Nullable1 moveOptions, Boolean preserveDates, CopyMoveProgressRoutine progressHandler, Object userProgressData, CopyMoveResult copyMoveResult, PathFormat pathFormat) in C:\Users\jjangli\Documents\GitHub\AlphaFS\AlphaFS\Filesystem\File Class\File.Copy.cs:line 815 at Alphaleonis.Win32.Filesystem.File.CopyTransacted(KernelTransaction transaction, String sourcePath, String destinationPath, CopyOptions copyOptions) in C:\Users\jjangli\Documents\GitHub\AlphaFS\AlphaFS\Filesystem\File Class\File.Copy.cs:line 483 at ArgosyUpdater.Program.DirectoryCopy(KernelTransaction kt, String sourceDirName, String destDirName, StringBuilderExt errors, StringBuilderExt changes, BindingList1 ignorePaths, String currSourceRootParm) in D:_GITHUB\ArgosyUpdater\Program.cs:line 1173 2023-09-12 09:28:27 INNER: The requested operation was made in the context of a transaction that is no longer active. (Exception from HRESULT: 0x80071A2D)

2023-09-12 09:28:27 PATH1: D:_ARGOSY_PROD\EXEDIR\Argosy_2023_08_2112_12_12\DevExpress.XtraGrid.v22.1.xml PATH2: \homer.du.laus.hr\ARGOSY\EXEDIR\Argosy_2023_08_21__12_12_12 MSG:(21) The device is not ready: [D:] at Alphaleonis.Win32.Filesystem.Directory.ExistsDriveOrFolderOrFile(KernelTransaction transaction, String path, Boolean isFolder, Int32 lastError, Boolean throwIfDriveNotExists, Boolean throwIfFolderOrFileNotExists) in C:\Users\jjangli\Documents\GitHub\AlphaFS\AlphaFS\Filesystem\Directory Class\Directory.ExistsDrive.cs:line 76 at Alphaleonis.Win32.Filesystem.File.CopyMoveCore(KernelTransaction transaction, Boolean driveChecked, Boolean isFolder, String sourcePath, String destinationPath, Nullable1 copyOptions, Nullable1 moveOptions, Boolean preserveDates, CopyMoveProgressRoutine progressHandler, Object userProgressData, CopyMoveResult copyMoveResult, PathFormat pathFormat) in C:\Users\jjangli\Documents\GitHub\AlphaFS\AlphaFS\Filesystem\File Class\File.Copy.cs:line 770 at Alphaleonis.Win32.Filesystem.File.CopyTransacted(KernelTransaction transaction, String sourcePath, String destinationPath, CopyOptions copyOptions) in C:\Users\jjangli\Documents\GitHub\AlphaFS\AlphaFS\Filesystem\File Class\File.Copy.cs:line 483 at ArgosyUpdater.Program.DirectoryCopy(KernelTransaction kt, String sourceDirName, String destDirName, StringBuilderExt errors, StringBuilderExt changes, BindingList1 ignorePaths, String currSourceRootParm) in D:_GITHUB\ArgosyUpdater\Program.cs:line 1173 2023-09-12 09:28:27 PATH1: D:_ARGOSY_PROD\EXEDIR\Argosy_2023_08_2112_12_12\DevExpress.XtraLayout.v22.1.dll PATH2: \homer.du.laus.hr\ARGOSY\EXEDIR\Argosy_2023_08_2112_12_12 MSG:(21) The device is not ready: [D:] at Alphaleonis.Win32.Filesystem.Directory.ExistsDriveOrFolderOrFile(KernelTransaction transaction, String path, Boolean isFolder, Int32 lastError, Boolean throwIfDriveNotExists, Boolean throwIfFolderOrFileNotExists) in C:\Users\jjangli\Documents\GitHub\AlphaFS\AlphaFS\Filesystem\Directory Class\Directory.ExistsDrive.cs:line 76 at Alphaleonis.Win32.Filesystem.File.CopyMoveCore(KernelTransaction transaction, Boolean driveChecked, Boolean isFolder, String sourcePath, String destinationPath, Nullable1 copyOptions, Nullable1 moveOptions, Boolean preserveDates, CopyMoveProgressRoutine progressHandler, Object userProgressData, CopyMoveResult copyMoveResult, PathFormat pathFormat) in C:\Users\jjangli\Documents\GitHub\AlphaFS\AlphaFS\Filesystem\File Class\File.Copy.cs:line 770 at Alphaleonis.Win32.Filesystem.File.CopyTransacted(KernelTransaction transaction, String sourcePath, String destinationPath, CopyOptions copyOptions) in C:\Users\jjangli\Documents\GitHub\AlphaFS\AlphaFS\Filesystem\File Class\File.Copy.cs:line 483 at ArgosyUpdater.Program.DirectoryCopy(KernelTransaction kt, String sourceDirName, String destDirName, StringBuilderExt errors, StringBuilderExt changes, BindingList1 ignorePaths, String currSourceRootParm) in D:_GITHUB\ArgosyUpdater\Program.cs:line 1173 2023-09-12 09:28:27 PATH1: D:_ARGOSY_PROD\EXEDIR\Argosy_2023_08_2112_12_12\DevExpress.XtraLayout.v22.1.xml PATH2: \homer.du.laus.hr\ARGOSY\EXEDIR\Argosy_2023_08_21__12_12_12 MSG:(21) The device is not ready: [D:] at Alphaleonis.Win32.Filesystem.Directory.ExistsDriveOrFolderOrFile(KernelTransaction transaction, String path, Boolean isFolder, Int32 lastError, Boolean throwIfDriveNotExists, Boolean throwIfFolderOrFileNotExists) in C:\Users\jjangli\Documents\GitHub\AlphaFS\AlphaFS\Filesystem\Directory Class\Directory.ExistsDrive.cs:line 76

I cant move further with this, I tried this and that to no avail. It is a single simple tranaction, no multithreading etc...