Trashcan.delete() does not preserve the currently active project
The trashcan functionality internally starts a secondary session for the same user which is used for the actual deletion of items (see #1667). The active project on the main session (if any) is never transferred to the secondary session.
This is normally not any problem since in the BASE gui a user can only use the trashcan functionality on items that is owned by the user itself.
However, custom code may try to use the trashcan functionality with items that are owned by different users and shared via a project. This will fail to delete all items since the secondary session may not have access to all items due to the project not being active.