MapKitViewControlMBS PlatformNotSupportedException on Windows

I have a cross-platform desktop app where I want to display a MapKitViewControlMBS map for macOS users, but this control will be invisible for Windows and Linux.

All the MapKitViewControlMBS code is surrounded with #If TargetMacOS then…, yet I get a PlatformNotSupportedException ‘Mac 64-bit only.’ on Windows. It compiles and runs, but when I Show the window with the map I get the error and have to jump over it. The app window seems to run OK after this, but slows down my debugging, and I plan to put this map in other windows.

I can surround the showing of the window with #Pragma BreakOnExceptions False to stop the error, but this seems like a sledgehammer on a walnut.

Is there a better way to include this control on the window, but not get the debug error?

Make two windows?
Put the map in a container, which you only add when needed.

Our constructor raises this exceptions.

The map is already in a container, as I have added many viewing controls to make it more powerful.

Embedding it at runtime might work, but two windows would be way too much trouble.

I think I’ll stick with #Pragma BreakOnExceptions False/Default.

Thank you.

I could also change it not raise exception or make an advanced user shared property to disable it.

We may just remove the exception for Windows/Linux, so the control would just do nothing on Windows.

1 Like

I sent you a link with a new plugin. Enjoy!