BCUninstaller/Bulk-Crap-Uninstaller · error · ArgumentOutOfRangeException
Unknown range
Error message
Unknown range
What it means
GetRangeString maps a SizeRange to its localised label via a switch covering Tb/Gb/Mb/Kb, after filtering out SizeRange.None. Reaching the default branch means an out-of-enum SizeRange value (e.g. cast from an arbitrary integer) was supplied. In normal flow GetCompactSize only ever assigns valid members, so this is effectively unreachable barring corruption or a future enum change.
Source
Thrown at source/KlocTools/IO/FileSize.cs:212
string rangeName;
switch (range)
{
case SizeRange.Tb:
rangeName = longString ? Localisation.FileSize_TB_Long : Localisation.FileSize_TB_Short;
break;
case SizeRange.Gb:
rangeName = longString ? Localisation.FileSize_GB_Long : Localisation.FileSize_GB_Short;
break;
case SizeRange.Mb:
rangeName = longString ? Localisation.FileSize_MB_Long : Localisation.FileSize_MB_Short;
break;
case SizeRange.Kb:
rangeName = longString ? Localisation.FileSize_KB_Long : Localisation.FileSize_KB_Short;
break;
default:
throw new ArgumentOutOfRangeException(nameof(range), range, @"Unknown range");
}
return rangeName;
}
public XmlSchema GetSchema() { return null; }
public void ReadXml(XmlReader reader)
{
if (reader.MoveToContent() == XmlNodeType.Element)
{
reader.Read();
if (reader.HasValue)
{
_sizeInKb = long.Parse(reader.Value);
reader.Read();
}View on GitHub (pinned to 608321de98)
Solutions
- Ensure SizeRange values originate only from the enum members.
- Add cases for any new enum members and keep the switch exhaustive.
- Validate the range with Enum.IsDefined before formatting.
Defensive patterns
Strategy: validation
Validate before calling
if (!Enum.IsDefined(typeof(SizeRange), range))
throw new ArgumentOutOfRangeException(nameof(range)); Prevention
- Validate SizeRange with Enum.IsDefined before formatting.
- Keep the switch exhaustive when extending the enum.
When it happens
Trigger: Casting an arbitrary int to SizeRange (e.g. (SizeRange)999); a new enum member added without a matching case; a deserialized/corrupted FileSize yielding an invalid range.
Common situations: Unreachable in normal use; indicates corruption, reflection-based misuse, or a future enum extension without a parser update.
Related errors
- Failed to get MainModule Directory
- Selected tab is invalid or not supported.
- File not found.
- Not a Windows .exe file.
- Win32_Directory.Compress returned {ret}
AI-assisted analysis of BCUninstaller/Bulk-Crap-Uninstaller@608321de98 (2026-08-13).
Data as JSON: /api/errors/098d98c35218a9f1.
Report an issue: GitHub.