IOException ?

I continue to get these ?q IOExceptions, but not when I saved the ListBox contents into a SQLite file.

One thing I do not explain earlier is

For Save as TEXT, I use: TextOutputStream
For Save as CSV, I use: BinaryStream
For Save as SQLite, I use: db.DatabaseFile = SQLite_SaveFI

It appears that when the WiFi is set to ON, the problem arise (or can arise) even if I do not have access to the internet (I have locked hotspot around).

It also appeared that if a certain external HD is online (more or less *).

At last, even with Xojo 15r4.1, these appears too.

Now that I can open/save the ListBox contents (and some service data), I will use this when I cannot save to txt nor csv, but as a workaround since this open/save is just beta stage code (it displays the SQLite Record ID for example, when Opened)
I have to finalyze it.

I have two hints to follow:
a. Add a super simple text from ListBox save to txt disk / csv disk,
b. Open the offending hard disk to wake it up before trying to make a save to txt / csv operation to be sure this is the faultive.

Note: usually, the project and the open/save files are located in the internal SSD, no more in the external HD (which is used as a storage device, not really an all purpose online Volume).

Feel free to send clues / advices.

  • This USB 3 hard disk (WS Elements 2.5") have a nap feature: sometimes in the FInder, I got the multicolor circle Cursor when I want to open it and it get second(s) to open the asked window.

Please post some code.
The methods used to SAVE to BinaryStream or TextStream while not the same are “similar”
but the method to save to SQLLite is TOTALLY different, as you need to create a database, then inside the database one or more tables, then either INSERT INTO those tables, UPDATE those tables or some other SQL function depending on the result desired.

I have found when I go to save a file on a disk that is “asleep”, I don’t have to do anything special. It just takes a few extra seconds while the app automatically waits for the drive to awaken.

Hi Dave,

thank you for your answer.

I will do later this morning.

That is my experience too (not with Xojo).

Note: Xojo IDE is at fault when a project is on an external Hard DIsk when the disk is mounted after Xojo was launched. In this case, I quit and re-run Xojo.

Sorry for the delay. Here are more data (code extracts that will not help, but these are the used code and more debug details).

Hi Dave, the Readers,

it tooks me a bit of time to really found the used code (I needed to get the error to be sure of it). Once I get the error, ven after many naps), it was showed consistency *

Code for the TEXT Method:

Method: ExportAsTXT
Inputs: ExportFI As FolderItem, LB As ListBox
Syntax: ExportAsTXT(ExportFI, LB)

[code]Dim ExportTOS As TextOutputStream

If ExportFI = Nil Then
MsgBox “An error occured” + EndOfLine + EndOfLine +_
“Unable to save the newly added data. Try to export them as CSV or SQLite.”

Return
End If

// Get a TextOutputStream reference
ExportTOS = TextOutputStream.Create(ExportFI) // The IOException occured here ![/code]

Code for the CSV Method:

Method: ExportAsCSV
Inputs: ExportFI As FolderItem, LB As ListBox
Syntax: ExportAsCSV(ExportFI, LB)

[code]Dim ExportBS As BinaryStream

If ExportFI = Nil Then
MsgBox “An error occured” + EndOfLine + EndOfLine +_
“Unable to save the newly added data. Try to export them as TEXT or SQLite.”

Return
End If

// Get a BinaryStream reference
ExportBS = BinaryStream.Create(ExportFI, True) // The IOException occured here ![/code]

I’ve made intensive testings (with the debugger) this afternoon with the CSV code (!) above and found nothing. I may have to change my eyes and glasses ;-:).
Even this crashed:

Dim SaveBS As BinaryStream = BinaryStream.Create(SaveFI, True)

Nota: the file i/o is done in the Documents folder…

I added some PushButtons with new code, but I had troubles (!) getting the IOException error (!), using the shared code (from the docs), then adding SaveAsDialog, etc. [After comparing the new code with the one used before, I am a bit happy with it: thank you].

NOTA: Historically, I loose the most advanced version of this project (2015-09-15), but I had the chance to have a pdf of a previous version (older by two or three days) and I use that to re-build the previous project from a version from 2014-12.
Also, it appears to me (some days ago), that I programmed this project like a pig (no offense to the so-called pigs). I have to make an extensive revision of this project once these troubles will go away.

  • I have to remove the other instances of code that also “save”, but are not used.