-
Notifications
You must be signed in to change notification settings - Fork 5.3k
[Wasm] Disable tests for HostFileChangeMonitor #38386
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label. |
...libraries/System.Runtime.Caching/src/System/Runtime/Caching/HostFileChangeMonitor.Browser.cs
Outdated
Show resolved
Hide resolved
...libraries/System.Runtime.Caching/src/System/Runtime/Caching/HostFileChangeMonitor.Browser.cs
Outdated
Show resolved
Hide resolved
|
What is the behavior one gets on browser wasm before this change? Would that behavior be good enough? (I agree we need to disable the test.) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
License header
|
@jkotas It'll throw |
Is it the case even after #38368 ? |
It'll throw PNSE. I guess that raises the question, should HostFileChangeMonitor also throw PNSE? |
|
I do not think we need to be transitively updating all places that depend on unsupported functionality, unless there is significant value in doing so (e.g. allow large amount of code to be linked away in frequently used library). |
I think we should attempt to get as close to the top of the public API as possible. In this case, it's pretty cheap to do, so why not? |
I think there is almost always value in being explicit in public APIs if they throw PNSE or not. It's not only about size but more about making it easier for human reviews and tooling to extract this kind of information. |
I agree with that for the inbox libraries. System.Runtime.Caching is independent nuget package that happens to live in dotnet/runtime (we are shipping the org structure). The independent nuget packages should prefer to be platform neutral and depend on the support matrix of the underlaying platform-specific libraries where possible. |
|
What if we add a check to the HostFileMonitor constructor: if (RuntimeInformation.IsOSPlatform(OSPlatform.Create("BROWSER"))
throw new PlatformNotSupportedException();Then the assembly could stay platform neutral. |
|
Do you expect that every nuget package out there should add a check like this around a call to API that's unsupported on wasm? If not, we should not be doing this in our nuget packages either. |
|
Yes I think that would be something a nuget package should do to disable functionality that doesn't work on wasm/browser. |
|
That is a very high tax on the ecosystem as a whole. Also, it is a encouraging bad pattern that is not future proof. If a future version of webassembly adds support for some of these, it means everybody has to do a replat. A better pattern for this is to catch PlatformNotSupported exception and convert it in more appropriate exception. This only makes sense when there is a more appropriate exception - not the case here. |
|
I still think it's better to be explicit as most users probably treat our In this specific case it's pretty unlikely browsers would add something like an inotify API since there's no filesystem at all, we're using an emulation layer provided by emscripten. |
|
cc @ericstj This is related to our discussion about how far we should be going with platform special casing. |
|
We shouldn't be doing this. Even the type you're throwing from has another path through it where the caller can provide their own implementation by setting ObjectCache.Host. We shouldn't be projecting our platform-specific characteristics up the stack. If we find it important enough for libraries to react to this, we should design capability APIs that they can use, like was done for Ref.Emit. |
@ericstj I'm not sure what you mean by that? |
|
Look for |
|
I see. In that case I think I agree we should just skip the tests only. |
src/libraries/System.Runtime.Caching/src/System.Runtime.Caching.csproj
Outdated
Show resolved
Hide resolved
HostFileChangeMonitor relies on FSW, which is not supported on wasm. This change also disables the corresponding tests that were failing.
HostFileChangeMonitor relies on FSW, which is not supported on wasm. This change disables the corresponding tests that were failing.