That's the problem, we don't have any error messages. We have never seen it actually happen, only the results when our customers contact us to tell us that the application is not functioning properly.
We have quit complex application that is dependent on a working configuration and occasionally this configuration fails us and the application stops functioning correctly. What leads me to believe it has something to do with KeyValueStore is that as soon as we reapply the complete configuration the application start functioning correctly. It is quite possible that it is how we use the KeyValueStore that is the problem. However, we read from the KeyValueStore in a lot of different places and depending on what key we fail to read we get different incorrect behaviours.
At the moment the KeyValueStore is accessed from a Utils-class that is initialized in various different classes and we both write and read to the KeyValueStore in numerous places. Could this be the problem?
How would you recommend we should use the KeyValueStore in an effienct and safe way? Is it possible to create a singleton in B4A?
The initialisation code is run in the initialisation function of the Utils-class
xui.SetDataFolder("kvs")
KVS.Initialize(xui.DefaultFolder,"kvs.data")
Public Sub WriteConfig(mykey As String,myvalue As String)
Try
KVS.Put(mykey,myvalue)
Catch
Logger("Failed to write value " & myvalue & " for key " & mykey & ". Exception: " & LastException)
Log(LastException)
End Try
End Sub
Public Sub ReadConfig(key As String) As String
Try
If KVS.ContainsKey(key) Then
Return KVS.Get(key)
End If
Catch
Logger("Failed to load value for key " & key & ". Exception: " & LastException)
Log(LastException)
End Try
Return ""
End Sub
The logging code you see in the read and write methods have just been added and have not yet gone out to any customers so no info from there I'm afraid.