Skip to content

Commit 8dab192

Browse files
authored
Fix: Fixed crash when connecting some removable drives (#15383)
1 parent b6e85e9 commit 8dab192

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Files.App/Utils/Global/WindowsStorageDeviceWatcher.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using Microsoft.Extensions.Logging;
88
using System;
99
using System.IO;
10+
using System.Runtime.InteropServices;
1011
using Windows.Devices.Enumeration;
1112
using Windows.Devices.Portable;
1213
using Windows.Storage;
@@ -88,7 +89,7 @@ private async void Watcher_Added(DeviceWatcher sender, DeviceInformation args)
8889
{
8990
root = StorageDevice.FromId(deviceId);
9091
}
91-
catch (Exception ex) when (ex is ArgumentException or UnauthorizedAccessException)
92+
catch (Exception ex) when (ex is ArgumentException or UnauthorizedAccessException or COMException)
9293
{
9394
App.Logger.LogWarning($"{ex.GetType()}: Attempting to add the device, {args.Name},"
9495
+ $" failed at the StorageFolder initialization step. This device will be ignored. Device ID: {deviceId}");

0 commit comments

Comments
 (0)