jl168 / open-hardware-monitor

Automatically exported from code.google.com/p/open-hardware-monitor
0 stars 0 forks source link

System.IO.DriveNotFoundException after resuming from Hibernation #382

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What is the expected output? What do you see instead?

The expected output is a fully working tool and not a crashing one-

What version of the product are you using? On what operating system?

I use Version: 0.5.1.2 on Win7 Sp1 x64.

Please provide any additional information below.

Here is the callstack of the crash:

Version: 0.5.1.2

System.IO.DriveNotFoundException: Could not find the drive 'M:\'. The drive 
might not be ready or might not be mapped.
   at System.IO.__Error.WinIODriveError(String driveName, Int32 errorCode)
   at System.IO.DriveInfo.get_TotalSize()
   at OpenHardwareMonitor.Hardware.HDD.AbstractHarddrive.Update()
   at OpenHardwareMonitor.GUI.UpdateVisitor.VisitHardware(IHardware hardware)
   at OpenHardwareMonitor.Hardware.Computer.Traverse(IVisitor visitor)
   at OpenHardwareMonitor.GUI.MainForm.timer_Tick(Object sender, EventArgs e)
   at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Common Language Runtime: 4.0.30319.577
Operating System: Microsoft Windows NT 6.1.7601 Service Pack 1
Process Type: 64-Bit

Drive M is my external HDD which I had used before running into hibernation, 
but I haven't connect the drive again after resume. And this causes the crash.

Please attach a Report created with "File / Save Report...".

Original issue reported on code.google.com by MagicAnd...@live.com on 5 Sep 2012 at 8:17

Attachments:

GoogleCodeExporter commented 9 years ago
Add this to the the for loop in Update method should fix it.

if (!driveInfos[i].IsReady) 
    continue;

          for (int i = 0; i < driveInfos.Length; i++) 
          {
              if (!driveInfos[i].IsReady) 
                  continue;
              totalSize += driveInfos[i].TotalSize;
              totalFreeSpace += driveInfos[i].TotalFreeSpace;
          }

Original comment by MagicAnd...@live.com on 27 Oct 2012 at 8:06

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r425.

Original comment by moel.mich on 28 Oct 2012 at 11:35

GoogleCodeExporter commented 9 years ago
thanks for the fix :)

Original comment by MagicAnd...@live.com on 28 Oct 2012 at 3:17