Corrected update interval setting and Prefs tooltip to accurately reflect that it's given in milliseconds. Fixes validation error in the Prefs GUI with default value.
Fixed main WinNUT titlebar being blank.
Made old preferences upgrade menu item enable and disable correctly.
Battery and voltage variables are each set to a more obvious error value (-1) when an error occurs while querying their values, rather than a more real-looking fallback value. See also: https://github.com/nutdotnet/WinNUT-Client/issues/116
Attempts to calculate battery charge and runtime values fail if important variables for each calculation are also missing. As a result, an error message is logged and the out of range values are left alone.
System.OverflowException
User reports an OverflowException was occurring where the UPS_BattCh double variable is cast to an Integer. It's not used for anything, so I'm removing it in the hopes that this will solve the issue.
System.OverflowException: An arithmetic operation causes an overflow.
In the WinNUT_Client.WinNUT.Event_UpdateBatteryState(String Reason) location WinNUT_V2\WinNUT-Client\WinNUT.vb: line number 533
At WinNUT_Client.WinNUT.UPSDisconnectedEvent() location WinNUT_V2\WinNUT-Client\WinNUT.vb: line number 359
at WinNUT_Client_Common.UPS_Device.DisconnectedEventHandler.Invoke()
at WinNUT_Client_Common.UPS_Device.Disconnect(Boolean cancelReconnect, Boolean forceful) at location WinNUT_V2\WinNUT-Client_Common\UPS_Device.vb: Line number 185
at WinNUT_Client_Common.UPS_Device.Retrieve_UPS_Datas(Object sender, EventArgs e) location WinNUT_V2\WinNUT-ClientCommon\UPS Device.vb: Line number 366
at System.Windows.Forms.Timer.OnTick(EventArgs)
at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
In addition, the user found another bug where the View and Delete log controls were enabled (logging option enabled) while the log file was not present. More protections have been added to prevent this problem.
System.NullReferenceException: The object reference is not set to an instance of the object.
At WinNUT_Client_Common.Logger.get_LogFilePath() location D:aWinNUT-ClientWinNUT-ClientWinNUT_V2WinNUT-Client_CommonLogger.vb: line number 91
At WinNUT_Client.Pref_Gui.Btn_ViewLog_Click(Object sender, EventArgs e) position D:aWinNUT-ClientWinNUT-ClientWinNUT_V2WinNUT-ClientPref_Gui.vb: line number 341
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message&m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message&m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam,
Similar to the first report, another OverflowException is reported having to do with processing of UPS variables. It seems like this user's NUT server is reporting mostly out-of-range values for its variables.
[6424, UPS_Device]: System.OverflowException thrown in mscorlib
Message: TimeSpan overflows because it lasts too long.
at System.TimeSpan.Interval(Double value, Int32 scale)
at System.TimeSpan.FromSeconds(Double value)
At WinNUT_Client.WinNUT.Update_UPS_Data() position D:aWinNUT-ClientWinNUT-ClientWinNUT_V2WinNUT-ClientWinNUT.vb: line number 734
At WinNUT_Client_Common.UPS_Device.Retrieve_UPS_Datas(Object sender, EventArgs e) location D:aWinNUT-ClientWinNUT-ClientWinNUT_V2WinNUT-Client_CommonUPS_Device.vb: line number 362
Upgrade logging
There's some more room for improvement in how logs are created.
LogException
subroutine - standard method for logging Exceptions.UPS_Device.Retrieve_UPS_Datas
to use this subroutine for general exceptions.Miscellaneous bugfixes
System.OverflowException
User reports an
OverflowException
was occurring where theUPS_BattCh
double variable is cast to an Integer. It's not used for anything, so I'm removing it in the hopes that this will solve the issue.https://github.com/nutdotnet/WinNUT-Client/pull/131/commits/43ac206f7e67224ec2c79f7e47c8f1b83c6e23e5
System.NullReferenceException
In addition, the user found another bug where the View and Delete log controls were enabled (logging option enabled) while the log file was not present. More protections have been added to prevent this problem.
https://github.com/nutdotnet/WinNUT-Client/pull/131/commits/da13d50a2cda2728e6a1e0cc008d4cba8697b6b0
System.OverflowException
and default valuesSimilar to the first report, another OverflowException is reported having to do with processing of UPS variables. It seems like this user's NUT server is reporting mostly out-of-range values for its variables.