diff --git a/src/Files.App/Services/Storage/StorageDevicesService.cs b/src/Files.App/Services/Storage/StorageDevicesService.cs index c29ca0b4f485..ab78cc0a635c 100644 --- a/src/Files.App/Services/Storage/StorageDevicesService.cs +++ b/src/Files.App/Services/Storage/StorageDevicesService.cs @@ -21,6 +21,9 @@ public async IAsyncEnumerable GetDrivesAsync() var pCloudDrivePath = App.AppModel.PCloudDrivePath; foreach (var drive in list) { + if (!drive.IsReady) + continue; + var driveLabel = DriveHelpers.GetExtendedDriveLabel(drive); // Filter out cloud drives // We don't want cloud drives to appear in the plain "Drives" sections. diff --git a/src/Files.App/Utils/Global/WindowsStorageDeviceWatcher.cs b/src/Files.App/Utils/Global/WindowsStorageDeviceWatcher.cs index 97c4dccbfd7d..dc813e6c2b31 100644 --- a/src/Files.App/Utils/Global/WindowsStorageDeviceWatcher.cs +++ b/src/Files.App/Utils/Global/WindowsStorageDeviceWatcher.cs @@ -52,6 +52,9 @@ private void Win32_OnDeviceRemoved(object? sender, DeviceEventArgs e) private async void Win32_OnDeviceAdded(object? sender, DeviceEventArgs e) { var driveAdded = new DriveInfo(e.DeviceId); + if (!driveAdded.IsReady) + return; + var rootAdded = await FilesystemTasks.Wrap(() => StorageFolder.GetFolderFromPathAsync(e.DeviceId).AsTask()); if (!rootAdded) { @@ -98,6 +101,9 @@ private async void Watcher_Added(DeviceWatcher sender, DeviceInformation args) { // Check if this drive is associated with a drive letter var driveAdded = new DriveInfo(root.Path); + if (!driveAdded.IsReady) + return; + type = DriveHelpers.GetDriveType(driveAdded); label = DriveHelpers.GetExtendedDriveLabel(driveAdded); }