diff --git a/src/libraries/System.Private.CoreLib/src/System/IO/Stream.cs b/src/libraries/System.Private.CoreLib/src/System/IO/Stream.cs index 4a4c00efd30137..f8ac78c9bdac6e 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IO/Stream.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IO/Stream.cs @@ -222,6 +222,9 @@ internal Task BeginReadInternal( } else { +#if FEATURE_SINGLE_THREADED + if (OperatingSystem.IsBrowser()) throw new PlatformNotSupportedException(); +#endif #pragma warning disable CA1416 // Validate platform compatibility, issue: https://github.com/dotnet/runtime/issues/44543 semaphore.Wait(); #pragma warning restore CA1416 @@ -496,6 +499,9 @@ internal Task BeginWriteInternal( } else { +#if FEATURE_SINGLE_THREADED + if (OperatingSystem.IsBrowser()) throw new PlatformNotSupportedException(); +#endif #pragma warning disable CA1416 // Validate platform compatibility, issue: https://github.com/dotnet/runtime/issues/44543 semaphore.Wait(); // synchronously wait here #pragma warning restore CA1416