Lots of hard crashes in NSAppleScriptMBS.compile

I’ve got one customer who got like half a dozen crashes when compiling a simple AppleScript:

[code]theScript.Append “set AccountNames to {}”
dim OutlookFolderitem as FolderItem = LaunchServicesFindApplicationForInfoMBS("", “com.microsoft.Outlook”, “”)
if OutlookFolderitem = Nil then Return Nil
dim OutlookPath as String = OutlookFolderitem.NativePath
theScript.append “tell application '” + OutlookPath + “’”
theScript.Append “set theAccounts to IMAP accounts”
theScript.Append “repeat with currentAccount in theAccounts”
theScript.Append “set the end of AccountNames to {name of currentAccount}”
theScript.Append “end repeat”
theScript.Append “end tell”
theScript.Append “return AccountNames”

dim getImapAppleScript as new RunAS(theScript, Array(-1728, -128))[/code]

where RunAS is my wrapper for NSAppleScript which does a compile followed by a run.

The crashes are always the same:
Thread 6 Crashed:
0 com.apple.applescript 0x9fa928aa TUASApplication::CopyURL() const + 54
1 com.apple.applescript 0x9fa9591a TUASApplication::Terminology() const + 82
2 com.apple.applescript 0x9fa6848f ASCompile(AEDesc const*, long, unsigned long*) + 311
3 com.apple.CoreServices.CarbonCore 0x94937532 callComponent_444 + 24
4 com.apple.CoreServices.CarbonCore 0x9492f5f4 CallComponentFunction + 44
5 com.apple.applescript 0x9fa63401 AppleScriptComponent + 1753
6 com.apple.CoreServices.CarbonCore 0x94893a73 CallComponent + 178
7 com.apple.CoreServices.CarbonCore 0x948bd56c DelegateComponentCall + 20
8 com.apple.applescript 0x9fa7f56e AGenericCall::Delegate(ComponentInstanceRecord*) + 50
9 com.apple.applescript 0x9fa7f526 AGenericManager::HandleOSACall(ComponentParameters*) + 58
10 com.apple.applescript 0x9fa7eaff GenericComponent + 175
11 com.apple.CoreServices.CarbonCore 0x94893a73 CallComponent + 178
12 com.apple.CoreServices.CarbonCore 0x948939bc CallComponentDispatch + 26
13 com.apple.openscripting 0x933fef3a OSACompile + 56
14 com.apple.Foundation 0x95404bb4 -[NSAppleScript compileAndReturnError:] + 130
15 MBS_MacCocoa_NSAppleScript_Plugin_19503.dylib 0x08c5675b compileAndReturnError(REALobjectStruct*, _REALdictionary*&) + 299
16 com.mothsoftware.mailarchiverx 0x008a135f NSAppleScriptMBS.compile%b%o&o + 66
17 com.mothsoftware.mailarchiverx 0x00c1d6bf RunAS.compileScript%b%o + 582
18 com.mothsoftware.mailarchiverx 0x00c17f6e RunAS.Constructor%%oA1sA1i4bbsb + 584
19 com.mothsoftware.mailarchiverx 0x01645bf9 OutlookIterator.getImapAccounts%A1s%o + 1704
20 com.mothsoftware.mailarchiverx 0x01640c27 OutlookIterator.Constructor%%os + 156
21 com.mothsoftware.mailarchiverx 0x00f4808b MailParser.createIterator%%o + 7899
22 com.mothsoftware.mailarchiverx 0x00f42b08 MailParser.parse%i4%o + 1740
23 com.mothsoftware.mailarchiverx 0x00f03164 ArchiveThread.Archive%%o + 11067
24 com.mothsoftware.mailarchiverx 0x00efdb6c ArchiveThread.Event_Run%%o + 79
25 com.xojo.XojoFramework 0x025e634d 0x2429000 + 1823565
26 com.xojo.XojoFramework 0x024be246 0x2429000 + 610886
27 libsystem_pthread.dylib 0xa77db50d _pthread_body + 347
28 libsystem_pthread.dylib 0xa77db3b2 _pthread_start + 357
29 libsystem_pthread.dylib 0xa77daa8e thread_start + 34

Any ideas?

Xojo 2017r1, High Sierra. MBS 17.5.

Are you sure specifying app with native path is correct?

Yeah, I need to do that for Outlook because some users had Outlook in a VM and then AppleScript got confused. I do this, too, for instance for Filemaker.

tell application “/Applications/FileMaker Pro 16/FileMaker Pro.app”

Well, could be a bug in Apple’s code.
I can’t do anything there.

does it work with AbsolutePath instead?

I’m dense today. You mean that this is what is doing the crash in CopyURL?

Yes, this works, too:

tell application "AppleHD:Applications:Microsoft Outlook.app:" activate end tell

As you see in crash report the ASCompile function calls function to get Terminology which calls CopyURL.
So I would expect the function to copy URL for app fails with native path.

Okay, this is something I can test. Thanks!