Hi. I had a customer contact me about seeing the NilObjectException. When asking her where in the program she was when she saw this error, she said it has happened a couple of times on different screens. I’ve run the built app myself on many occasions and have not uncovered any errors, nor have I heard from other customers noticing the same issues, at least none have reported seeing this, and also nothing during debugging
I kind of understand why NilObjectExceptions occur and have made necessary changes in the past. I’ve even requested to see her database files for the program, and they all check out. Nothing seems amiss. I even put her files into my program’s data folder and ran the program, and nothing
I don’t fully grasp (and think may be useful) the Try…Catch blocks. Problem is, especially with her program, that I cannot tell just where this code would need to be to find the error. I also would like to embed the Try…Catch into several areas and have the program send me an email with the information about the error so I can recreate the issue. Is this possible? The sample code in the LR only says to “add your code here”. What can you enter in here to at least display in a messagebox to say what the problem is?
Try
Dim d As Xojo.Core.Date
Dim t As Text = d.ToText
Catch e As RuntimeException
If e IsA NilObjectException Then
' your code
Else
' Re-raise the exception for the framework
Raise e
End If
End Try