Random NilObjectExceptions

  1. 2 weeks ago

    Beatrix W

    Nov 28 Pre-Release Testers, Third Party Store Europe (Germany)
    Edited 2 weeks ago

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

    dim theProcesses as processMBS
    
    if theBundleID = "" then Return false
    
    theProcesses = new processMBS
    theProcesses.getfirstProcess
    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
    wend

    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.

  2. Christian S

    Nov 29 Pre-Release Testers, Xojo Pro, XDC Speakers, Third Party Store Germany

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

    Dim theProcesses As processMBS
    
    Dim theBundleID As String = "com.filemaker.client.pro12"
    'If theBundleID = "" Then Return False
    
    theProcesses = New processMBS
    theProcesses.getfirstProcess
    If theProcesses.BundleID = theBundleID Then
      Break
    End If
    
    Dim Timeout As Integer = System.Ticks + 60 * 30
    While theProcesses.getNextProcess And System.Ticks < Timeout 
      If theProcesses.BundleID = theBundleID Then
        Break
        'Return True
      End If
    Wend
    
    Break

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

  3. Beatrix W

    Nov 29 Pre-Release Testers, Third Party Store Europe (Germany)

    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.

    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
        MainServerSocket.Listen
      end if
      
      exception exc
        theException = new ErrorException(exc, currentMethodName)
        
    End Sub

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

  4. Christian S

    Nov 29 Pre-Release Testers, Xojo Pro, XDC Speakers, Third Party Store Germany

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

  5. Beatrix W

    Nov 29 Pre-Release Testers, Third Party Store Europe (Germany)

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

    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 Mitteleuropäische 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 ---------------------------------------

  6. Christian S

    Nov 29 Pre-Release Testers, Xojo Pro, XDC Speakers, Third Party Store Germany

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

  7. Norman P

    Nov 29 Pre-Release Testers, Xojo Pro under THE bus

    @Beatrix W Xojo 2019r2 continues to have rather odd side effects. .

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

or Sign Up to reply!