Random NilObjectExceptions

Xojo 2019r2 continues to have rather odd side effects. Why do I get a NOE in the below code:

[code]dim theProcesses as processMBS

if theBundleID = “” then Return false

theProcesses = new processMBS
if theProcesses.BundleID = theBundleID then
return true
end if

dim Timeout as Integer = System.Ticks + 60 * 30
while theProcesses.getNextProcess and System.Ticks < Timeout '<–NOE here
if theProcesses.BundleID = theBundleID then
return true
end if

The code itself works fine when I execute it in a simple project. I have used the code for ages without problems. For instance, before I do an AppleScript I make sure that the app is running.

I only get the NOE when I try to check for Filemaker. And I get the NOE for different locations where the function is called.

I tried the code below and don’t get an exception!?

[code]Dim theProcesses As processMBS

Dim theBundleID As String = “com.filemaker.client.pro12”
'If theBundleID = “” Then Return False

theProcesses = New processMBS
If theProcesses.BundleID = theBundleID Then
End If

Dim Timeout As Integer = System.Ticks + 60 * 30
While theProcesses.getNextProcess And System.Ticks < Timeout
If theProcesses.BundleID = theBundleID Then
'Return True
End If


Does the exception have a message text or stack trace?
It looks different when the plugin raises it compared to Xojo runtime itself.

Changed channel and title because the NOE when getting a process is just a symptom.

I instantiate a server socket singleton for talking with Filemaker. If I take that out then the NOEs are gone.

[code]Private Function AddSocket(socket as ServerSocket) as TCPSocket

'add some sockets

Dim ret As TCPSocket = New FilemakerClientSocket(mCurrentSocket)
System.Debuglog "Added Socket " + mCurrentSocket.totext+ " at "+socket.LocalAddress.totext
mCurrentSocket = mCurrentSocket + 1
Return ret

exception exc
theException = new ErrorException(exc, currentMethodName)
End Function

Public Sub Constructor()

'prepare the socket

if MainServerSocket = Nil then
MainServerSocket = New ServerSocket
MainServerSocket.Port = mSocketPort
AddHandler MainServerSocket.SocketRequested, AddressOf AddSocket
end if

exception exc
theException = new ErrorException(exc, currentMethodName)

End Sub[/code]

Am I doing something stupid here? The main intent is that Filemaker should talk to my app with “” & Attachment::MailID"

Again can you show message, errorcode and stack trace for the exception you see?

No message text or error code. My general exception handler which should fish out the stack trace doesn’t show anything useful:

[quote]2019-11-29, 09:46:58 unhandled exception!!!
2019-11-29, 09:46:58 Buffer:
2019-11-29, 09:46:58 --------------------------
2019-11-29, 09:46:58 An error happened:
2019-11-29, 09:46:58 Window/Class:
2019-11-29, 09:46:58 Method/Event:
2019-11-29, 09:46:58 Error Message: A really unexpected error occurred!
2019-11-29, 09:46:58 Time: Freitag, 29. November 2019 09:46:58 Mitteleuropische Normalzeit 108768094
2019-11-29, 09:46:58 Type of Error: NilObjectException
2019-11-29, 09:46:58 --------------------------
2019-11-29, 09:46:58 Stack:
2019-11-29, 09:46:58
Sub Delegate.Invoke()
Sub Application._CallFunctionWithExceptionHandling()
2019-11-29, 09:46:58 Stack done
2019-11-29, 09:46:58 ErrorReportWindow.Constructor
2019-11-29, 09:47:11 ---------------------------------------[/quote]

Delegate.Invoke is causing it, so I bet the target of a weakAddressOf is gone.

First off do yourself a favour & use 2.1 since it had one VERY significant change from R2 + a bunch of other fixes