IO Exception after build

Created my first XOJO app on OSX. Runs okay with the IDE…no errors. However, once I build it, it throws an IO Exception error immediately. The Window paints and gives the error message :IO exception error type 2. Below you’ll see the code that is on OPEN.

Dim f As FolderItem Dim t As TextInputStream dim strline, Pref(4),fname,lname,emailtxt,strPrdCode,strPrdcodeentered as String f = SpecialFolder.ApplicationData.child("r4w").child("ValidationINI.txt") 'file ValidationINI.txt is the ini file for validation If f <> Nil Then if f.Exists Then t = TextInputStream.Open(f) strline = t.Readline 'read first line Pref=strline.split(",") If Pref(0) <>"" then strPrdCode=uppercase(Pref(0)) if ubound(Pref)>1 then If Pref(1) <>"" then fname = Pref(1) if Pref(2) <>"" then lname = Pref(2) if Pref(3) <>"" then emailtxt = Pref(3) if Pref(4) <>"" then strprdcodeentered = Pref(4) end if else Msgbox "ValidationINI.txt is missing" end if End If t.close Code.text=strprdcodeentered FN.text=fname LN.text=lname Email.text=emailtxt

There are other textinputstream and textoutputstream code segments in the Ok Button Action, but I suspect it’s the Open. Window has first name, last name, email address, registration code text boxes, plus an Ok button and Cancel button.

Hmmm Troubleshooting XOJO run time errors on build but not IDE run seems daunting. How do I begin?

I rebuilt it without any changes, and it now runs. I suspect it has something to do with the threat of the forum members pouncing on it that made it submit and run right. Thanks anyway.
Nevertheless, what is the best approach to troubleshooting a runtime error that doesn’t show up in the IDE run.

You should use Try/Catch or at least the App.UnhandleException event to catch exceptions at runtime. When in the IDE, exceptions will show the debugger, but they will just terminate a built app.

Try t = TextInputStream.Open(f) Catch e As IOException MsgBox("Unable to open " + f.Name + ", error: " + e.Message) End Try

You might also put logging in areas that you think are causing problems.