CURLSMBS.OpenMTInputFile(f) sometimes returns False

Xojo2021r2.1, MBS 23.3, Windows 11.

Most of the time this function returns True, but some small percentage of tries it returns False. What could cause this? File busy or something?

There are a ton of reasons:

  • File is open exclusively by someone else, so we can’t open it for reading.
  • File path is invalid.
  • Permissions to the file or the folder (or parent folders) prevent us reading it.
  • You reached the maximum number of open files at a time for the app.
  • FolderItem is invalid/stale and we can’t get the path
  • Out of memory, we can’ allocate data structures.
  • Offset parameter is negative.
  • We can’t determinate the file size and seek within it.

Thanks, Christian. I should have mentioned that this code has been working for years and thousands of uploads without issue, so I suspect some recent Windows update may be having an effect.

  • I don’t think it can be caused by an invalid path because if the file doesn’t exist an IO Error exception is thrown.
  • The file is in a folder in user\Documents so I don’t think it’s a permissions issue.
  • Offset is 0.

I’ll keep looking into the other possibilities.

Does windows have some sort of equivalent of search indexing? Perhaps that has been enabled by an update and thus opening the file for indexing when you are attempting to do so. I know macOS has issues like that from time to time.

1 Like

You can always use a binary stream, read the whole file in a string and pass it to InputData property.

1 Like

Well my app already retries if an upload fails for other reasons, so for now I’m just going to ignore this and let it re-try :crossed_fingers: