Bug 24955 - System.IO.FileSystemWatcher missing
Summary: System.IO.FileSystemWatcher missing
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: XI 8.4.0
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2014-12-01 10:10 UTC by Paul Johnson
Modified: 2014-12-02 05:57 UTC (History)
2 users (show)

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

Source code (198.64 KB, application/zip)
2014-12-01 10:10 UTC, Paul Johnson

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 Paul Johnson 2014-12-01 10:10:21 UTC
Created attachment 8920 [details]
Source code

I've built monotorrent and added it without an issue to a Xam.Android project. When I add it to my Xam.iOS project, the code will compile but fail saying that System.IO.FileSystemWatcher cannot be resolved when deploying to my iPhone 6+. The simulator has no issues

=== Xamarin Studio ===

Version 5.6.3 (build 3)
Installation UUID: c57fc5ec-c7e9-4c72-96e0-504d044598a5
	Mono 3.10.0 ((detached/92c4884)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 310000031

=== Apple Developer Tools ===

Xcode 6.1 (6539)
Build 6A1046a

=== Xamarin.Mac ===

Version: (Business Edition)

=== Xamarin.iOS ===

Version: (Business Edition)
Hash: 840a925
Build date: 2014-11-16 21:03:22-0500

=== Xamarin.Android ===

Version: (Business Edition)
Android SDK: /Users/Paul/Library/Developer/Xamarin/android-sdk-mac_x86
	Supported Android versions:
		1.6    (API level 4)
		2.1    (API level 7)
		2.2    (API level 8)
		2.3    (API level 10)
		3.0    (API level 11)
		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)
		4.4.87 (API level 20)
		5.0    (API level 21)
Java SDK: /usr
java version "1.8.0_20-ea"
Java(TM) SE Runtime Environment (build 1.8.0_20-ea-b21)
Java HotSpot(TM) 64-Bit Server VM (build 25.20-b20, mixed mode)

=== Build Information ===

Release ID: 506030003
Git revision: 8e5dd350297f7ce0d71930250b4e1e5399f1d491
Build date: 2014-11-21 20:07:36-05

=== Operating System ===

Mac OS X 10.10.1
Darwin Pauls-MacBook-Pro.local 14.0.0 Darwin Kernel Version 14.0.0
    Fri Sep 19 00:26:44 PDT 2014
    root:xnu-2782.1.97~2/RELEASE_X86_64 x86_64
Comment 1 Rolf Bjarne Kvinge [MSFT] 2014-12-02 05:57:47 UTC
MonoTorrent.[Dht].dll are desktop assemblies (they reference mscorlib.dll and System.dll v2.0.0.0), and can't be used as-is in mobile projects (neither Xamarin.Android nor Xamarin.iOS).

The solution is to re-compile MonoTorrent.[Dht].dll, either as a PCL with the appropriate profile, or as a Xamarin.iOS/Xamarin.Android class library. You'll have to remove any System.IO.FileSystemWatcher usage (as well as any other API that isn't present on the mobile platforms).

Note that the lack of System.IO.FileSystemWatcher does not cause a build failure in Xamarin.Android, but it would still fail at runtime if the code tries to use System.IO.FileSystemWatcher (same as what would happen in the iOS simulator).

Also note that System.IO.FileSystemWatcher does not make much sense on a mobile platform, since you can't watch anything outside your sandbox, and for things inside your sandbox you have complete control anyway.