BCUninstaller/Bulk-Crap-Uninstaller · error · InvalidOperationException

Selected tab is invalid or not supported.

Error message

Selected tab is invalid or not supported.

What it means

AppPropertiesGatherer.GetInfo switches on the InfoType enum and hits the default branch. This fires for InfoType.Invalid (=0) or any InfoType value not covered by the Overview/FileInfo/Registry/Certificate cases. In normal UI flow the tab mapping never produces such a value, so it signals a logic bug or a new enum member added without a matching case. The exception is caught and shown as an error table.

Source

Thrown at source/BulkCrapUninstaller/Functions/AppPropertiesGatherer.cs:54

        {
            try
            {
                switch (infoType)
                {
                    case InfoType.Overview:
                        return ExtractOverview(entry);

                    case InfoType.FileInfo:
                        return ExtractFileInfo(entry);

                    case InfoType.Registry:
                        return ExtractRegistryInfo(entry);

                    case InfoType.Certificate:
                        return ExtractCertificateInfo(entry);

                    default:
                        throw new InvalidOperationException("Selected tab is invalid or not supported.");
                }
            }
            catch (Exception ex)
            {
                return GetError(ex.Message);
            }
        }

        private static void ConvertPropertiesIntoDataTable(IEnumerable<SingleProperty> lq, DataTable dt)
        {
            foreach (var kvp in lq.OrderBy(x => x.Key))
            {
                if (kvp.Value == null)
                    continue;

                if (kvp.Value is Guid guid && guid.IsEmpty())
                    continue;

View on GitHub (pinned to 608321de98)

Solutions

  1. Ensure only valid InfoType values (Overview, FileInfo, Registry, Certificate) are passed to GetInfo.
  2. Add a case for any new InfoType member and keep the switch exhaustive.
  3. Guard callers so InfoType.Invalid never reaches GetInfo.
Defensive patterns

Strategy: validation

Validate before calling

if (infoType == InfoType.Invalid || !Enum.IsDefined(typeof(InfoType), infoType))
    return GetError("Unsupported tab");

Type guard

static bool IsValidTab(InfoType t) =>
    t == InfoType.Overview || t == InfoType.FileInfo ||
    t == InfoType.Registry || t == InfoType.Certificate;

Prevention

When it happens

Trigger: Calling GetInfo with InfoType.Invalid; a future enum value added to InfoType without a corresponding case; default(int) cast to InfoType; deserialization yielding the default enum value 0.

Common situations: A new tab type added during development without updating the switch; an entry/tab pairing that resolves to InfoType.Invalid.

Related errors


AI-assisted analysis of BCUninstaller/Bulk-Crap-Uninstaller@608321de98 (2026-08-13). Data as JSON: /api/errors/84ed30682dd73c53. Report an issue: GitHub.