Quantcast
Channel: MSBuild Extension Pack
Viewing all articles
Browse latest Browse all 1211

Commented Issue: SystemDrive Task errors out with IOException when getting local drives that are not ready [10638]

$
0
0
On certain machines, we've received the following error with the SystemDrive task when getting local drives:
Getting Drives from: SERVERNAME
1>D:\Path\To\Script.proj(585,2): error : IOException: The device is not ready.

Sample Task Usage:
<MSBuild.ExtensionPack.Computer.SystemDrive TaskAction="GetDrives">
<Output TaskParameter="Drives" ItemName="ExistingDrives" />
</MSBuild.ExtensionPack.Computer.SystemDrive>

This appears to be caused by the presence of a floppy drive (yes, we still have some of those!) without a disk inserted.

The SystemDrive task appears to loop over all of the logical drives and accesses their DriveInfo without first checking if the device is ready.

In order to avoid this issue, the IsReady property should be checked and/or IOException caught when accessing those members:
http://msdn.microsoft.com/en-us/library/system.io.driveinfo.isready.aspx
Comments: ** Comment from web user: mikeFourie **

Thanks for the tip. You can use the SkipDrives property to get around this. I'll add the extra check shortly.


Viewing all articles
Browse latest Browse all 1211

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>