BCUninstaller/Bulk-Crap-Uninstaller · warning · InvalidOperationException

Reoccuring popup window detected!

Error message

Reoccuring popup window detected!

What it means

InvalidOperationException thrown by ProcessNsisPopups when a popup window's computed footprint (children names + title + width + height) matches one already recorded in seenWindows. The library tracks popup footprints to detect that the automation is stuck re-opening the same dialog without making progress; rather than loop forever it bails out with this error. The footprint is built from popupWindow.FindAllChildren().Select(x=>x.Name) joined with the title and dimensions.

Source

Thrown at source/UninstallerAutomatizer/Automation/AutomatedUninstallManager.cs:277

            Thread.Sleep(100);
        }

        private static void ProcessNsisPopups(Application app, Window mainWindow, ICollection<string> seenWindows, Action<string> statusCallback)
        {
            // Check for popups, they are opened as an extra window.
            var currentWindows = app.GetAllTopLevelWindows(WhiteAdapter.Automation);
            var popupWindow = currentWindows.SingleOrDefault(x => !x.Equals(mainWindow));

            if (popupWindow == null)
            {
                popupWindow = mainWindow.ModalWindows.FirstOrDefault();
                if (popupWindow == null)
                    return;
            }

            var footprint = string.Join(";", popupWindow.FindAllChildren().Select(x => x.Name)) + popupWindow.Title + popupWindow.ActualWidth + popupWindow.ActualHeight;
            if (seenWindows.Contains(footprint))
                throw new InvalidOperationException(Localization.Message_Automation_PopupRecurringFound);
            seenWindows.Add(footprint);
            statusCallback(string.Format(Localization.Message_Automation_PopupFound, popupWindow.Title));

            while (!popupWindow.IsAvailable)
            {
                TryClickNextNsisButton(popupWindow, statusCallback);

                app.WaitWhileBusy();
                popupWindow.WaitUntilClickable();
                Thread.Sleep(100);
            }
            statusCallback(Localization.Message_Automation_PopupClosed);
        }

        private static void TryClickNextNsisButton(Window target, Action<string> statusCallback)
        {
            statusCallback("Looking for buttons to press...");

View on GitHub (pinned to 608321de98)

Solutions

  1. Examine the recurring popup's title/children (the footprint inputs) to identify which dialog cannot be advanced.
  2. Add the correct forward/confirm button's automation ID or localized name to GoodButtonIds/GoodButtonNames so TryClickNextNsisButton advances it.
  3. Add cancel/dangerous buttons to CancelButtonIds/BadButtonIds to prevent re-clicking them.
  4. If the popup genuinely needs a non-button action (e.g. radio selection first), extend the automation to handle that specific control before clicking Next.

Example fix

// before - heuristic keeps clicking a control that does not advance the popup
// after - register the popup's actual forward control in the good-button lists
private static readonly string[] GoodButtonIds =
    { NsisForwardAutomationId, NsisYesAutomationId, "1234" /* custom forward */ };
Defensive patterns

Strategy: try-catch

Try / catch

try { AutomatedUninstallManager.AutomatizeApplication(app, cb); }
catch (InvalidOperationException ex) when (ex.Message == Localization.Message_Automation_PopupRecurringFound)
{
    // automation is stuck on one popup; surface to user for manual handling or extend button lists
}

Prevention

When it happens

Trigger: TryClickNextNsisButton clicks a control but the same popup reappears with identical contents on the next ProcessNsisPopups pass, so its footprint is already in seenWindows. This happens when the clicked button does not actually dismiss the popup (wrong button chosen, or a confirmation dialog re-prompts). A popup that re-shows after being dismissed because the underlying action failed.

Common situations: NSIS dialog asks 'are you sure?' and automation picks a button that loops it back. A license/custom page with no recognizable forward button keeps reappearing. A localized button name is missing from the Good list so the heuristic re-clicks a non-advancing control. The popup has dynamic content that happens to keep the same footprint each cycle.

Related errors


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