Drag & Drop seems to be broken for .Net MAUI apps on Mac Catalyst, but only on Apple Silicon devices. I need a fix or workaround, but so far I've been unsuccessful.
I have built a non-trivial B2B app in .Net Maui 8 that relies heavily on "drag and drop" functionality to copy images from a list to a 2D layout. The client recently expanded project scope to include MacOS support (we previously supported iPad and Windows). Unfortunately, when running the app on Mac via Mac Catalyst, drag & drop is broken. When dragging begins, the following error message is displayed in debug output:
2024-07-16 06:31:15.674 MacCatalystDragDropTest[1058:13565] Cannot find representation conforming to type com.apple.uikit.private.drag-item
Dragging appears to begin (the dragged item moves with the mouse pointer as expected). When I attempt to drop on the target, the following error appears in the debug output:
2024-07-16 06:31:16.294 MacCatalystDragDropTest[1058:13565] *** Assertion failure in -[NSFilePromiseReceiver receivePromisedFilesAtDestination:options:operationQueue:reader:], NSFilePromiseReceiver.m:349
The events/commands on the DropGestureRecognizer
of the target do not fire, and the source element cannot be dragged again until the app is restarted.
I have created an extremely basic test app to confirm that the problem was not related to application-specific code in the main app. You can find the test app at this repo. It is a stock .Net Maui app with the following elements added to MainPage.xaml
:
<Image Source="dotnet_bot.png">
<Image.GestureRecognizers>
<DragGestureRecognizer/>
</Image.GestureRecognizers>
</Image>
<Image Source="dotnet_bot.png">
<Image.GestureRecognizers>
<DropGestureRecognizer/>
</Image.GestureRecognizers>
</Image>
This sample app displays identical behavior to my original app. Please note that this behavior has not yet been observed on Intel Macs. It has been confirmed on at least two devices using the Apple M2 processor.
A way forward! Can you help? Is there an alternate method to working with the native views? Something I'm missing with the GestureRegonizer
s?
This bug is caused by operating the Mac via Remote Management (in my case, RealVNC Viewer). When connecting hardware and operating the Mac directly, the bug disappears. Remote Management support is not a requirement for our app in production, so I am marking this question as solved.