Debugger limitations?

I think I ran into some limitations of Script Debugger, but I’m not sure and want to verify. I’ve searched the forum, but didn’t find anything.

Issue one: I’ve added a script-block to my AppleScript program, and now I can’t debug anymore. When I press the “Run” button, it runs shortly, and then stops again. The status bar says “Stopped”. Not sure what happens…

I hope I missed something trivial, because grouping code in script-blocks seems like a good idea.

It’s something like this:

script my_subscript
    property my_property: missing value
    on my_handler()
        set my_property to "something"
    end my_handler
end script

on run
    my_subscript's my_handler()

Issue two: some while ago, I told about my way how to debug script libraries. To do so, I replaced the use XXX: script "my-script" with property XXX: document "my-script.applescript".

This way of debugging script-libraries works great, except when the script-library itself contains properties. When I want to set a property of the script-library (document) I get the error (something like “can’t make a reference type of the property”, I’ve got Dutch localization).

One solution would be to use a handler to set this property, but I hope there would be another solution.

Re Issue One, I’m not seeing a problem when I try your code snippet here. When I step through the code I see the current line start a the my_subscript's my_handler() statement and then advance to the set my_property to "something" line and then finally exit the script. When the set my_property to "something" line executes, the debugger shows the value of my_property change form missing value to "something".

Re issue two: yes, for now, this is a limitation of Script Debugger’s scripting implementation. You’ll need to use handlers to access and mutate properties when you use this means of library debugging.

Thanks for looking into it. Yeah, I can’t seem to make it reproducable. The script-block script itself runs and debugs fine, the main script too, but when I put them into the same file, when pressing the run button in debug mode, Script Debugger runs for a seconds and just stops. No results. No events.

Console is reporting the following two lines repeatedly (15 times):

RKOSAID _failOSError: errOSAInternalTableOverflow: <RKOSAID: 0x6000012c7f00>, stack: (
	0   RosieKit2                           0x0000000108d547a1 -[RKOSAID _failOSError:] + 193
	1   RosieKit2                           0x0000000108d5669f -[RKOSAID storeWithModeFlags:] + 275
	2   RosieKit2                           0x0000000108e690ab -[RKOSAScriptModel runtimeScript] + 103
	3   Script Debugger                     0x0000000108b4eb0d -[ScriptDocumentBase(Running) doExecuteEvent:autoBreak:tracing:makeCurrentEvent:] + 190
	4   Script Debugger                     0x0000000108b4e625 -[ScriptDocumentBase(Running) doExecuteWithEvent:] + 279
	5   AppKit                              0x00007fff458b7644 -[NSApplication(NSResponder) sendAction:to:from:] + 312
	6   AppKit                              0x00007fff45921992 -[NSControl sendAction:to:] + 86
	7   AppKit                              0x00007fff459218c4 __26-[NSCell _sendActionFrom:]_block_invoke + 136
	8   AppKit                              0x00007fff459217c6 -[NSCell _sendActionFrom:] + 178
	9   AppKit

And second line:

legacyRuntimeScript called!!!!! - please save the script you are running and report this incident to

I already sent the script via email to support. Not sure if we should talk about this on this forum, or via the mail.

Ugg, this error indicates that AppleScript has experienced a serious internal failure. Script Debugger should not be failing silently and I’ll sort that out, but the underlying problem is that your script is simply too large.

Ah, good to know. I’ve had some headaches about refactoring the code. Today I decided to split the script into an old and new script. The old script (very long and tedious, difficult to refactor) will get used less and less…

Could this error be related to Scripting Debugger (but also Scripteditor) crashing when pressing the compile button?

Yes. When AppleScript generates a errOSAInternalTableOverflow error you must assume that memory has been corrupted and your editor (SD or SE) is about to crash. Its best to save your work as quickly as possible and quit and re-launch your editor.