Creating db in Windows works, fails on Mac

My app opens with

db = new SQLiteDatabase dim f As FolderItem = SpecialFolder.SharedApplicationData.Child("BidSheet") if not f.Exists Then f.CreateAsFolder db.DatabaseFile = f.Child("BidSheet.sqlite") if not db.DatabaseFile.Exists Then if db.CreateDatabaseFile Then
It works fine in Windows, but in OS-X, it fails when checking to see if the db file exists with a nil object exception.

I am new to OS-X. Should my code look like

#if TargetWin32 if not db.DatabaseFile.Exists Then #Else if db.DatabaseFile = Nil Then #Endif if db.CreateDatabaseFile Then
or is there something else going on?

Your code above is not checking for OS X, therefore the error checking will not happen, unless you specifically instruct it to.

The OS X path should also be ApplicationData (not SharedApplicationData).

Check specifically for OS X like this:

#If TargetMacOS then

Are you sure the db actually does exist?
On OSX SharedApplicationData is /Library/Application Support

Also, try to see if ApplicationData works instead?

You cant write there from Mavericks onwards (for no apparent reason)

see this post:

Thank you Jeff.