Nil Exception Error Windows 8.1

Working on my app using Windows 8.1 and version 2015 R2.2.

Application runs wonderfully in the debug mode. No errors, perfect. However, following a build, the application tosses a nillobjectexception error. Something wasn’t handled causing the built application to shut down. Can not for the life of me figure out why the application runs perfectly with the debugger/IDE but crashes as a stand alone.

Ideas? Thoughts?

Do you read from a file? It might not be in the same place in the built app as the debug app so the assumptions your code makes are incorrect for the built app. If not you will have to give us more details - what does your app do, etc?

Yes, all of the required files that the program uses are also in the folder with the built application. Same as they are in the debug. Three database files and one text file. Since the debugger doesn’t break, there is no telling what isn’t being handled.

Use System.debugLog to add some logging to your app so that you can find where it fails. Alternatively you can use the UnhandledException event handler in the app object to get a stack trace.

Sorry to insist, but the path App.ExecutableFile is not at all the same in debug and build. That often explains the nil object exception.

You should have two different paths.

Also, if you have “installed” the built app, then the permissions are going to be different. You typically cannot expect to access a database in the same directory as the executable. Database files should be stored elsewhere, such as AppData.