Checking if class is Nil on Windows gives UnsupportedOperationException 'Only for 64-bit Mac apps.'

I am testing my desktop app on Windows after getting it working on macOS. I check to see if a Class (CommonUsers) has been instantiated by checking if it is Nil and, if it is, I will instantiate it. The Class is on a WebContainer (User and Users) that is on a WebPage (WinUsers).

What is weird is that it gives an UnsupportedOperationException ‘Only for 64-bit Mac apps.’ Checking other similar Classes on WebContainers on WebPages work fine.

What could be the cause?

What Is user?

I have code to raise this exception with that message in MBS Plugins six times.
All related to accessing objects for Contacts framework, which is Mac 64-bit only.

1 Like

I have a Document Window called WinUsers. On it is a PagePanel with three panels, each holding one Container: one with a generic list of all Users (called Users), a specific one with the single user we are currently editing (called User) and one with a generic Help display.

I have one class called CommonEditTable for editing the generic Users Container and another called CommonUsers for editing the specific user data. I have them in an external class so they can be used for both desktop and Web apps.

I have about a dozen windows that act this way and they work identically (based from a common window core) and all work fine except three (Users, Employees and Contacts).

Even doing a WinUsers.Show gives the same Exception and the Open Event of the windows is never run. Even surrounded with a try…end try command, the app still crashed from that line.

If it’s not MBS-related, check the advanced properties for which platform the class(es) is supposed to be included in? I don’t think that message is quite so well put, but it’s worth a check.

It all works fine on macOS. This is run from my Mac to a Parallels VM running Windows 10.

I set all the classes, modules and properties for one of the windows to 64-bit only plus desktop 32-bit, but still get the same error.

Could it be an MBS clash with the name ‘Contacts’ for the Container (plus Employees and Users)?

It could be. @Christian_Schmitz did say above that he has this exact message in his plugins for Contacts. I’d use a different name if his plugin is registering just plain “Contacts” within your project.

I wonder whether you have some constructor, which is called when you access the property.
e.g. the window is newly created, which may create a CNContact*MBS class.

Bingo! That is the common denominator as for each you can populate the contact fields from a button that shows the contacts address book.

I have enclosed all the code in #if target macOS then…, but it still has the issue by the mere presence of the ClassCNContactPickerMBS class on the page. I cannot set it to macOS only.

Make the property of type variant and initialize if needed.

1 Like

I shall do this, but is it possible to set the plugin to not give the exception error in non-macOS apps?

Catch the exception on Windows&Linux?

Thanks, but I tried wrapping it in a Try…Catch…End Try on Windows, but the app still crashed out. The IDE was still OK.

It wasn’t any code running that crashed, just the presence of the ClassCNContactPickerMBS class on the window and Showing the window was enough.