PhysicalFileProvider: Use active polling instead of FileSystemWatcher on iOS/tvOS...
authorgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Thu, 26 Aug 2021 19:52:43 +0000 (21:52 +0200)
committerGitHub <noreply@github.com>
Thu, 26 Aug 2021 19:52:43 +0000 (21:52 +0200)
commit4ebbb8ed88ae2656d2072940d3aaf17a2e5cefd6
treee878fa4c4f3b67a670f8d31bae23103db6bfbd1a
parent0669a539416b71c07074953fa8a1b6747ed57b29
PhysicalFileProvider: Use active polling instead of FileSystemWatcher on iOS/tvOS (#58165)

In https://github.com/dotnet/runtime/issues/57931 we found out that the FSEventStream APIs which are used to implement System.IO.FileSystemWatcher aren't allowed on the App Store.
According to [Apple's docs](https://developer.apple.com/documentation/coreservices/1443980-fseventstreamcreate) these APIs are only supported on macOS and Mac Catalyst.

Mark System.IO.FileSystemWatcher as unsupported on iOS/tvOS and throw PNSE.
Switch PhysicalFileProvider to use active polling instead, like we do for Browser.

Addresses https://github.com/dotnet/runtime/issues/57931

Co-authored-by: Alexander Köplinger <alex.koeplinger@outlook.com>
12 files changed:
src/libraries/Microsoft.Extensions.Configuration/tests/FunctionalTests/ConfigurationTests.cs
src/libraries/Microsoft.Extensions.FileProviders.Physical/src/PhysicalFileProvider.cs
src/libraries/Microsoft.Extensions.FileProviders.Physical/src/PhysicalFilesWatcher.cs
src/libraries/Microsoft.Extensions.FileProviders.Physical/tests/PhysicalFileProviderTests.cs
src/libraries/Microsoft.Extensions.FileProviders.Physical/tests/PhysicalFilesWatcherTests.cs
src/libraries/System.IO.FileSystem.Watcher/Directory.Build.props
src/libraries/System.IO.FileSystem.Watcher/src/System.IO.FileSystem.Watcher.csproj
src/libraries/System.IO.FileSystem.Watcher/tests/AssemblyInfo.cs
src/libraries/System.IO.FileSystem.Watcher/tests/System.IO.FileSystem.Watcher.Tests.csproj
src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/FileChangeNotificationSystem.cs
src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/HostFileChangeMonitor.cs
src/libraries/System.Runtime.Caching/tests/System.Runtime.Caching/HostFileChangeMonitorTest.cs