DoEvents NilObjectException in 2020r2.1

Ok, so I thought I’d give 2020r2.1 a go after avoiding API 2.0 for as long as possible, but surprisingly everything seemed to be going just fine until the simplest of things throws a spanner in the works.

Do Until srv.IsListening = False
  DoEvents
Loop

It’s essentially a ConsoleApplication with a DoEvents loop while a server socket is listening, I’ve used this many times before without problem but when I run the app I am getting a NilObjectException when trying to call DoEvents every time.

Has DoEvents been removed? It appears in the autocomplete and latest documentation so can’t believe that. Even if it was, shouldn’t it raise a “method does not exist” instead? The App object is definitely non-nil so I’m not sure what’s causing this (App.DoEvents also has the same result).

Maybe a bug?

Add Self. or App. before DoEvents

How is your App class called? “App”?

Self and App make no difference, App is still using default name of App currently

For what it’s worth, we transitioned our middleware app to the new versions of Xojo without issue.

Are you breaking into the debugger on the exception?

Ok, panic over
I found the problem, I’d forgotten to return the new TCP socket I’d created in the ServerSocket’s AddSocket Event. I’m guessing this was causing a NilObjectException within Xojo’s own internal handling going on underneath so the exception got passed back up to the next piece of my own code

2 Likes