File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -187,7 +187,19 @@ private async Task GetDrives(IList<DriveItem> list)
187
187
var drives = DriveInfo . GetDrives ( ) . ToList ( ) ;
188
188
189
189
var remDevices = await DeviceInformation . FindAllAsync ( StorageDevice . GetDeviceSelector ( ) ) ;
190
- var supportedDevicesNames = remDevices . Select ( x => StorageDevice . FromId ( x . Id ) . Name ) ;
190
+ List < string > supportedDevicesNames = new List < string > ( ) ;
191
+ foreach ( var item in remDevices )
192
+ {
193
+ try
194
+ {
195
+ supportedDevicesNames . Add ( StorageDevice . FromId ( item . Id ) . Name ) ;
196
+ }
197
+ catch ( Exception e )
198
+ {
199
+ Logger . Warn ( "Can't get storage device name: " + e . Message + ", skipping..." ) ;
200
+ }
201
+ }
202
+
191
203
foreach ( DriveInfo driveInfo in drives . ToList ( ) )
192
204
{
193
205
if ( ! supportedDevicesNames . Contains ( driveInfo . Name ) && driveInfo . DriveType == System . IO . DriveType . Removable )
You can’t perform that action at this time.
0 commit comments