Xojo newbie question :

I am getting this particular error message “An exception of class NilObjectException was not handled. The application must shut down”

This error is happening before the open event or anything else is can set a breakpoint on.

I have created a class with super [application] and my App object is based on this subclass.
Since I can’t use the debugger nor is the UnhandledException method called, the message seems to come from the compiler but I have no idea where to look.

Does anybody have any idea’s on how I can look into solving this issue?


Change your App object’s super back to Application and see what happens.

Why did you need to subclass Application anyway? App is already a subclass.

Hi Kem,

I am subclassing the Application so we can add code general for all projects.
I am writing an application framework so that most of the default stuff for all projects is handled by our projects framework.

and something funny/strange is happening because before any code is executed the error occurs.
But the compiler doesn’t give any warning, you would expect that the error is caused by some line of code.
But the error happens before the open event of the App object and that’s where our code starts to execute.

This way it is difficult to find exactly what is causing the error so I am hoping (actually, i am pretty sure) I have done something so obvious that i am overlooking something. And currently hoping that someone knows a trick in helping me become able to resolve this issue.
So far no luck yet.

Any chance you can share the project?

Does your application subclass have a constructor where the exception might be happening?

I would also vote the constructor of the app superclass.

In general it may be a good idea to have some bug reporting there which reports the exception from app.UnhandledException event and show the stack trace.

Maybe our Bugreporter Kit helps:

You could put all your shared functionality into an external module that all the projects use. App is probably the wrong place.

Thank you all for sharing you’re thoughts, I have resolved my problem but have no clue what is causing the error.

On the Q about a constructor in the app class, in my case there is no constructor.

The remarks about bug reporting in the app.UnhandledException event is also not applicable because the code never reaches that point.

The error message really happens before any of our code is executed, that is what makes this error so strange.
To make it even more spooky, as i mentioned i am trying to develop a project framework, and all the code that is used so far is all stored in external files. In another project I am using exactly the same files and there the error doesn’t occur.

When I click the run button, the progressbar (probably the compiler) shows and the disappears just like every normal compile cycle.
And then after a few moments the error dialog appears.

Basically I have solved it by building a new project (which will be my project template) , set all the property as documented and everything works fine. I have tried to diff the 2 project file with the xml format but there are to many differences to really be able to find the probable cause, the version control format saves everything in different files and it is to much trouble to compare the individual files since I already solved my initial issue.

But thanks again for all the suggestions it is really appreciated.

Sounds like a corrupted project file. Dump it and move on. Or submit it to xojo so they can find out what happened.