Skip to content

Scheduling selected folder can show Access is denied, then closing app shows Window.Dispose error #10

Description

@SevWren

This was generated by AI during triage.

Bug Report

Summary

In DailyMotivation.exe main mode, after the user selects a folder and clicks Schedule Reminder, the App can show an Invalid Folder dialog containing Access is denied.. After that dialog is dismissed, closing the App can show a second error dialog:

Daily Motivation Brain Helper
Method invocation failed because [System.Windows.Window] does not contain a method named 'Dispose'.

Reporter Evidence

The annotated screenshot supplied during triage shows this sequence:

  1. User runs DailyMotivation.exe from the repo/build folder.
  2. In the Folder Scheduler main window, the selected folder is displayed as:
    C:\Users\mmuel\Desktop\acl_backups
  3. User clicks Schedule Reminder.
  4. A native Windows dialog titled Invalid Folder appears with the message:
    Access is denied.

The reporter also observed that, after dismissing the Access is denied popup, closing the App produces the System.Windows.Window / Dispose method error shown above.

Triage Classification

Category: bug
State: ready-for-agent

Triage Notes

This was not reproduced in an automated Windows run during triage. The report is still actionable because the screenshot and follow-up error provide exact user-visible symptoms and the source has obvious related seams:

  • Main mode schedules through a selected folder path and shows validation failures with the Invalid Folder title.
  • The scheduling path validates folders with Test-Path ... -PathType Container; access/ACL failures can surface as user-facing permission errors rather than a clear, recoverable validation state.
  • Main-window cleanup calls Dispose() on a WPF System.Windows.Window, but that type does not expose a Dispose() method. This matches the close-time popup reported by the user.
  • Popup-window cleanup has a similar guarded Dispose() call; check both main and popup modes so the fix does not leave a parallel latent issue.

Agent Brief

Category: bug

Summary: Scheduling a Selected Folder with restricted access should fail gracefully, and closing the App must not show a System.Windows.Window.Dispose error.

Current behavior:

When a user selects a folder and clicks Schedule Reminder, the App may show an Invalid Folder dialog containing the raw permission error Access is denied.. The selected folder from the report is C:\Users\mmuel\Desktop\acl_backups.

After dismissing that dialog, closing the main window can show another error dialog stating that [System.Windows.Window] does not contain a method named Dispose.

Desired behavior:

If the Selected Folder exists but cannot be accessed due to permissions, the App should show a clear, non-crashing validation message that explains the folder cannot be scheduled because access is denied. The App should recover cleanly: the Schedule button state should remain coherent, no MotivationTask or OS Task should be created, no PopupConfig should be written for the failed Schedule, and the user should be able to choose a different folder or close the App.

Closing the App after any failed Schedule attempt must not show an additional error dialog. WPF windows should be closed and cleaned up using APIs actually available on System.Windows.Window; disposable resources owned by the window should still be stopped/released where appropriate.

Key interfaces:

  • Main mode folder validation for a Selected Folder before Schedule creates a MotivationTask.
  • The scheduling function that returns Success, IsDuplicate, IsNetworkPath, and Error should distinguish inaccessible folders from missing folders where practical.
  • Main-window cleanup after ShowDialog() must not call a nonexistent Dispose() method on System.Windows.Window.
  • Popup-window cleanup should be checked for the same invalid WPF window disposal pattern.
  • Tests should respect this repo's Windows 10 PowerShell 7 validation rules from CLAUDE.md: regular Windows UI/Task Scheduler behavior must be validated on Windows, while platform abstraction tests alone are not sufficient.

Acceptance criteria:

  • Selecting a folder that exists but is not accessible to the current user and clicking Schedule Reminder does not create a MotivationTask, OS Task, or PopupConfig handoff for that failed Schedule.
  • The user-facing error for an inaccessible Selected Folder is clear and intentional, e.g. it communicates that access is denied or the folder cannot be accessed, without exposing a raw exception dump.
  • After dismissing the access-denied validation dialog, closing the main window produces no additional error dialog.
  • No code path calls Dispose() directly on a System.Windows.Window instance unless guarded by a real IDisposable check.
  • Any timers, XML readers, mutexes, dialogs, and other disposable resources still get cleaned up correctly.
  • Add or update Pester v5 tests for the folder scheduling validation behavior and for the WPF window cleanup regression where practical.
  • Validate the fix on Windows 10 PowerShell 7, not only in Linux/Unix platform abstraction tests.

Out of scope:

  • Changing the overall scheduling UX or adding a new folder picker flow.
  • Changing Task Scheduler registration semantics for valid, accessible folders.
  • Reworking the compiled ps2exe build pipeline.
  • Treating this as a request to support scheduling folders the current user cannot access.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingready-for-agentFully specified, ready for an AFK agent

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions