Attempt to get freespace on my E: (dvddrive) causes exception


Help about gives Build, source control version (networkassettmanager-42403.zip)
Running from within VS2008,
class LogicalDisk

line ::

objEntLogicalDrive.FreeSpace = WMIUtil.ConvertSizetoString((UInt64)obj["FreeSpace"], true, NetworkAssetManager.General.Units.Auto);
NullReferenceException raised constantly for me here ...obj["FreeSpace"] is null#
OBJ is {\MyMachine\root\cimv2:Win32_LogicalDisk.DeviceID="E:"}
E: is my DVDDrive


rahulbedge wrote Jan 28, 2010 at 7:40 AM

Thanks PingCrosby.

I have verified that there is a defect in the component referenced within this case. Please accept my apologies. I am servicing this case as a high priority defect. The correction to this defect will be provided in the future release of the product. I will provide you with an update once the correction for this defect has been incorporated into a product update.

If you have any additional questions or concerns regarding this defect, please add a comment to this case stating your desires. I will progress the case accordingly.

rahulbedge wrote Jan 28, 2010 at 3:30 PM


I have checked logged defect. In case of Optical devices like CD and DVD ROM drives the free space field is not available in the win32_logicaldisk instance. This leads to an exception System.NullReferenceException] {"Object reference not set to an instance of an object."} when FreeSpace is queried.

I think this should not be a problem as the exception is handled properly with a appropriate try catch block.

Please let me know if this answers your concern.

PingCrosby wrote Jan 28, 2010 at 3:51 PM


That from a users point of view it is not visible = but surely we should check if the drive is a hard disk before attempting to check disk space. I suppose it bothers me more because i have this exceptions checked to break on my system.

Your call however.

rahulbedge wrote Jan 31, 2010 at 1:29 PM

The issue will not be fixed right now. The exception is handled appropriately.