Not breaking in Script Debugger even though script executed and control passes through BP position

Script Debugger 8.0.6 + macOS 14.3.1

Attempting to debug script with a Mail perform mail action with messages handler. The handler gets invoked - some tracer bullet say statements get executed but Script Debugger does not pause execution at the breakpoints next to the say statements. Change the arguments to the say statements and next test execution says the new argument, i.e. executing the same script I have open in Script Debugger.

It’s probably some simple config problem (or permissions config prob) that I’m not aware of as a newbie to Script Debugger, but I don’t see any FAQ or Troubleshooting articles covering this - please add one - or any preference settings that might relate. I’m also a bit surprised - I thought this would work out of the box. Script Debugger trial worked fine before with a run handler, but not this.

Settings > Privacy & Security > Automation > Script Debugger > Mail = On

How are you invoking the perform mail action with messages handler? You’ll need some code in your script to invoke this handler with test data. There is no means of invoking this handler from the Mail application.

Here’s an example of how to invoke the handler from AppleScript:

--	Created by: Mark Alldritt
--	Created on: 2024-02-24
--	Copyright © 2024 LNS, All Rights Reserved

use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions

using terms from application "Mail"
	-- Test harness to similate the mail rule invocation
	set theMessages to [¬
		application "Mail"'s iCloud account "Mark @ iCloud"'s mailbox "INBOX"'s message 1, ¬
		application "Mail"'s iCloud account "Mark @ iCloud"'s mailbox "INBOX"'s message 2] -- provide a list of message references
	set theMailboxes to [application "Mail"'s iCloud account "Mark @ iCloud"'s mailbox "INBOX"] -- provide a list of mailboxes
	set theRule to application "Mail"'s rule "Test Rule" -- provide a reference to the mail rule
	perform mail action with messages theMessages in mailboxes theMailboxes for rule theRule
	on perform mail action with messages messageList in mailboxes mbox for rule aRule
		repeat with aMessage in messageList
			log (get aMessage's subject)
		end repeat
	end perform mail action with messages
end using terms from

You can then set breakpoints and debug: