Conversation
User reports that an OverflowException was occurring at line 587, where the `UPS_BattCh` double variable is cast to an Integer. It's not used for anything, so perhaps removing it will solve the issue.
- Don't attempt to open the log file if the object does not exist (shouldn't be able to reach this point anyways) - Only enable view and delete controls if log file is present.
- Adding new `LogException` subroutine to Logger class; designed to ensure that exception data is thoroughly logged in the invariant culture language. - 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. - Began adding code in WinNUT.vb to allow for testing system stop routines while debugging. - Removed `LongProgramName` global variable; replaced throughout code with `ProgramName`. Fixes main WinNUT titlebar being blank.
- Battery and voltage properties are now set to an invalid value (-1) when they are unavailable, rather than the previous method of setting them to a "fallback" value. Partially addresses #116 - Attempt to calculate battery charge fails and leaves a log message if the battery voltage is unavailable. - Attempt to calculate battery runtime fails if other consequential values are unavailable. This may be problematic for calculations that rely on a "good enough" default value. However, I currently don't see any scenario where that would be acceptable to someone relying on an accurate calculation. - When UPS status is on battery, log an error if battery variables are unavailable when trying to determine if a stop action is needed. Will need to follow this up and warn the user that stop actions are unavailable if battery info isn't present. - When battery runtime is unavailable to WinNUT, display localized message instead.
- Fixed some inverted logic for battery charge calculations - Restructured how old pref checking is handled in WinNUT.vb. Menu item now disables correctly once the prefs have been removed.
This was referenced Aug 1, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Upgrade logging
There's some more room for improvement in how logs are created.
LogExceptionsubroutine - standard method for logging Exceptions.UPS_Device.Retrieve_UPS_Datasto use this subroutine for general exceptions.Miscellaneous bugfixes
System.OverflowExceptionUser reports an
OverflowExceptionwas occurring where theUPS_BattChdouble 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.43ac206
System.NullReferenceExceptionIn 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.
da13d50
System.OverflowExceptionand 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.