Bug 18566 - UIActivityItemProvider properties should not call EnsureUIThread
Summary: UIActivityItemProvider properties should not call EnsureUIThread
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: 7.2.0
Hardware: PC Mac OS
: Normal normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2014-03-25 06:08 UTC by Tom Gilder
Modified: 2014-06-03 06:26 UTC (History)
4 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Tom Gilder 2014-03-25 06:08:51 UTC
UIActivityItemProvider is thread-safe but all of its properties call UIApplication.EnsureUIThread.

iOS calls the "Item" property from it from a secondary thread, as specified in the documentation: https://developer.apple.com/library/ios/documentation/uikit/reference/UIActivityItemProvider_Class/Reference/Reference.html - "This method is called on a secondary thread of your app."

It's also clear from Apple's sample that it's called on a secondary thread: https://developer.apple.com/library/ios/samplecode/sc2273/Listings/AirDropSample_APLAsyncImageActivityItemProvider_m.html#//apple_ref/doc/uid/DTS40013842-AirDropSample_APLAsyncImageActivityItemProvider_m-DontLinkElementID_6

My app access PlaceholderItem and ActivityType with no issues at all, after setting UIApplication.CheckForIllegalCrossThreadCalls to false.
Comment 1 Rolf Bjarne Kvinge [MSFT] 2014-04-02 07:04:05 UTC

monotouch/master: 50c97caa9e3ab7bebf0ee4785f493e68cfd645b7
Comment 2 Shruti 2014-06-03 06:26:44 UTC
I have verified this issue and seems fixed in master build.

I have checked it in following method/properties of  UIActivityItemProvider class. Here, UIApplication.EnsureUIThread (); should not be called.

Method : 
Properties :

Screencast before fixed : http://screencast.com/t/ORgTM0F7tb       

Screencast of fixed issue : http://www.screencast.com/t/8Sp083mPOAa

Environment Info :
=== Xamarin Studio ===

Version 5.1 (build 322)
Installation UUID: 561c7a69-0a91-4bae-ad7c-f0c79d594337
   Mono 3.4.0 ((no/c3fc3ba)
   GTK+ 2.24.23 (Raleigh theme)

   Package version: 304000204

=== Apple Developer Tools ===

Xcode 5.1.1 (5085)
Build 5B1008

=== Xamarin.Mac ===

Xamarin.Mac: Not Installed

=== Xamarin.iOS ===

Version: (Business Edition)
Hash: a82e30c
Build date: 2014-06-02 11:31:47-0400

=== Xamarin.Android ===

Version: 4.14.0 (Trial Edition)
Android SDK: /Users/tajinder/Desktop/android-sdk-macosx
   Supported Android versions:
       2.1   (API level 7)
       2.2   (API level 8)
       2.3   (API level 10)
       3.1   (API level 12)
       3.2   (API level 13)
       4.0   (API level 14)
       4.0.3 (API level 15)
       4.1   (API level 16)
       4.2   (API level 17)
       4.3   (API level 18)
       4.4   (API level 19)
Java SDK: /usr
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)

=== Build Information ===

Release ID: 501000322
Git revision: e79f17166d197fa4e7b2750c623d3eed3209aa98
Build date: 2014-06-02 18:20:30-04
Xamarin addins: b68a34ef2fc4c46b045dc38e26fb199bfe1b201d

=== Operating System ===

Mac OS X 10.8.4
Darwin Tajinders-iMac.local 12.4.2 Darwin Kernel Version 12.4.2
   Mon Jun 17 18:00:12 PDT 2013
   root:xnu-2050.45.8~1/RELEASE_X86_64 x86_64