Xojo.IO.FolderItem iteration bug on Linux

Hi guys,

I’ve just converted a project from 2017r2.1 to 2019r2.1

Everything runs pretty smoothly except for one thing. I’m using this code as part of a method called inside a XojoScript. On my Mac it works fine, on the Linux server it crashes without warning. I traced it back to the IsFolder line. Any known issues?

I’ll see if I can change it to Type or something…

[code]// Loop through folder and add lookalikes
For Each fTmp As Xojo.IO.FolderItem In convFolder.Children

If fTmp.IsFolder Then Continue // Skip folders

…[/code]

Crash or Exception?

The service (running inside a container on a server of @Phillip Zedalis) simply reboots. Usually that indicates a crash…

Changing IsFolder to Length = 0 also doesn’t work by the way. Same effect.

It has to do with the For - Next. The following code triggers the error after one iteration (there are multiple files in the folder).

[code]// Convert to new framework
Dim convFolder As New Xojo.IO.FolderItem(taskFolder.NativePath.ToText)

// Is everything cool?
App.MessageAdd("Debug " + convFolder.Path + EndOfLine)
App.MessageAdd("Debug " + str(convFolder.IsFolder) + EndOfLine)

// Test loop
For Each fTmp As Xojo.IO.FolderItem In convFolder.Children
App.MessageAdd("Iterate " + EndOfLine)
Next
[/code]

  • EDITS: emojis break the post.

Found a really old bug, maybe it’s back?

https://forum.xojo.com/28738-xojo-2015r4-is-crashing-when-using-xojo-io-folderitem-iterator

Just read that the other FolderItem now also supports these functions. Changed the class, no problems.

So: iteration with Xojo.IO.FolderItem is a no-go (for me on Linux) and the exact same code with FolderItem works fine.

It’s a bit of a late reply, but I’ve just hit this same problem with the iterator under Linux with 2019r2.1.

Switched to standard FolderItem and I’m working again.

I’ve reopened the original case (and I’ll be steering clear of the xojo.io framework in future).