Skip to content

Conversation

@jozkee
Copy link
Member

@jozkee jozkee commented Jul 22, 2021

Fixes #56178

Since PhysicalFilesWatcher can be used without a FileSystemWatcher through polling, I reduced the unsupported scenarios to only the ones that actually use FSW in browser with a couple of runtime checks.
Let me know if this is not a good idea and instead we should mark the whole type as unsupported.

@ghost
Copy link

ghost commented Jul 22, 2021

Tagging subscribers to this area: @maryamariyan, @dotnet/area-extensions-filesystem
See info in area-owners.md if you want to be subscribed.

Issue Details

Fixes #56178

Since PhysicalFilesWatcher can be used without a FileSystemWatcher through polling, I reduced the unsupported scenarios to only the ones that actually use FSW in browser with a couple of runtime checks.
Let me know if this is not a good idea and instead we should mark the whole type as unsupported.

Author: Jozkee
Assignees: -
Labels:

area-Extensions-FileSystem

Milestone: -

Copy link
Member

@safern safern left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jozkee jozkee requested a review from eerhardt July 22, 2021 23:27
@jozkee jozkee merged commit aa0cf93 into dotnet:main Jul 23, 2021
@jozkee jozkee deleted the fileprovider-browser branch July 23, 2021 02:03
@lewing
Copy link
Member

lewing commented Jul 23, 2021

This enables the code but none of the tests? Did you try running any of the tests?

@jozkee
Copy link
Member Author

jozkee commented Jul 23, 2021

I ran them on Windows and Ubuntu. Do you mean enable them for browser?

@lewing
Copy link
Member

lewing commented Jul 23, 2021

yes I meant for browser.

@jozkee
Copy link
Member Author

jozkee commented Jul 23, 2021

I did not run them for browser locally, is it too cumbersome to do?
If so, I can send a PR that removes this line in the test csproj and see what happens:

Comment on lines +164 to +167
FileSystemWatcher watcher = UsePollingFileWatcher && UseActivePolling ? null :
#if NETCOREAPP
OperatingSystem.IsBrowser() ? throw new PlatformNotSupportedException(SR.Format(SR.FileSystemWatcher_PlatformNotSupported, typeof(FileSystemWatcher))) : new FileSystemWatcher(root);
#else
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't this still throw PNSE when creating a PhysicalFileProvider on browser? Shouldn't the logic be something like:

(UsePollingFileWatcher && UseActivePolling) || OperatingSystem.IsBrowser() ? null : ...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I see, so we should always fallback to use polling on browser. That makes sense to me.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI: PR #56257 addresses this in 276b008.

@ghost ghost locked as resolved and limited conversation to collaborators Sep 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Most of Microsoft.Extensions.FileProviders.Physical should be supported on Browser

5 participants