diff --git a/eng/testing/xunit/xunit.console.targets b/eng/testing/xunit/xunit.console.targets
index 717ab8ec3460b6..b728c54ed5082d 100644
--- a/eng/testing/xunit/xunit.console.targets
+++ b/eng/testing/xunit/xunit.console.targets
@@ -13,8 +13,8 @@
-
-
+
+
diff --git a/src/libraries/Common/src/System/Security/Cryptography/Helpers.cs b/src/libraries/Common/src/System/Security/Cryptography/Helpers.cs
index 341931377ddd8d..d34e3a4884e6a5 100644
--- a/src/libraries/Common/src/System/Security/Cryptography/Helpers.cs
+++ b/src/libraries/Common/src/System/Security/Cryptography/Helpers.cs
@@ -17,9 +17,10 @@ internal static partial class Helpers
#endif
[UnsupportedOSPlatformGuard("browser")]
+ [UnsupportedOSPlatformGuard("wasi")]
internal static bool HasSymmetricEncryption { get; } =
#if NET
- !OperatingSystem.IsBrowser();
+ !OperatingSystem.IsBrowser() && !OperatingSystem.IsWasi();
#else
true;
#endif
@@ -35,15 +36,17 @@ internal static partial class Helpers
#if NET
[UnsupportedOSPlatformGuard("android")]
[UnsupportedOSPlatformGuard("browser")]
+ [UnsupportedOSPlatformGuard("wasi")]
public static bool IsRC2Supported => !OperatingSystem.IsAndroid() && !OperatingSystem.IsBrowser();
#else
public static bool IsRC2Supported => true;
#endif
[UnsupportedOSPlatformGuard("browser")]
+ [UnsupportedOSPlatformGuard("wasi")]
internal static bool HasMD5 { get; } =
#if NET
- !OperatingSystem.IsBrowser();
+ !OperatingSystem.IsBrowser() && !OperatingSystem.IsWasi();
#else
true;
#endif
diff --git a/src/libraries/Common/tests/Common.Tests.csproj b/src/libraries/Common/tests/Common.Tests.csproj
index 36ca78878fdb7f..baf24f1232c42e 100644
--- a/src/libraries/Common/tests/Common.Tests.csproj
+++ b/src/libraries/Common/tests/Common.Tests.csproj
@@ -2,7 +2,7 @@
true
true
- $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-linux;$(NetCoreAppCurrent)-browser;$(NetCoreAppCurrent)-osx
+ $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-linux;$(NetCoreAppCurrent)-browser;$(NetCoreAppCurrent)-wasi;$(NetCoreAppCurrent)-osx
();
}
diff --git a/src/libraries/Microsoft.Extensions.Hosting/src/HostingHostBuilderExtensions.cs b/src/libraries/Microsoft.Extensions.Hosting/src/HostingHostBuilderExtensions.cs
index 09274bad3a3cbb..73313d9c0203f3 100644
--- a/src/libraries/Microsoft.Extensions.Hosting/src/HostingHostBuilderExtensions.cs
+++ b/src/libraries/Microsoft.Extensions.Hosting/src/HostingHostBuilderExtensions.cs
@@ -293,7 +293,7 @@ internal static void AddDefaultServices(HostBuilderContext hostingContext, IServ
logging.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));
#if NET
- if (!OperatingSystem.IsBrowser())
+ if (!OperatingSystem.IsBrowser() && !OperatingSystem.IsWasi())
#endif
{
logging.AddConsole();
diff --git a/src/libraries/Microsoft.Extensions.Http/src/MetricsFactoryHttpMessageHandlerFilter.cs b/src/libraries/Microsoft.Extensions.Http/src/MetricsFactoryHttpMessageHandlerFilter.cs
index d55f35a2708536..0a9193299f1447 100644
--- a/src/libraries/Microsoft.Extensions.Http/src/MetricsFactoryHttpMessageHandlerFilter.cs
+++ b/src/libraries/Microsoft.Extensions.Http/src/MetricsFactoryHttpMessageHandlerFilter.cs
@@ -33,7 +33,7 @@ public Action Configure(Action
true
- browser;ios;tvos;maccatalyst
+ browser;wasi;ios;tvos;maccatalyst
\ No newline at end of file
diff --git a/src/libraries/System.ComponentModel.TypeConverter/src/System/Security/Authentication/ExtendedProtection/ExtendedProtectionPolicyTypeConverter.cs b/src/libraries/System.ComponentModel.TypeConverter/src/System/Security/Authentication/ExtendedProtection/ExtendedProtectionPolicyTypeConverter.cs
index c918ac07258d00..9672c785a63b11 100644
--- a/src/libraries/System.ComponentModel.TypeConverter/src/System/Security/Authentication/ExtendedProtection/ExtendedProtectionPolicyTypeConverter.cs
+++ b/src/libraries/System.ComponentModel.TypeConverter/src/System/Security/Authentication/ExtendedProtection/ExtendedProtectionPolicyTypeConverter.cs
@@ -21,6 +21,8 @@ public override bool CanConvertTo(ITypeDescriptorContext? context, [NotNullWhen(
[UnsupportedOSPlatform("browser")]
public override object? ConvertTo(ITypeDescriptorContext? context, CultureInfo? culture, object? value, Type destinationType)
{
+ if (OperatingSystem.IsWasi()) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
+
if (destinationType == typeof(InstanceDescriptor))
{
if (value is ExtendedProtectionPolicy policy)
diff --git a/src/libraries/System.ComponentModel.TypeConverter/tests/Security/Authentication/ExtendedProtection/ExtendedProtectionPolicyTypeConverterTests.cs b/src/libraries/System.ComponentModel.TypeConverter/tests/Security/Authentication/ExtendedProtection/ExtendedProtectionPolicyTypeConverterTests.cs
index 82676a7f3f6e89..5a00c40b8daa13 100644
--- a/src/libraries/System.ComponentModel.TypeConverter/tests/Security/Authentication/ExtendedProtection/ExtendedProtectionPolicyTypeConverterTests.cs
+++ b/src/libraries/System.ComponentModel.TypeConverter/tests/Security/Authentication/ExtendedProtection/ExtendedProtectionPolicyTypeConverterTests.cs
@@ -58,6 +58,7 @@ public void ConvertTo_PositiveTests()
[Theory]
[SkipOnPlatform(TestPlatforms.Browser, "System.Net.Security is not supported on this platform.")]
+ [SkipOnPlatform(TestPlatforms.Wasi, "System.Net.Security is not supported on this platform.")]
[InlineData(typeof(int))]
[InlineData(typeof(ExtendedProtectionPolicy))]
[InlineData(typeof(bool))]
diff --git a/src/libraries/System.Configuration.ConfigurationManager/Directory.Build.props b/src/libraries/System.Configuration.ConfigurationManager/Directory.Build.props
index c843a6347ce61c..3a3d8f9832479f 100644
--- a/src/libraries/System.Configuration.ConfigurationManager/Directory.Build.props
+++ b/src/libraries/System.Configuration.ConfigurationManager/Directory.Build.props
@@ -2,6 +2,6 @@
true
- browser
+ browser;wasi
\ No newline at end of file
diff --git a/src/libraries/System.Data.Odbc/Directory.Build.props b/src/libraries/System.Data.Odbc/Directory.Build.props
index c843a6347ce61c..3a3d8f9832479f 100644
--- a/src/libraries/System.Data.Odbc/Directory.Build.props
+++ b/src/libraries/System.Data.Odbc/Directory.Build.props
@@ -2,6 +2,6 @@
true
- browser
+ browser;wasi
\ No newline at end of file
diff --git a/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Metrics/MetricsEventSource.cs b/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Metrics/MetricsEventSource.cs
index b6c05113bbc6f2..088295b7377a83 100644
--- a/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Metrics/MetricsEventSource.cs
+++ b/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Metrics/MetricsEventSource.cs
@@ -319,7 +319,7 @@ public void OnEventCommand(EventCommandEventArgs command)
try
{
#if OS_ISBROWSER_SUPPORT
- if (OperatingSystem.IsBrowser())
+ if (OperatingSystem.IsBrowser() || OperatingSystem.IsWasi())
{
// AggregationManager uses a dedicated thread to avoid losing data for apps experiencing threadpool starvation
// and browser doesn't support Thread.Start()
@@ -327,7 +327,7 @@ public void OnEventCommand(EventCommandEventArgs command)
// This limitation shouldn't really matter because browser also doesn't support out-of-proc EventSource communication
// which is the intended scenario for this EventSource. If it matters in the future AggregationManager can be
// modified to have some other fallback path that works for browser.
- Parent.Error("", "System.Diagnostics.Metrics EventSource not supported on browser");
+ Parent.Error("", "System.Diagnostics.Metrics EventSource not supported on browser and wasi");
return;
}
#endif
diff --git a/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Metrics/RuntimeMetrics.cs b/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Metrics/RuntimeMetrics.cs
index 287af3127d7ad1..a9bd6b28665b2b 100644
--- a/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Metrics/RuntimeMetrics.cs
+++ b/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Metrics/RuntimeMetrics.cs
@@ -146,7 +146,7 @@ static RuntimeMetrics()
unit: "{cpu}",
description: "The number of processors available to the process.");
- if (!OperatingSystem.IsBrowser() && !OperatingSystem.IsTvOS() && !(OperatingSystem.IsIOS() && !OperatingSystem.IsMacCatalyst()))
+ if (!OperatingSystem.IsBrowser() && !OperatingSystem.IsWasi() && !OperatingSystem.IsTvOS() && !(OperatingSystem.IsIOS() && !OperatingSystem.IsMacCatalyst()))
{
s_meter.CreateObservableCounter(
"dotnet.process.cpu.time",
@@ -174,7 +174,7 @@ private static IEnumerable> GetGarbageCollectionCounts()
[SupportedOSPlatform("maccatalyst")]
private static IEnumerable> GetCpuTime()
{
- Debug.Assert(!OperatingSystem.IsBrowser() && !OperatingSystem.IsTvOS() && !(OperatingSystem.IsIOS() && !OperatingSystem.IsMacCatalyst()));
+ Debug.Assert(!OperatingSystem.IsBrowser() && !OperatingSystem.IsWasi() &&!OperatingSystem.IsTvOS() && !(OperatingSystem.IsIOS() && !OperatingSystem.IsMacCatalyst()));
Environment.ProcessCpuUsage processCpuUsage = Environment.CpuUsage;
diff --git a/src/libraries/System.Diagnostics.FileVersionInfo/Directory.Build.props b/src/libraries/System.Diagnostics.FileVersionInfo/Directory.Build.props
index ce244cbea56199..58979d42f06955 100644
--- a/src/libraries/System.Diagnostics.FileVersionInfo/Directory.Build.props
+++ b/src/libraries/System.Diagnostics.FileVersionInfo/Directory.Build.props
@@ -3,6 +3,6 @@
Microsoft
true
- browser
+ browser;wasi
\ No newline at end of file
diff --git a/src/libraries/System.Diagnostics.Process/Directory.Build.props b/src/libraries/System.Diagnostics.Process/Directory.Build.props
index ce244cbea56199..58979d42f06955 100644
--- a/src/libraries/System.Diagnostics.Process/Directory.Build.props
+++ b/src/libraries/System.Diagnostics.Process/Directory.Build.props
@@ -3,6 +3,6 @@
Microsoft
true
- browser
+ browser;wasi
\ No newline at end of file
diff --git a/src/libraries/System.Diagnostics.TextWriterTraceListener/src/System/Diagnostics/XmlWriterTraceListener.cs b/src/libraries/System.Diagnostics.TextWriterTraceListener/src/System/Diagnostics/XmlWriterTraceListener.cs
index e5b72a51d41132..068d68e36563db 100644
--- a/src/libraries/System.Diagnostics.TextWriterTraceListener/src/System/Diagnostics/XmlWriterTraceListener.cs
+++ b/src/libraries/System.Diagnostics.TextWriterTraceListener/src/System/Diagnostics/XmlWriterTraceListener.cs
@@ -250,7 +250,7 @@ private void WriteEndHeader()
string? processName = s_processName;
if (processName is null)
{
- if (OperatingSystem.IsBrowser()) // Process isn't supported on Browser
+ if (OperatingSystem.IsBrowser() || OperatingSystem.IsWasi() ) // Process isn't supported on Browser
{
processName = string.Empty;
}
diff --git a/src/libraries/System.IO.Compression.Brotli/Directory.Build.props b/src/libraries/System.IO.Compression.Brotli/Directory.Build.props
index f3f5769f936163..76ee806bc1a2b0 100644
--- a/src/libraries/System.IO.Compression.Brotli/Directory.Build.props
+++ b/src/libraries/System.IO.Compression.Brotli/Directory.Build.props
@@ -3,6 +3,6 @@
ECMA
true
- browser
+ browser;wasi
\ No newline at end of file
diff --git a/src/libraries/System.IO.FileSystem.Watcher/Directory.Build.props b/src/libraries/System.IO.FileSystem.Watcher/Directory.Build.props
index c581a9ef9e5a84..a07e665d16a1c1 100644
--- a/src/libraries/System.IO.FileSystem.Watcher/Directory.Build.props
+++ b/src/libraries/System.IO.FileSystem.Watcher/Directory.Build.props
@@ -3,7 +3,7 @@
Microsoft
true
- browser;ios;tvos
+ browser;wasi;ios;tvos
maccatalyst
\ No newline at end of file
diff --git a/src/libraries/System.IO.IsolatedStorage/Directory.Build.props b/src/libraries/System.IO.IsolatedStorage/Directory.Build.props
index ce244cbea56199..58979d42f06955 100644
--- a/src/libraries/System.IO.IsolatedStorage/Directory.Build.props
+++ b/src/libraries/System.IO.IsolatedStorage/Directory.Build.props
@@ -3,6 +3,6 @@
Microsoft
true
- browser
+ browser;wasi
\ No newline at end of file
diff --git a/src/libraries/System.IO.IsolatedStorage/tests/System.IO.IsolatedStorage.Tests.csproj b/src/libraries/System.IO.IsolatedStorage/tests/System.IO.IsolatedStorage.Tests.csproj
index b14e54de417572..0424a4615a07e3 100644
--- a/src/libraries/System.IO.IsolatedStorage/tests/System.IO.IsolatedStorage.Tests.csproj
+++ b/src/libraries/System.IO.IsolatedStorage/tests/System.IO.IsolatedStorage.Tests.csproj
@@ -1,6 +1,6 @@
- $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-unix;$(NetCoreAppCurrent)-browser;$(NetCoreAppCurrent)-maccatalyst;$(NetCoreAppCurrent)-ios;$(NetCoreAppCurrent)-tvos;$(NetCoreAppCurrent)-android
+ $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-unix;$(NetCoreAppCurrent)-browser;$(NetCoreAppCurrent)-wasi;$(NetCoreAppCurrent)-maccatalyst;$(NetCoreAppCurrent)-ios;$(NetCoreAppCurrent)-tvos;$(NetCoreAppCurrent)-android
true
diff --git a/src/libraries/System.IO.MemoryMappedFiles/src/System.IO.MemoryMappedFiles.csproj b/src/libraries/System.IO.MemoryMappedFiles/src/System.IO.MemoryMappedFiles.csproj
index d024cdd7d73110..1710a652f6d6e3 100644
--- a/src/libraries/System.IO.MemoryMappedFiles/src/System.IO.MemoryMappedFiles.csproj
+++ b/src/libraries/System.IO.MemoryMappedFiles/src/System.IO.MemoryMappedFiles.csproj
@@ -1,7 +1,7 @@
- $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-unix;$(NetCoreAppCurrent)-browser;$(NetCoreAppCurrent)
+ $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-unix;$(NetCoreAppCurrent)-browser;$(NetCoreAppCurrent)-wasi;$(NetCoreAppCurrent)
true
false
@@ -86,7 +86,7 @@
-
+
Gets the system's page size.
protected static Lazy s_pageSize = new Lazy(() =>
{
- if (OperatingSystem.IsBrowser())
+ if (OperatingSystem.IsBrowser() || OperatingSystem.IsWasi())
return Environment.SystemPageSize;
int pageSize;
diff --git a/src/libraries/System.IO.Pipes/Directory.Build.props b/src/libraries/System.IO.Pipes/Directory.Build.props
index ce244cbea56199..58979d42f06955 100644
--- a/src/libraries/System.IO.Pipes/Directory.Build.props
+++ b/src/libraries/System.IO.Pipes/Directory.Build.props
@@ -3,6 +3,6 @@
Microsoft
true
- browser
+ browser;wasi
\ No newline at end of file
diff --git a/src/libraries/System.Linq.Parallel/src/System/Linq/ParallelEnumerable.cs b/src/libraries/System.Linq.Parallel/src/System/Linq/ParallelEnumerable.cs
index 55ef371ea04226..9f3dc2674aab52 100644
--- a/src/libraries/System.Linq.Parallel/src/System/Linq/ParallelEnumerable.cs
+++ b/src/libraries/System.Linq.Parallel/src/System/Linq/ParallelEnumerable.cs
@@ -66,7 +66,7 @@ public static class ParallelEnumerable
// be executed in parallel, but will retain PLINQ semantics (exceptions wrapped as aggregates, etc).
#if !FEATURE_WASM_MANAGED_THREADS
[System.Runtime.Versioning.SupportedOSPlatformGuard("browser")]
- internal static bool SinglePartitionMode => OperatingSystem.IsBrowser();
+ internal static bool SinglePartitionMode => OperatingSystem.IsBrowser() || OperatingSystem.IsWasi();
#else
internal static bool SinglePartitionMode => false;
#endif
diff --git a/src/libraries/System.Linq/src/System.Linq.csproj b/src/libraries/System.Linq/src/System.Linq.csproj
index 68b88631587ace..79c10444f489b2 100644
--- a/src/libraries/System.Linq/src/System.Linq.csproj
+++ b/src/libraries/System.Linq/src/System.Linq.csproj
@@ -1,7 +1,7 @@
- $(NetCoreAppCurrent);$(NetCoreAppCurrent)-browser;$(NetCoreAppCurrent)-android;$(NetCoreAppCurrent)-ios;$(NetCoreAppCurrent)-tvos
+ $(NetCoreAppCurrent);$(NetCoreAppCurrent)-browser;$(NetCoreAppCurrent)-wasi;$(NetCoreAppCurrent)-android;$(NetCoreAppCurrent)-ios;$(NetCoreAppCurrent)-tvos
false
diff --git a/src/libraries/System.Net.Http/src/System.Net.Http.csproj b/src/libraries/System.Net.Http/src/System.Net.Http.csproj
index b924bf22a3dc4e..03123bc5adee2c 100644
--- a/src/libraries/System.Net.Http/src/System.Net.Http.csproj
+++ b/src/libraries/System.Net.Http/src/System.Net.Http.csproj
@@ -166,7 +166,7 @@
-
+
@@ -324,13 +324,13 @@
-
+
-
+
@@ -407,7 +407,7 @@
Link="Common\System\Runtime\ExceptionServices\ExceptionStackTrace.cs" />
-
+
-
+
@@ -453,7 +453,13 @@
-
+
+
+
+
+
+
@@ -491,7 +497,7 @@
-
+
@@ -499,15 +505,16 @@
+
-
+
-
+
diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/GlobalHttpSettings.cs b/src/libraries/System.Net.Http/src/System/Net/Http/GlobalHttpSettings.cs
index 72c9a4a3fc52ef..e314957414b6b0 100644
--- a/src/libraries/System.Net.Http/src/System/Net/Http/GlobalHttpSettings.cs
+++ b/src/libraries/System.Net.Http/src/System/Net/Http/GlobalHttpSettings.cs
@@ -23,7 +23,7 @@ internal static class DiagnosticsHandler
internal static class SocketsHttpHandler
{
-#if !BROWSER
+#if !TARGET_BROWSER && !TARGET_WASI
// Default to allowing HTTP/2, but enable that to be overridden by an
// AppContext switch, or by an environment variable being set to false/0.
public static bool AllowHttp2 { get; } = RuntimeSettingParser.QueryRuntimeSettingSwitch(
diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/Headers/KnownHeaders.cs b/src/libraries/System.Net.Http/src/System/Net/Http/Headers/KnownHeaders.cs
index ac819868f77683..1b412481a3badc 100644
--- a/src/libraries/System.Net.Http/src/System/Net/Http/Headers/KnownHeaders.cs
+++ b/src/libraries/System.Net.Http/src/System/Net/Http/Headers/KnownHeaders.cs
@@ -108,7 +108,7 @@ internal static class KnownHeaders
public static readonly KnownHeader XUACompatible = new KnownHeader("X-UA-Compatible");
public static readonly KnownHeader XXssProtection = new KnownHeader("X-XSS-Protection", HttpHeaderType.Custom, null, new string[] { "0", "1", "1; mode=block" });
-#if TARGET_BROWSER
+#if TARGET_BROWSER || TARGET_WASI
private static HttpHeaderParser? GetAltSvcHeaderParser() => null; // Allow for the AltSvcHeaderParser to be trimmed on Browser since Alt-Svc is only for SocketsHttpHandler, which isn't used on Browser.
#else
private static AltSvcHeaderParser? GetAltSvcHeaderParser() => AltSvcHeaderParser.Parser;
diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/HttpProtocolException.cs b/src/libraries/System.Net.Http/src/System/Net/Http/HttpProtocolException.cs
index e61ecba6305798..1314f9e3458554 100644
--- a/src/libraries/System.Net.Http/src/System/Net/Http/HttpProtocolException.cs
+++ b/src/libraries/System.Net.Http/src/System/Net/Http/HttpProtocolException.cs
@@ -35,7 +35,7 @@ public HttpProtocolException(long errorCode, string message, Exception? innerExc
///
public long ErrorCode { get; }
-#if !TARGET_BROWSER
+#if !TARGET_BROWSER && !TARGET_WASI
internal static HttpProtocolException CreateHttp2StreamException(Http2ProtocolErrorCode protocolError)
{
string message = SR.Format(SR.net_http_http2_stream_error, GetName(protocolError), ((int)protocolError).ToString("x"));
diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/SocketsHttpHandler.cs b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/SocketsHttpHandler.cs
index 44acad742e7c21..6c0a8208508bdb 100644
--- a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/SocketsHttpHandler.cs
+++ b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/SocketsHttpHandler.cs
@@ -36,7 +36,7 @@ private void CheckDisposedOrStarted()
/// Gets a value that indicates whether the handler is supported on the current platform.
///
[UnsupportedOSPlatformGuard("browser")]
- public static bool IsSupported => !OperatingSystem.IsBrowser();
+ public static bool IsSupported => !OperatingSystem.IsBrowser() && !OperatingSystem.IsWasi();
public bool UseCookies
{
diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/SystemProxyInfo.Wasi.cs b/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/SystemProxyInfo.Wasi.cs
new file mode 100644
index 00000000000000..845223cdf32266
--- /dev/null
+++ b/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/SystemProxyInfo.Wasi.cs
@@ -0,0 +1,10 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+namespace System.Net.Http
+{
+ internal static partial class SystemProxyInfo
+ {
+ public static IWebProxy Proxy => new HttpNoProxy();
+ }
+}
diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/AssemblyInfo.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/AssemblyInfo.cs
index 386a384e486f10..bf269b513f000a 100644
--- a/src/libraries/System.Net.Http/tests/FunctionalTests/AssemblyInfo.cs
+++ b/src/libraries/System.Net.Http/tests/FunctionalTests/AssemblyInfo.cs
@@ -5,5 +5,5 @@
using Xunit;
[assembly: SkipOnCoreClr("System.Net.Tests are flaky and/or long running: https://github.com/dotnet/runtime/issues/131", ~RuntimeConfiguration.Release)]
-[assembly: ActiveIssue("https://github.com/dotnet/runtime/issues/131", ~(TestPlatforms.Android | TestPlatforms.Browser), TargetFrameworkMonikers.Any, TestRuntimes.Mono)] // System.Net.Tests are flaky and/or long running
+[assembly: ActiveIssue("https://github.com/dotnet/runtime/issues/131", ~(TestPlatforms.Android | TestPlatforms.Browser | TestPlatforms.Wasi), TargetFrameworkMonikers.Any, TestRuntimes.Mono)] // System.Net.Tests are flaky and/or long running
diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/System.Net.Http.Functional.Tests.csproj b/src/libraries/System.Net.Http/tests/FunctionalTests/System.Net.Http.Functional.Tests.csproj
index eb8e53ac574cea..b14c7411169b38 100644
--- a/src/libraries/System.Net.Http/tests/FunctionalTests/System.Net.Http.Functional.Tests.csproj
+++ b/src/libraries/System.Net.Http/tests/FunctionalTests/System.Net.Http.Functional.Tests.csproj
@@ -32,6 +32,7 @@
WasmTestOnWasmtime
$(DefineConstants);TARGET_WASI
+ true
diff --git a/src/libraries/System.Net.HttpListener/Directory.Build.props b/src/libraries/System.Net.HttpListener/Directory.Build.props
index c843a6347ce61c..3a3d8f9832479f 100644
--- a/src/libraries/System.Net.HttpListener/Directory.Build.props
+++ b/src/libraries/System.Net.HttpListener/Directory.Build.props
@@ -2,6 +2,6 @@
true
- browser
+ browser;wasi
\ No newline at end of file
diff --git a/src/libraries/System.Net.Mail/Directory.Build.props b/src/libraries/System.Net.Mail/Directory.Build.props
index 43dc3a2640bbae..129690e06bc247 100644
--- a/src/libraries/System.Net.Mail/Directory.Build.props
+++ b/src/libraries/System.Net.Mail/Directory.Build.props
@@ -2,5 +2,7 @@
true
+
+ wasi
diff --git a/src/libraries/System.Net.Mail/src/System.Net.Mail.csproj b/src/libraries/System.Net.Mail/src/System.Net.Mail.csproj
index c07188adcd018d..f79d691669c15f 100644
--- a/src/libraries/System.Net.Mail/src/System.Net.Mail.csproj
+++ b/src/libraries/System.Net.Mail/src/System.Net.Mail.csproj
@@ -1,7 +1,7 @@
- $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-unix;$(NetCoreAppCurrent)-browser;$(NetCoreAppCurrent)
+ $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-unix;$(NetCoreAppCurrent)-browser;$(NetCoreAppCurrent)-wasi;$(NetCoreAppCurrent)
true
false
@@ -84,12 +84,12 @@
Link="Common\System\Obsoletions.cs" />
-
-
+
+
-
+
diff --git a/src/libraries/System.Net.Mail/src/System/Net/Mail/SmtpClient.Browser.cs b/src/libraries/System.Net.Mail/src/System/Net/Mail/SmtpClient.Wasm.cs
similarity index 100%
rename from src/libraries/System.Net.Mail/src/System/Net/Mail/SmtpClient.Browser.cs
rename to src/libraries/System.Net.Mail/src/System/Net/Mail/SmtpClient.Wasm.cs
diff --git a/src/libraries/System.Net.Mail/tests/Functional/System.Net.Mail.Functional.Tests.csproj b/src/libraries/System.Net.Mail/tests/Functional/System.Net.Mail.Functional.Tests.csproj
index 7336f9199077a7..28ea42dedc3795 100644
--- a/src/libraries/System.Net.Mail/tests/Functional/System.Net.Mail.Functional.Tests.csproj
+++ b/src/libraries/System.Net.Mail/tests/Functional/System.Net.Mail.Functional.Tests.csproj
@@ -1,7 +1,7 @@
true
- $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-unix;$(NetCoreAppCurrent)-browser;$(NetCoreAppCurrent)-osx;$(NetCoreAppCurrent)-ios;$(NetCoreAppCurrent)-android
+ $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-unix;$(NetCoreAppCurrent)-browser;$(NetCoreAppCurrent)-wasi;$(NetCoreAppCurrent)-osx;$(NetCoreAppCurrent)-ios;$(NetCoreAppCurrent)-android
true
true
true
diff --git a/src/libraries/System.Net.NameResolution/Directory.Build.props b/src/libraries/System.Net.NameResolution/Directory.Build.props
index ce244cbea56199..bc799605d32edf 100644
--- a/src/libraries/System.Net.NameResolution/Directory.Build.props
+++ b/src/libraries/System.Net.NameResolution/Directory.Build.props
@@ -3,6 +3,7 @@
Microsoft
true
- browser
+
+ browser;wasi
\ No newline at end of file
diff --git a/src/libraries/System.Net.NameResolution/src/System.Net.NameResolution.csproj b/src/libraries/System.Net.NameResolution/src/System.Net.NameResolution.csproj
index 5d97e2d711f31b..c5c8b4ffc9a582 100644
--- a/src/libraries/System.Net.NameResolution/src/System.Net.NameResolution.csproj
+++ b/src/libraries/System.Net.NameResolution/src/System.Net.NameResolution.csproj
@@ -1,7 +1,7 @@
- $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-unix;$(NetCoreAppCurrent)-browser;$(NetCoreAppCurrent)
+ $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-unix;$(NetCoreAppCurrent)-browser;$(NetCoreAppCurrent)-wasi;$(NetCoreAppCurrent)
true
false
@@ -9,8 +9,8 @@
$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)'))
- SR.SystemNetNameResolution_PlatformNotSupported
- ExcludeApiList.PNSE.Browser.txt
+ SR.SystemNetNameResolution_PlatformNotSupported
+ ExcludeApiList.PNSE.Browser.txt
@@ -96,7 +96,7 @@
Link="Common\Interop\Unix\System.Native\Interop.SocketAddress.cs" />
-
+
diff --git a/src/libraries/System.Net.NetworkInformation/Directory.Build.props b/src/libraries/System.Net.NetworkInformation/Directory.Build.props
index ce244cbea56199..58979d42f06955 100644
--- a/src/libraries/System.Net.NetworkInformation/Directory.Build.props
+++ b/src/libraries/System.Net.NetworkInformation/Directory.Build.props
@@ -3,6 +3,6 @@
Microsoft
true
- browser
+ browser;wasi
\ No newline at end of file
diff --git a/src/libraries/System.Net.Ping/Directory.Build.props b/src/libraries/System.Net.Ping/Directory.Build.props
index ce244cbea56199..58979d42f06955 100644
--- a/src/libraries/System.Net.Ping/Directory.Build.props
+++ b/src/libraries/System.Net.Ping/Directory.Build.props
@@ -3,6 +3,6 @@
Microsoft
true
- browser
+ browser;wasi
\ No newline at end of file
diff --git a/src/libraries/System.Net.Requests/Directory.Build.props b/src/libraries/System.Net.Requests/Directory.Build.props
index ce244cbea56199..58979d42f06955 100644
--- a/src/libraries/System.Net.Requests/Directory.Build.props
+++ b/src/libraries/System.Net.Requests/Directory.Build.props
@@ -3,6 +3,6 @@
Microsoft
true
- browser
+ browser;wasi
\ No newline at end of file
diff --git a/src/libraries/System.Net.Security/Directory.Build.props b/src/libraries/System.Net.Security/Directory.Build.props
index ce244cbea56199..58979d42f06955 100644
--- a/src/libraries/System.Net.Security/Directory.Build.props
+++ b/src/libraries/System.Net.Security/Directory.Build.props
@@ -3,6 +3,6 @@
Microsoft
true
- browser
+ browser;wasi
\ No newline at end of file
diff --git a/src/libraries/System.Net.Sockets/Directory.Build.props b/src/libraries/System.Net.Sockets/Directory.Build.props
index ce244cbea56199..bc799605d32edf 100644
--- a/src/libraries/System.Net.Sockets/Directory.Build.props
+++ b/src/libraries/System.Net.Sockets/Directory.Build.props
@@ -3,6 +3,7 @@
Microsoft
true
- browser
+
+ browser;wasi
\ No newline at end of file
diff --git a/src/libraries/System.Net.WebClient/Directory.Build.props b/src/libraries/System.Net.WebClient/Directory.Build.props
index c843a6347ce61c..3a3d8f9832479f 100644
--- a/src/libraries/System.Net.WebClient/Directory.Build.props
+++ b/src/libraries/System.Net.WebClient/Directory.Build.props
@@ -2,6 +2,6 @@
true
- browser
+ browser;wasi
\ No newline at end of file
diff --git a/src/libraries/System.Net.WebProxy/src/System.Net.WebProxy.csproj b/src/libraries/System.Net.WebProxy/src/System.Net.WebProxy.csproj
index ef670932cb9143..f23c6072c4df7a 100644
--- a/src/libraries/System.Net.WebProxy/src/System.Net.WebProxy.csproj
+++ b/src/libraries/System.Net.WebProxy/src/System.Net.WebProxy.csproj
@@ -1,7 +1,7 @@
- $(NetCoreAppCurrent);$(NetCoreAppCurrent)-browser
+ $(NetCoreAppCurrent);$(NetCoreAppCurrent)-browser;$(NetCoreAppCurrent)-wasi
true
false
@@ -10,8 +10,8 @@
-
-
+
+
diff --git a/src/libraries/System.Net.WebProxy/src/System/Net/WebProxy.NonBrowser.cs b/src/libraries/System.Net.WebProxy/src/System/Net/WebProxy.NonWasm.cs
similarity index 100%
rename from src/libraries/System.Net.WebProxy/src/System/Net/WebProxy.NonBrowser.cs
rename to src/libraries/System.Net.WebProxy/src/System/Net/WebProxy.NonWasm.cs
diff --git a/src/libraries/System.Net.WebProxy/src/System/Net/WebProxy.Browser.cs b/src/libraries/System.Net.WebProxy/src/System/Net/WebProxy.Wasm.cs
similarity index 100%
rename from src/libraries/System.Net.WebProxy/src/System/Net/WebProxy.Browser.cs
rename to src/libraries/System.Net.WebProxy/src/System/Net/WebProxy.Wasm.cs
diff --git a/src/libraries/System.Net.WebSockets.Client/src/System.Net.WebSockets.Client.csproj b/src/libraries/System.Net.WebSockets.Client/src/System.Net.WebSockets.Client.csproj
index 8265edd7e9369a..3b68c3da977eb6 100644
--- a/src/libraries/System.Net.WebSockets.Client/src/System.Net.WebSockets.Client.csproj
+++ b/src/libraries/System.Net.WebSockets.Client/src/System.Net.WebSockets.Client.csproj
@@ -4,6 +4,8 @@
$(NetCoreAppCurrent);$(NetCoreAppCurrent)-browser
True
false
+
+ wasi
diff --git a/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeFileHandle.Unix.cs b/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeFileHandle.Unix.cs
index 4029e70cef29e8..476af77370bd66 100644
--- a/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeFileHandle.Unix.cs
+++ b/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeFileHandle.Unix.cs
@@ -34,7 +34,7 @@ public sealed partial class SafeFileHandle : SafeHandleZeroOrMinusOneIsInvalid
UnixFileMode.OtherRead |
UnixFileMode.OtherWrite;
- internal static bool DisableFileLocking { get; } = OperatingSystem.IsBrowser() // #40065: Emscripten does not support file locking
+ internal static bool DisableFileLocking { get; } = OperatingSystem.IsBrowser() || OperatingSystem.IsWasi()// #40065: Emscripten does not support file locking
|| AppContextConfigHelper.GetBooleanConfig("System.IO.DisableFileLocking", "DOTNET_SYSTEM_IO_DISABLEFILELOCKING", defaultValue: false);
// not using bool? as it's not thread safe
diff --git a/src/libraries/System.Private.CoreLib/src/System/Globalization/GlobalizationMode.Unix.cs b/src/libraries/System.Private.CoreLib/src/System/Globalization/GlobalizationMode.Unix.cs
index df937e56e34fee..edc529fba01dda 100644
--- a/src/libraries/System.Private.CoreLib/src/System/Globalization/GlobalizationMode.Unix.cs
+++ b/src/libraries/System.Private.CoreLib/src/System/Globalization/GlobalizationMode.Unix.cs
@@ -38,7 +38,7 @@ static Settings()
private static string GetIcuLoadFailureMessage()
{
// These strings can't go into resources, because a resource lookup requires globalization, which requires ICU
- if (OperatingSystem.IsBrowser() || OperatingSystem.IsAndroid() ||
+ if (OperatingSystem.IsBrowser() || OperatingSystem.IsWasi() || OperatingSystem.IsAndroid() ||
OperatingSystem.IsIOS() || OperatingSystem.IsTvOS() || OperatingSystem.IsWatchOS())
{
return "Unable to load required ICU Globalization data. Please see https://aka.ms/dotnet-missing-libicu for more information";
diff --git a/src/libraries/System.Private.CoreLib/src/System/Globalization/Normalization.Icu.cs b/src/libraries/System.Private.CoreLib/src/System/Globalization/Normalization.Icu.cs
index 20ef88d4401901..6ef9df95aa79d4 100644
--- a/src/libraries/System.Private.CoreLib/src/System/Globalization/Normalization.Icu.cs
+++ b/src/libraries/System.Private.CoreLib/src/System/Globalization/Normalization.Icu.cs
@@ -118,7 +118,7 @@ private static void ValidateArguments(string strInput, NormalizationForm normali
{
Debug.Assert(strInput != null);
- if (OperatingSystem.IsBrowser() && (normalizationForm == NormalizationForm.FormKC || normalizationForm == NormalizationForm.FormKD))
+ if ((OperatingSystem.IsBrowser() || OperatingSystem.IsWasi())&& (normalizationForm == NormalizationForm.FormKC || normalizationForm == NormalizationForm.FormKD))
{
// Browser's ICU doesn't contain data needed for FormKC and FormKD
throw new PlatformNotSupportedException();
diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/ManualResetEventSlim.cs b/src/libraries/System.Private.CoreLib/src/System/Threading/ManualResetEventSlim.cs
index 37f8c06af04565..a9b8c10c03318d 100644
--- a/src/libraries/System.Private.CoreLib/src/System/Threading/ManualResetEventSlim.cs
+++ b/src/libraries/System.Private.CoreLib/src/System/Threading/ManualResetEventSlim.cs
@@ -350,6 +350,9 @@ public void Reset()
#endif
public void Wait()
{
+#if TARGET_WASI
+ if (OperatingSystem.IsWasi()) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
+#endif
Wait(Timeout.Infinite, CancellationToken.None);
}
diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/RegisteredWaitHandle.Portable.cs b/src/libraries/System.Private.CoreLib/src/System/Threading/RegisteredWaitHandle.Portable.cs
index 2fb8d1fb3f63ca..74dbefe5869067 100644
--- a/src/libraries/System.Private.CoreLib/src/System/Threading/RegisteredWaitHandle.Portable.cs
+++ b/src/libraries/System.Private.CoreLib/src/System/Threading/RegisteredWaitHandle.Portable.cs
@@ -55,6 +55,9 @@ public sealed partial class RegisteredWaitHandle : MarshalByRefObject
internal RegisteredWaitHandle(WaitHandle waitHandle, _ThreadPoolWaitOrTimerCallback callbackHelper,
int millisecondsTimeout, bool repeating)
{
+#if TARGET_WASI
+ if (OperatingSystem.IsWasi()) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
+#endif
#if WINDOWS
Debug.Assert(!ThreadPool.UseWindowsThreadPool);
#endif
diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/SemaphoreSlim.cs b/src/libraries/System.Private.CoreLib/src/System/Threading/SemaphoreSlim.cs
index 5340ecaeccc50a..bab6bbd332b19a 100644
--- a/src/libraries/System.Private.CoreLib/src/System/Threading/SemaphoreSlim.cs
+++ b/src/libraries/System.Private.CoreLib/src/System/Threading/SemaphoreSlim.cs
@@ -174,6 +174,9 @@ public SemaphoreSlim(int initialCount, int maxCount)
[UnsupportedOSPlatform("browser")]
public void Wait()
{
+#if TARGET_WASI
+ if (OperatingSystem.IsWasi()) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
+#endif
// Call wait with infinite timeout
Wait(Timeout.Infinite, CancellationToken.None);
}
@@ -191,6 +194,9 @@ public void Wait()
[UnsupportedOSPlatform("browser")]
public void Wait(CancellationToken cancellationToken)
{
+#if TARGET_WASI
+ if (OperatingSystem.IsWasi()) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
+#endif
// Call wait with infinite timeout
Wait(Timeout.Infinite, cancellationToken);
}
@@ -210,6 +216,9 @@ public void Wait(CancellationToken cancellationToken)
[UnsupportedOSPlatform("browser")]
public bool Wait(TimeSpan timeout)
{
+#if TARGET_WASI
+ if (OperatingSystem.IsWasi()) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
+#endif
// Validate the timeout
long totalMilliseconds = (long)timeout.TotalMilliseconds;
if (totalMilliseconds < -1 || totalMilliseconds > int.MaxValue)
@@ -241,6 +250,9 @@ public bool Wait(TimeSpan timeout)
[UnsupportedOSPlatform("browser")]
public bool Wait(TimeSpan timeout, CancellationToken cancellationToken)
{
+#if TARGET_WASI
+ if (OperatingSystem.IsWasi()) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
+#endif
// Validate the timeout
long totalMilliseconds = (long)timeout.TotalMilliseconds;
if (totalMilliseconds < -1 || totalMilliseconds > int.MaxValue)
@@ -266,6 +278,9 @@ public bool Wait(TimeSpan timeout, CancellationToken cancellationToken)
[UnsupportedOSPlatform("browser")]
public bool Wait(int millisecondsTimeout)
{
+#if TARGET_WASI
+ if (OperatingSystem.IsWasi()) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
+#endif
return Wait(millisecondsTimeout, CancellationToken.None);
}
@@ -284,6 +299,9 @@ public bool Wait(int millisecondsTimeout)
[UnsupportedOSPlatform("browser")]
public bool Wait(int millisecondsTimeout, CancellationToken cancellationToken)
{
+#if TARGET_WASI
+ if (OperatingSystem.IsWasi()) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
+#endif
CheckDispose();
#if FEATURE_WASM_MANAGED_THREADS
Thread.AssureBlockingPossible();
@@ -433,6 +451,9 @@ public bool Wait(int millisecondsTimeout, CancellationToken cancellationToken)
[UnsupportedOSPlatform("browser")]
private bool WaitUntilCountOrTimeout(int millisecondsTimeout, uint startTime, CancellationToken cancellationToken)
{
+#if TARGET_WASI
+ if (OperatingSystem.IsWasi()) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
+#endif
int remainingWaitMilliseconds = Timeout.Infinite;
// Wait on the monitor as long as the count is zero
diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs b/src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs
index 0febf7376f39f9..a6acc125c038b5 100644
--- a/src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs
+++ b/src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs
@@ -2967,6 +2967,9 @@ internal bool InternalWait(int millisecondsTimeout, CancellationToken cancellati
// to be able to see the method on the stack and inspect arguments).
private bool InternalWaitCore(int millisecondsTimeout, CancellationToken cancellationToken)
{
+#if TARGET_WASI
+ if (OperatingSystem.IsWasi()) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
+#endif
// If the task has already completed, there's nothing to wait for.
bool returnValue = IsCompleted;
if (returnValue)
@@ -4682,6 +4685,9 @@ internal void RemoveContinuation(object continuationObject) // could be TaskCont
[MethodImpl(MethodImplOptions.NoOptimization)] // this is needed for the parallel debugger
public static void WaitAll(params Task[] tasks)
{
+#if TARGET_WASI
+ if (OperatingSystem.IsWasi()) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
+#endif
if (tasks is null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.tasks);
@@ -4707,6 +4713,9 @@ public static void WaitAll(params Task[] tasks)
[UnsupportedOSPlatform("browser")]
public static void WaitAll(params ReadOnlySpan tasks)
{
+#if TARGET_WASI
+ if (OperatingSystem.IsWasi()) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
+#endif
bool waitResult = WaitAllCore(tasks, Timeout.Infinite, default);
Debug.Assert(waitResult, "expected wait to succeed");
}
@@ -4744,6 +4753,9 @@ public static void WaitAll(params ReadOnlySpan tasks)
[MethodImpl(MethodImplOptions.NoOptimization)] // this is needed for the parallel debugger
public static bool WaitAll(Task[] tasks, TimeSpan timeout)
{
+#if TARGET_WASI
+ if (OperatingSystem.IsWasi()) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
+#endif
long totalMilliseconds = (long)timeout.TotalMilliseconds;
if (totalMilliseconds is < -1 or > int.MaxValue)
{
@@ -4788,6 +4800,9 @@ public static bool WaitAll(Task[] tasks, TimeSpan timeout)
[MethodImpl(MethodImplOptions.NoOptimization)] // this is needed for the parallel debugger
public static bool WaitAll(Task[] tasks, int millisecondsTimeout)
{
+#if TARGET_WASI
+ if (OperatingSystem.IsWasi()) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
+#endif
if (tasks is null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.tasks);
@@ -4822,6 +4837,9 @@ public static bool WaitAll(Task[] tasks, int millisecondsTimeout)
[MethodImpl(MethodImplOptions.NoOptimization)] // this is needed for the parallel debugger
public static void WaitAll(Task[] tasks, CancellationToken cancellationToken)
{
+#if TARGET_WASI
+ if (OperatingSystem.IsWasi()) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
+#endif
if (tasks is null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.tasks);
@@ -4868,6 +4886,9 @@ public static void WaitAll(Task[] tasks, CancellationToken cancellationToken)
[MethodImpl(MethodImplOptions.NoOptimization)] // this is needed for the parallel debugger
public static bool WaitAll(Task[] tasks, int millisecondsTimeout, CancellationToken cancellationToken)
{
+#if TARGET_WASI
+ if (OperatingSystem.IsWasi()) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
+#endif
if (tasks is null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.tasks);
@@ -4890,6 +4911,9 @@ public static bool WaitAll(Task[] tasks, int millisecondsTimeout, CancellationTo
[UnsupportedOSPlatform("browser")]
public static void WaitAll(IEnumerable tasks, CancellationToken cancellationToken = default)
{
+#if TARGET_WASI
+ if (OperatingSystem.IsWasi()) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
+#endif
if (tasks is null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.tasks);
@@ -4908,6 +4932,9 @@ public static void WaitAll(IEnumerable tasks, CancellationToken cancellati
[UnsupportedOSPlatform("browser")]
private static bool WaitAllCore(ReadOnlySpan tasks, int millisecondsTimeout, CancellationToken cancellationToken)
{
+#if TARGET_WASI
+ if (OperatingSystem.IsWasi()) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
+#endif
if (millisecondsTimeout < -1)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.millisecondsTimeout);
@@ -5038,6 +5065,9 @@ private static void AddToList(T item, ref List? list, int initSize)
[UnsupportedOSPlatform("browser")]
private static bool WaitAllBlockingCore(List tasks, int millisecondsTimeout, CancellationToken cancellationToken)
{
+#if TARGET_WASI
+ if (OperatingSystem.IsWasi()) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
+#endif
Debug.Assert(tasks != null, "Expected a non-null list of tasks");
Debug.Assert(tasks.Count > 0, "Expected at least one task");
diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/TaskAsyncEnumerableExtensions.ToBlockingEnumerable.cs b/src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/TaskAsyncEnumerableExtensions.ToBlockingEnumerable.cs
index 4c165a913929a2..2b66d88540b1b6 100644
--- a/src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/TaskAsyncEnumerableExtensions.ToBlockingEnumerable.cs
+++ b/src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/TaskAsyncEnumerableExtensions.ToBlockingEnumerable.cs
@@ -26,6 +26,9 @@ public static partial class TaskAsyncEnumerableExtensions
[UnsupportedOSPlatform("browser")]
public static IEnumerable ToBlockingEnumerable(this IAsyncEnumerable source, CancellationToken cancellationToken = default)
{
+#if TARGET_WASI
+ if (OperatingSystem.IsWasi()) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
+#endif
IAsyncEnumerator enumerator = source.GetAsyncEnumerator(cancellationToken);
// A ManualResetEventSlim variant that lets us reuse the same
// awaiter callback allocation across the entire enumeration.
@@ -79,6 +82,9 @@ public ManualResetEventWithAwaiterSupport()
[UnsupportedOSPlatform("browser")]
public void Wait(TAwaiter awaiter) where TAwaiter : ICriticalNotifyCompletion
{
+#if TARGET_WASI
+ if (OperatingSystem.IsWasi()) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
+#endif
awaiter.UnsafeOnCompleted(_onCompleted);
Wait();
Reset();
diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/Thread.cs b/src/libraries/System.Private.CoreLib/src/System/Threading/Thread.cs
index 7af434b641a34c..ed4aaf75758075 100644
--- a/src/libraries/System.Private.CoreLib/src/System/Threading/Thread.cs
+++ b/src/libraries/System.Private.CoreLib/src/System/Threading/Thread.cs
@@ -149,15 +149,21 @@ public Thread(ParameterizedThreadStart start, int maxStackSize)
}
#if (!TARGET_BROWSER && !TARGET_WASI) || FEATURE_WASM_MANAGED_THREADS
+ [UnsupportedOSPlatformGuard("wasi")]
[UnsupportedOSPlatformGuard("browser")]
+ [UnsupportedOSPlatformGuard("wasi")]
internal static bool IsThreadStartSupported => true;
internal static bool IsInternalThreadStartSupported => true;
#elif FEATURE_WASM_PERFTRACING
+ [UnsupportedOSPlatformGuard("wasi")]
[UnsupportedOSPlatformGuard("browser")]
+ [UnsupportedOSPlatformGuard("wasi")]
internal static bool IsThreadStartSupported => false;
internal static bool IsInternalThreadStartSupported => true;
#else
+ [UnsupportedOSPlatformGuard("wasi")]
[UnsupportedOSPlatformGuard("browser")]
+ [UnsupportedOSPlatformGuard("wasi")]
internal static bool IsThreadStartSupported => false;
internal static bool IsInternalThreadStartSupported => false;
#endif
@@ -197,6 +203,9 @@ internal static void ThrowIfNoThreadStart(bool internalThread = false)
private void Start(object? parameter, bool captureContext, bool internalThread = false)
{
+#if TARGET_WASI
+ if (OperatingSystem.IsWasi()) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
+#endif
ThrowIfNoThreadStart(internalThread);
StartHelper? startHelper = _startHelper;
diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/ThreadPoolWorkQueue.cs b/src/libraries/System.Private.CoreLib/src/System/Threading/ThreadPoolWorkQueue.cs
index 89dac7492578fd..279932486e58a6 100644
--- a/src/libraries/System.Private.CoreLib/src/System/Threading/ThreadPoolWorkQueue.cs
+++ b/src/libraries/System.Private.CoreLib/src/System/Threading/ThreadPoolWorkQueue.cs
@@ -1624,6 +1624,9 @@ public static RegisteredWaitHandle RegisterWaitForSingleObject(
bool executeOnlyOnce // NOTE: we do not allow other options that allow the callback to be queued as an APC
)
{
+#if TARGET_WASI
+ if (OperatingSystem.IsWasi()) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
+#endif
if (millisecondsTimeOutInterval > (uint)int.MaxValue && millisecondsTimeOutInterval != uint.MaxValue)
throw new ArgumentOutOfRangeException(nameof(millisecondsTimeOutInterval), SR.ArgumentOutOfRange_LessEqualToIntegerMaxVal);
return RegisterWaitForSingleObject(waitObject, callBack, state, millisecondsTimeOutInterval, executeOnlyOnce, true);
@@ -1641,6 +1644,9 @@ public static RegisteredWaitHandle UnsafeRegisterWaitForSingleObject(
bool executeOnlyOnce // NOTE: we do not allow other options that allow the callback to be queued as an APC
)
{
+#if TARGET_WASI
+ if (OperatingSystem.IsWasi()) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
+#endif
if (millisecondsTimeOutInterval > (uint)int.MaxValue && millisecondsTimeOutInterval != uint.MaxValue)
throw new ArgumentOutOfRangeException(nameof(millisecondsTimeOutInterval), SR.ArgumentOutOfRange_NeedNonNegOrNegative1);
return RegisterWaitForSingleObject(waitObject, callBack, state, millisecondsTimeOutInterval, executeOnlyOnce, false);
@@ -1672,6 +1678,9 @@ public static RegisteredWaitHandle UnsafeRegisterWaitForSingleObject(
bool executeOnlyOnce // NOTE: we do not allow other options that allow the callback to be queued as an APC
)
{
+#if TARGET_WASI
+ if (OperatingSystem.IsWasi()) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
+#endif
ArgumentOutOfRangeException.ThrowIfLessThan(millisecondsTimeOutInterval, -1);
return RegisterWaitForSingleObject(waitObject, callBack, state, (uint)millisecondsTimeOutInterval, executeOnlyOnce, false);
}
@@ -1687,6 +1696,9 @@ public static RegisteredWaitHandle RegisterWaitForSingleObject(
bool executeOnlyOnce // NOTE: we do not allow other options that allow the callback to be queued as an APC
)
{
+#if TARGET_WASI
+ if (OperatingSystem.IsWasi()) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
+#endif
ArgumentOutOfRangeException.ThrowIfLessThan(millisecondsTimeOutInterval, -1);
ArgumentOutOfRangeException.ThrowIfGreaterThan(millisecondsTimeOutInterval, int.MaxValue);
return RegisterWaitForSingleObject(waitObject, callBack, state, (uint)millisecondsTimeOutInterval, executeOnlyOnce, true);
@@ -1703,6 +1715,9 @@ public static RegisteredWaitHandle UnsafeRegisterWaitForSingleObject(
bool executeOnlyOnce // NOTE: we do not allow other options that allow the callback to be queued as an APC
)
{
+#if TARGET_WASI
+ if (OperatingSystem.IsWasi()) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
+#endif
ArgumentOutOfRangeException.ThrowIfLessThan(millisecondsTimeOutInterval, -1);
ArgumentOutOfRangeException.ThrowIfGreaterThan(millisecondsTimeOutInterval, int.MaxValue);
return RegisterWaitForSingleObject(waitObject, callBack, state, (uint)millisecondsTimeOutInterval, executeOnlyOnce, false);
@@ -1719,6 +1734,9 @@ public static RegisteredWaitHandle RegisterWaitForSingleObject(
bool executeOnlyOnce
)
{
+#if TARGET_WASI
+ if (OperatingSystem.IsWasi()) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
+#endif
long tm = (long)timeout.TotalMilliseconds;
ArgumentOutOfRangeException.ThrowIfLessThan(tm, -1, nameof(timeout));
@@ -1738,6 +1756,9 @@ public static RegisteredWaitHandle UnsafeRegisterWaitForSingleObject(
bool executeOnlyOnce
)
{
+#if TARGET_WASI
+ if (OperatingSystem.IsWasi()) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
+#endif
long tm = (long)timeout.TotalMilliseconds;
ArgumentOutOfRangeException.ThrowIfLessThan(tm, -1, nameof(timeout));
diff --git a/src/libraries/System.Runtime.Caching/Directory.Build.props b/src/libraries/System.Runtime.Caching/Directory.Build.props
index d68d22c1b917f8..0232329ad312aa 100644
--- a/src/libraries/System.Runtime.Caching/Directory.Build.props
+++ b/src/libraries/System.Runtime.Caching/Directory.Build.props
@@ -3,5 +3,7 @@
Microsoft
true
+
+ wasi
\ No newline at end of file
diff --git a/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/HostFileChangeMonitor.cs b/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/HostFileChangeMonitor.cs
index 374ff288ea0bbe..c14de7b5d2cad1 100644
--- a/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/HostFileChangeMonitor.cs
+++ b/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/HostFileChangeMonitor.cs
@@ -99,7 +99,7 @@ private static void InitFCN()
if (fcn == null)
{
#if NET
- if (OperatingSystem.IsBrowser() || (OperatingSystem.IsIOS() && !OperatingSystem.IsMacCatalyst()) || OperatingSystem.IsTvOS())
+ if (OperatingSystem.IsBrowser() || OperatingSystem.IsWasi() || (OperatingSystem.IsIOS() && !OperatingSystem.IsMacCatalyst()) || OperatingSystem.IsTvOS())
{
throw new PlatformNotSupportedException();
}
diff --git a/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/MemoryCache.cs b/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/MemoryCache.cs
index aed16512d0da72..5ec63c2f65e07b 100644
--- a/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/MemoryCache.cs
+++ b/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/MemoryCache.cs
@@ -39,8 +39,9 @@ public class MemoryCache : ObjectCache, IEnumerable, IDisposable
private bool _useMemoryCacheManager = true;
private bool _throwOnDisposed;
#if NET
+ [UnsupportedOSPlatformGuard("wasi")]
[UnsupportedOSPlatformGuard("browser")]
- private static bool _countersSupported => !OperatingSystem.IsBrowser();
+ private static bool _countersSupported => !OperatingSystem.IsBrowser() && !OperatingSystem.IsWasi();
#else
private static bool _countersSupported => true;
#endif
diff --git a/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/MemoryCacheStatistics.cs b/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/MemoryCacheStatistics.cs
index dba747c4acdfe5..634270e09a9daa 100644
--- a/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/MemoryCacheStatistics.cs
+++ b/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/MemoryCacheStatistics.cs
@@ -38,8 +38,9 @@ internal sealed class MemoryCacheStatistics : IDisposable
private readonly MemoryCache _memoryCache;
private readonly PhysicalMemoryMonitor _physicalMemoryMonitor;
#if NET
+ [UnsupportedOSPlatformGuard("wasi")]
[UnsupportedOSPlatformGuard("browser")]
- private static bool _configSupported => !OperatingSystem.IsBrowser();
+ private static bool _configSupported => !OperatingSystem.IsBrowser() && !OperatingSystem.IsWasi();
#else
private static bool _configSupported => true;
#endif
diff --git a/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/MemoryCacheStore.cs b/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/MemoryCacheStore.cs
index 146935b54bafa0..24a9821a75c88e 100644
--- a/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/MemoryCacheStore.cs
+++ b/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/MemoryCacheStore.cs
@@ -27,8 +27,9 @@ internal sealed class MemoryCacheStore : IDisposable
private readonly MemoryCache _cache;
private readonly Counters _perfCounters;
#if NET
+ [UnsupportedOSPlatformGuard("wasi")]
[UnsupportedOSPlatformGuard("browser")]
- private static bool _countersSupported => !OperatingSystem.IsBrowser();
+ private static bool _countersSupported => !OperatingSystem.IsBrowser() && !OperatingSystem.IsWasi();
#else
private static bool _countersSupported => true;
#endif
diff --git a/src/libraries/System.Runtime.Serialization.Schema/Directory.Build.props b/src/libraries/System.Runtime.Serialization.Schema/Directory.Build.props
index e7d357018da7bf..7d407028f6632b 100644
--- a/src/libraries/System.Runtime.Serialization.Schema/Directory.Build.props
+++ b/src/libraries/System.Runtime.Serialization.Schema/Directory.Build.props
@@ -4,6 +4,6 @@
Microsoft
true
- browser;ios;tvos;maccatalyst
+ browser;wasi;ios;tvos;maccatalyst
diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Extensions.Tests/System/EnvironmentTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Extensions.Tests/System/EnvironmentTests.cs
index 7965f9598bfd33..6d8e5372051759 100644
--- a/src/libraries/System.Runtime/tests/System.Runtime.Extensions.Tests/System/EnvironmentTests.cs
+++ b/src/libraries/System.Runtime/tests/System.Runtime.Extensions.Tests/System/EnvironmentTests.cs
@@ -139,7 +139,7 @@ public void OSVersion_Idempotent()
public void OSVersion_MatchesPlatform()
{
PlatformID id = Environment.OSVersion.Platform;
- PlatformID expected = OperatingSystem.IsWindows() ? PlatformID.Win32NT : OperatingSystem.IsBrowser() ? PlatformID.Other : PlatformID.Unix;
+ PlatformID expected = OperatingSystem.IsWindows() ? PlatformID.Win32NT : (OperatingSystem.IsBrowser() || OperatingSystem.IsWasi()) ? PlatformID.Other : PlatformID.Unix;
Assert.Equal(expected, id);
}
@@ -154,7 +154,7 @@ public void OSVersion_ValidVersion()
Assert.Contains(version.ToString(2), versionString);
- string expectedOS = OperatingSystem.IsWindows() ? "Windows " : OperatingSystem.IsBrowser() ? "Other " : "Unix ";
+ string expectedOS = OperatingSystem.IsWindows() ? "Windows " : (OperatingSystem.IsBrowser() || OperatingSystem.IsWasi()) ? "Other " : "Unix ";
Assert.Contains(expectedOS, versionString);
}
diff --git a/src/libraries/System.Security.Cryptography.Cose/Directory.Build.props b/src/libraries/System.Security.Cryptography.Cose/Directory.Build.props
index c4db04cc6c252f..d13e60dc1f0132 100644
--- a/src/libraries/System.Security.Cryptography.Cose/Directory.Build.props
+++ b/src/libraries/System.Security.Cryptography.Cose/Directory.Build.props
@@ -2,6 +2,6 @@
true
- browser
+ browser;wasi
diff --git a/src/libraries/System.Security.Cryptography.Pkcs/Directory.Build.props b/src/libraries/System.Security.Cryptography.Pkcs/Directory.Build.props
index 1f799d605feb93..e3cd1bcddea8ee 100644
--- a/src/libraries/System.Security.Cryptography.Pkcs/Directory.Build.props
+++ b/src/libraries/System.Security.Cryptography.Pkcs/Directory.Build.props
@@ -3,6 +3,6 @@
Microsoft
true
- browser
+ browser;wasi
diff --git a/src/libraries/System.Security.Cryptography.Xml/Directory.Build.props b/src/libraries/System.Security.Cryptography.Xml/Directory.Build.props
index c843a6347ce61c..3a3d8f9832479f 100644
--- a/src/libraries/System.Security.Cryptography.Xml/Directory.Build.props
+++ b/src/libraries/System.Security.Cryptography.Xml/Directory.Build.props
@@ -2,6 +2,6 @@
true
- browser
+ browser;wasi
\ No newline at end of file
diff --git a/src/libraries/System.Text.Encodings.Web/src/System.Text.Encodings.Web.csproj b/src/libraries/System.Text.Encodings.Web/src/System.Text.Encodings.Web.csproj
index 4f10f6e625453d..2fba3b5e13bd6f 100644
--- a/src/libraries/System.Text.Encodings.Web/src/System.Text.Encodings.Web.csproj
+++ b/src/libraries/System.Text.Encodings.Web/src/System.Text.Encodings.Web.csproj
@@ -1,7 +1,7 @@
- $(NetCoreAppCurrent)-browser;$(NetCoreAppCurrent);$(NetCoreAppMinimum)-browser;$(NetCoreAppMinimum);netstandard2.0;$(NetFrameworkMinimum)
+ $(NetCoreAppCurrent)-browser;$(NetCoreAppCurrent)-wasi;$(NetCoreAppCurrent);$(NetCoreAppMinimum)-browser;$(NetCoreAppMinimum);netstandard2.0;$(NetFrameworkMinimum)
$(TargetFrameworks);$(NetCoreAppPrevious)-windows;$(NetCoreAppPrevious)
true
diff --git a/src/libraries/System.Threading.Tasks.Parallel/src/System/Threading/Tasks/Parallel.cs b/src/libraries/System.Threading.Tasks.Parallel/src/System/Threading/Tasks/Parallel.cs
index 7a466d0501c2a0..eadc4bc1ba659f 100644
--- a/src/libraries/System.Threading.Tasks.Parallel/src/System/Threading/Tasks/Parallel.cs
+++ b/src/libraries/System.Threading.Tasks.Parallel/src/System/Threading/Tasks/Parallel.cs
@@ -240,7 +240,7 @@ public static void Invoke(ParallelOptions parallelOptions, params Action[] actio
#if !FEATURE_WASM_MANAGED_THREADS
// Web browsers need special treatment that is implemented in TaskReplicator
- if (OperatingSystem.IsBrowser() ||
+ if (OperatingSystem.IsBrowser() || OperatingSystem.IsWasi() ||
#else
if (
#endif
diff --git a/src/libraries/System.Threading.Tasks.Parallel/src/System/Threading/Tasks/TaskReplicator.cs b/src/libraries/System.Threading.Tasks.Parallel/src/System/Threading/Tasks/TaskReplicator.cs
index 0239770284e4ac..5090a6bd17dbc4 100644
--- a/src/libraries/System.Threading.Tasks.Parallel/src/System/Threading/Tasks/TaskReplicator.cs
+++ b/src/libraries/System.Threading.Tasks.Parallel/src/System/Threading/Tasks/TaskReplicator.cs
@@ -132,7 +132,7 @@ public static void Run(ReplicatableUserAction action, ParallelOp
// Browser hosts do not support synchronous Wait so we want to run the
// replicated task directly instead of going through Task infrastructure
#if !FEATURE_WASM_MANAGED_THREADS
- if (OperatingSystem.IsBrowser())
+ if (OperatingSystem.IsBrowser() || OperatingSystem.IsWasi() )
{
// Since we are running on a single thread, we don't want the action to time out
long timeout = long.MaxValue - 1;
diff --git a/src/mono/nuget/mono-packages.proj b/src/mono/nuget/mono-packages.proj
index 4e119edcafa1d7..9c8dbbf3d74486 100644
--- a/src/mono/nuget/mono-packages.proj
+++ b/src/mono/nuget/mono-packages.proj
@@ -17,6 +17,8 @@
+
+
diff --git a/src/mono/wasi/runtime/main.c b/src/mono/wasi/runtime/main.c
index 10f87320e9a0b8..c81e1a798288bc 100644
--- a/src/mono/wasi/runtime/main.c
+++ b/src/mono/wasi/runtime/main.c
@@ -113,6 +113,7 @@ int main(int argc, char * argv[]) {
}
ret = ret < 0 ? -ret : ret;
+ // until WASI can work with unix exit code https://github.com/WebAssembly/wasi-cli/pull/44
char* dotnet_wasi_print_exit_code = monoeg_g_getenv ("DOTNET_WASI_PRINT_EXIT_CODE");
if (ret != 0 && dotnet_wasi_print_exit_code && strcmp(dotnet_wasi_print_exit_code, "1") == 0)
{
diff --git a/src/mono/wasm/host/wasi/WasiEngineArguments.cs b/src/mono/wasm/host/wasi/WasiEngineArguments.cs
index 64276047091847..a0d4de4a4ee5bf 100644
--- a/src/mono/wasm/host/wasi/WasiEngineArguments.cs
+++ b/src/mono/wasm/host/wasi/WasiEngineArguments.cs
@@ -30,6 +30,7 @@ public WasiEngineArguments(CommonConfiguration commonConfig)
private OptionSet GetOptions() => new OptionSet
{
+ // until WASI can work with unix exit code https://github.com/WebAssembly/wasi-cli/pull/44
{ "forward-exit-code", "Forward process exit code via stderr", v => ForwardExitCode = true }
};
diff --git a/src/tests/Common/CoreCLRTestLibrary/OutOfProcessTest.cs b/src/tests/Common/CoreCLRTestLibrary/OutOfProcessTest.cs
index 66937878587ddd..2084bd02d96607 100644
--- a/src/tests/Common/CoreCLRTestLibrary/OutOfProcessTest.cs
+++ b/src/tests/Common/CoreCLRTestLibrary/OutOfProcessTest.cs
@@ -47,7 +47,7 @@ static OutOfProcessTest()
&& !OperatingSystem.IsTvOS()
&& !OperatingSystem.IsAndroid()
&& !OperatingSystem.IsBrowser()
- && !OperatingSystem.IsOSPlatform("Wasi");
+ && !OperatingSystem.IsWasi();
public static void RunOutOfProcessTest(string assemblyPath, string testPathPrefix)
{
diff --git a/src/tests/Common/XHarnessRunnerLibrary/RunnerEntryPoint.cs b/src/tests/Common/XHarnessRunnerLibrary/RunnerEntryPoint.cs
index 1c229b18540dbd..03e8a6b35fcd6c 100644
--- a/src/tests/Common/XHarnessRunnerLibrary/RunnerEntryPoint.cs
+++ b/src/tests/Common/XHarnessRunnerLibrary/RunnerEntryPoint.cs
@@ -32,7 +32,7 @@ public static async Task RunTests(
{
entryPoint = new AppleEntryPoint(new SimpleDevice(assemblyName), runTestsCallback, assemblyName, filter, testExclusionTable);
}
- if (OperatingSystem.IsBrowser())
+ if (OperatingSystem.IsBrowser() || OperatingSystem.IsWasi() )
{
entryPoint = new WasmEntryPoint(runTestsCallback, assemblyName, filter, testExclusionTable);
}
@@ -45,7 +45,7 @@ public static async Task RunTests(
entryPoint.TestsCompleted += (o, e) => anyFailedTests = e.FailedTests > 0;
await entryPoint.RunAsync();
- if (OperatingSystem.IsBrowser())
+ if (OperatingSystem.IsBrowser() || OperatingSystem.IsWasi() )
{
// Browser expects all xharness processes to exit with 0, even in case of failure
return 0;
diff --git a/src/tests/Common/XUnitWrapperGenerator/ITestInfo.cs b/src/tests/Common/XUnitWrapperGenerator/ITestInfo.cs
index c39a28e9c03f12..2f1237dc44403d 100644
--- a/src/tests/Common/XUnitWrapperGenerator/ITestInfo.cs
+++ b/src/tests/Common/XUnitWrapperGenerator/ITestInfo.cs
@@ -248,6 +248,10 @@ private static string GetPlatformConditionFromTestPlatform(Xunit.TestPlatforms p
{
platformCheckConditions.Add("global::System.OperatingSystem.IsBrowser()");
}
+ if (platform.HasFlag(Xunit.TestPlatforms.Wasi))
+ {
+ platformCheckConditions.Add("global::System.OperatingSystem.IsWasi()");
+ }
if (platform.HasFlag(Xunit.TestPlatforms.FreeBSD))
{
platformCheckConditions.Add(@"global::System.OperatingSystem.IsFreeBSD()");
diff --git a/src/tests/tracing/eventpipe/common/IpcTraceTest.cs b/src/tests/tracing/eventpipe/common/IpcTraceTest.cs
index 3f107c511d891d..ce058328d0e592 100644
--- a/src/tests/tracing/eventpipe/common/IpcTraceTest.cs
+++ b/src/tests/tracing/eventpipe/common/IpcTraceTest.cs
@@ -344,7 +344,7 @@ private int Validate(bool enableRundownProvider = true)
// the process that created them, so we don't need to check on that platform.
static public bool EnsureCleanEnvironment()
{
- if (!OperatingSystem.IsWindows() && !OperatingSystem.IsBrowser() && !OperatingSystem.IsIOS() && !OperatingSystem.IsTvOS())
+ if (!OperatingSystem.IsWindows() && !OperatingSystem.IsBrowser() && !OperatingSystem.IsWasi() && !OperatingSystem.IsIOS() && !OperatingSystem.IsTvOS())
{
Func<(IEnumerable>, List)> getPidsAndSockets = () =>
{