diff --git a/mcs/class/System/System.IO/FileSystemWatcher.cs b/mcs/class/System/System.IO/FileSystemWatcher.cs index cbf71e7a9a68..33b1d0c8403e 100644 --- a/mcs/class/System/System.IO/FileSystemWatcher.cs +++ b/mcs/class/System/System.IO/FileSystemWatcher.cs @@ -123,10 +123,11 @@ void InitWatcher () string managed = Environment.GetEnvironmentVariable ("MONO_MANAGED_WATCHER"); int mode = 0; + bool ok = false; +#if !UNITY_AOT if (managed == null) mode = InternalSupportsFSW (); - bool ok = false; switch (mode) { case 1: // windows ok = DefaultWatcher.GetInstance (out watcher); @@ -149,6 +150,7 @@ void InitWatcher () watcher_handle = (watcher as CoreFXFileSystemWatcherProxy).NewWatcher (this); break; } +#endif if (mode == 0 || !ok) { if (String.Compare (managed, "disabled", true) == 0)