An exception of class FunctionNotFoundException was not handled


I have created a Desktop app for Win/Mac/Linux. Now a few Windows users have this error message while starting up the app.

An exception of class FunctionNotFoundExpection was not handled. The application must shut down.

I sadly can’t debug it on my Mac as it only happens on some Windows 10 systems.

Any idea what the error message means and how I can locate it?

This is caused by using declares that are not available on the target system. Look for places in your code that say Soft Declare or if you have declares for macOS or Linux that are not inside a TargetmacOS or TargetLinux block respectively.

Your app is attempting to call a system function that doesn’t exist. Typically this is through a “soft declare”, but if you haven’t done that, you need to track it down and report it to the appropriate party. That might be Xojo, or perhaps a plugin developer.

I suggest you enlist the help of one the affected users to troubleshoot. Send them a special version that has copious logging to a file they can return to you.

I am able to debug for Windows on my Mac. I create a virtual machine using VirtualBox and run Windows in it. Then I can use remote debugging to run it in debug mode in the IDE. That way you can find where your exception is happening.

Thank you guys for the quick and informative answer!

In truth I am using “Soft Declare” (and only “Soft Declare”, no “Declare”). So then I try to disable them in order to find out which of these do not work.

@TimStreater: Only a few ppl get this error (on Windows 10). Even if I have a VM for this it is not ensure I would get this error too.The main testers (Win 10) didn’t get this error.

This might help you, if you didn’t know about it.

1 Like

I agree it is some work to set it up, buy you may find it worth it in the long run. I have 3 VMs, Win10, Win7, and Linux. So far my app does not work in Linux but I found the others to be useful as there are some issues with HTMLViewer renderer in Windows.

I have added the FunctionNotFoundException on all SoftDeclares to find out which might not be found. I deliver all soft declared functions with my app but it might be that those are trying to access an OS specific function(?).

System.IsFunctionAvailable - Xojo Documentation I also a great help to prevent the exception at all, tnx!

Did you look into stack property for the exception to learn where it happened?