diff --git a/Directory.Build.props b/Directory.Build.props index 3b052e4db1be7..ff902e73dcd26 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -36,6 +36,7 @@ s390x ppc64le wasm + wasm x64 x64 $(TargetArchitecture) @@ -118,6 +119,8 @@ $([MSBuild]::NormalizePath('$(TestExclusionListTasksDir)', 'TestExclusionListTasks.dll')) $([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'coreclr', '$(TargetOS).$(TargetArchitecture).$(Configuration)')) $(CoreCLRToolPath) + + $([MSBuild]::NormalizeDirectory($(ArtifactsBinDir), 'wasmtime')) diff --git a/eng/build.ps1 b/eng/build.ps1 index 9382d460248af..e3e009d12da47 100644 --- a/eng/build.ps1 +++ b/eng/build.ps1 @@ -241,6 +241,10 @@ if ($PSBoundParameters.ContainsKey('os') -and $PSBoundParameters['os'] -eq "Brow # make sure it is capitalized $PSBoundParameters['os'] = "Browser" } +if ($PSBoundParameters.ContainsKey('os') -and $PSBoundParameters['os'] -eq "wasi") { + # make sure it is not capitalized + $PSBoundParameters['os'] = "wasi" +} foreach ($argument in $PSBoundParameters.Keys) { diff --git a/eng/native/configurecompiler.cmake b/eng/native/configurecompiler.cmake index 2357455f9db67..507ff9e0ded20 100644 --- a/eng/native/configurecompiler.cmake +++ b/eng/native/configurecompiler.cmake @@ -169,7 +169,7 @@ elseif (CLR_CMAKE_HOST_UNIX) endif () endif(UPPERCASE_CMAKE_BUILD_TYPE STREQUAL DEBUG OR UPPERCASE_CMAKE_BUILD_TYPE STREQUAL CHECKED) - if(CLR_CMAKE_HOST_BROWSER) + if(CLR_CMAKE_HOST_BROWSER OR CLR_CMAKE_HOST_WASI) # The emscripten build has additional warnings so -Werror breaks add_compile_options(-Wno-unused-parameter) add_compile_options(-Wno-alloca) @@ -391,7 +391,7 @@ if (CLR_CMAKE_HOST_UNIX) add_definitions(-DLSE_INSTRUCTIONS_ENABLED_BY_DEFAULT) add_compile_options(-mcpu=apple-m1) endif(CLR_CMAKE_HOST_UNIX_ARM64) - elseif(NOT CLR_CMAKE_HOST_BROWSER) + elseif(NOT CLR_CMAKE_HOST_BROWSER AND NOT CLR_CMAKE_HOST_WASI) check_c_compiler_flag(-fstack-protector-strong COMPILER_SUPPORTS_F_STACK_PROTECTOR_STRONG) if (COMPILER_SUPPORTS_F_STACK_PROTECTOR_STRONG) add_compile_options(-fstack-protector-strong) @@ -793,7 +793,7 @@ if (CLR_CMAKE_HOST_WIN32) message(FATAL_ERROR "MC not found") endif() -elseif (NOT CLR_CMAKE_HOST_BROWSER) +elseif (NOT CLR_CMAKE_HOST_BROWSER AND NOT CLR_CMAKE_HOST_WASI) # This is a workaround for upstream issue: https://gitlab.kitware.com/cmake/cmake/-/issues/22995. # # In Clang.cmake, the decision to use single or double hyphen for target and gcc-toolchain diff --git a/eng/native/configureplatform.cmake b/eng/native/configureplatform.cmake index c849c592174af..b064079402eb4 100644 --- a/eng/native/configureplatform.cmake +++ b/eng/native/configureplatform.cmake @@ -214,9 +214,9 @@ if(CLR_CMAKE_HOST_OS STREQUAL Emscripten) set(CLR_CMAKE_HOST_BROWSER 1) endif(CLR_CMAKE_HOST_OS STREQUAL Emscripten) -if(CLR_CMAKE_TARGET_OS STREQUAL Wasi) +if(CLR_CMAKE_TARGET_OS STREQUAL WASI) set(CLR_CMAKE_HOST_WASI 1) -endif(CLR_CMAKE_TARGET_OS STREQUAL Wasi) +endif(CLR_CMAKE_TARGET_OS STREQUAL WASI) #-------------------------------------------- # This repo builds two set of binaries @@ -417,9 +417,9 @@ if(CLR_CMAKE_TARGET_OS STREQUAL Emscripten) set(CLR_CMAKE_TARGET_BROWSER 1) endif(CLR_CMAKE_TARGET_OS STREQUAL Emscripten) -if(CLR_CMAKE_TARGET_OS STREQUAL Wasi) +if(CLR_CMAKE_TARGET_OS STREQUAL WASI) set(CLR_CMAKE_TARGET_WASI 1) -endif(CLR_CMAKE_TARGET_OS STREQUAL Wasi) +endif(CLR_CMAKE_TARGET_OS STREQUAL WASI) if(CLR_CMAKE_TARGET_UNIX) if(CLR_CMAKE_TARGET_ARCH STREQUAL x64) @@ -454,7 +454,7 @@ else() endif(CLR_CMAKE_TARGET_UNIX) # check if host & target os/arch combination are valid -if (NOT (CLR_CMAKE_TARGET_OS STREQUAL CLR_CMAKE_HOST_OS)) +if (NOT (CLR_CMAKE_TARGET_OS STREQUAL CLR_CMAKE_HOST_OS) AND NOT CLR_CMAKE_TARGET_WASI) if(NOT (CLR_CMAKE_HOST_OS STREQUAL windows)) message(FATAL_ERROR "Invalid host and target os/arch combination. Host OS: ${CLR_CMAKE_HOST_OS}") endif() @@ -466,7 +466,7 @@ if (NOT (CLR_CMAKE_TARGET_OS STREQUAL CLR_CMAKE_HOST_OS)) endif() endif() -if(NOT CLR_CMAKE_TARGET_BROWSER) +if(NOT CLR_CMAKE_TARGET_BROWSER AND NOT CLR_CMAKE_TARGET_WASI) # The default linker on Solaris also does not support PIE. if(NOT CLR_CMAKE_TARGET_ANDROID AND NOT CLR_CMAKE_TARGET_SUNOS AND NOT CLR_CMAKE_TARGET_OSX AND NOT CLR_CMAKE_TARGET_MACCATALYST AND NOT CLR_CMAKE_HOST_TVOS AND NOT CLR_CMAKE_HOST_IOS AND NOT MSVC) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie") diff --git a/eng/native/configuretools.cmake b/eng/native/configuretools.cmake index 07a3bbfafe4dd..1f800b0f89789 100644 --- a/eng/native/configuretools.cmake +++ b/eng/native/configuretools.cmake @@ -6,7 +6,7 @@ if (CMAKE_C_COMPILER MATCHES "-?[0-9]+(\.[0-9]+)?$") set(CLR_CMAKE_COMPILER_FILE_NAME_VERSION "${CMAKE_MATCH_0}") endif() -if(NOT WIN32 AND NOT CLR_CMAKE_TARGET_BROWSER) +if(NOT WIN32 AND NOT CLR_CMAKE_TARGET_BROWSER AND NOT CLR_CMAKE_TARGET_WASI) if(CMAKE_C_COMPILER_ID MATCHES "Clang") if(APPLE) set(TOOLSET_PREFIX "") diff --git a/eng/native/gen-buildsys.cmd b/eng/native/gen-buildsys.cmd index b97b8125e0f8c..ed87ef0ad52ee 100644 --- a/eng/native/gen-buildsys.cmd +++ b/eng/native/gen-buildsys.cmd @@ -48,12 +48,12 @@ if /i "%__Arch%" == "wasm" ( ) if /i "%__Os%" == "Browser" ( if "%EMSDK_PATH%" == "" ( - if not exist "%__repoRoot%src\mono\wasm\emsdk" ( + if not exist "%__repoRoot%\src\mono\wasm\emsdk" ( echo Error: Should set EMSDK_PATH environment variable pointing to emsdk root. exit /B 1 ) - set EMSDK_PATH=%__repoRoot%src\mono\wasm\emsdk + set EMSDK_PATH=%__repoRoot%\src\mono\wasm\emsdk set EMSDK_PATH=!EMSDK_PATH:\=/! ) @@ -61,8 +61,17 @@ if /i "%__Arch%" == "wasm" ( set __UseEmcmake=1 ) if /i "%__Os%" == "wasi" ( - echo Error: WASI build not implemented on Windows yet - exit /B 1 + if "%WASI_SDK_PATH%" == "" ( + if not exist "%__repoRoot%\src\mono\wasi\wasi-sdk" ( + echo Error: Should set WASI_SDK_PATH environment variable pointing to emsdk root. + exit /B 1 + ) + + set WASI_SDK_PATH=%__repoRoot%src\mono\wasi\wasi-sdk + set WASI_SDK_PATH=!WASI_SDK_PATH:\=/! + ) + set __CmakeGenerator=Ninja + set __ExtraCmakeParams=%__ExtraCmakeParams% -DCLR_CMAKE_TARGET_OS=WASI -DCLR_CMAKE_TARGET_ARCH=wasm "-DWASI_SDK_PREFIX=!WASI_SDK_PATH!" "-DCMAKE_TOOLCHAIN_FILE=!WASI_SDK_PATH!/share/cmake/wasi-sdk.cmake" "-DCMAKE_SYSROOT=!WASI_SDK_PATH!/share/wasi-sysroot" ) ) else ( set __ExtraCmakeParams=%__ExtraCmakeParams% "-DCMAKE_SYSTEM_VERSION=10.0" diff --git a/eng/pipelines/common/platform-matrix.yml b/eng/pipelines/common/platform-matrix.yml index bafab38c125d6..5bd0c98d18c35 100644 --- a/eng/pipelines/common/platform-matrix.yml +++ b/eng/pipelines/common/platform-matrix.yml @@ -374,6 +374,27 @@ jobs: crossBuild: true ${{ insert }}: ${{ parameters.jobParameters }} +# WASI WebAssembly + +- ${{ if containsValue(parameters.platforms, 'wasi_wasm') }}: + - template: xplat-setup.yml + parameters: + jobTemplate: ${{ parameters.jobTemplate }} + helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} + variables: ${{ parameters.variables }} + osGroup: wasi + archType: wasm + targetRid: wasi-wasm + platform: wasi_wasm + shouldContinueOnError: ${{ parameters.shouldContinueOnError }} + container: Browser_wasm + jobParameters: + hostedOs: Linux + runtimeFlavor: ${{ parameters.runtimeFlavor }} + stagedBuild: ${{ parameters.stagedBuild }} + buildConfig: ${{ parameters.buildConfig }} + ${{ insert }}: ${{ parameters.jobParameters }} + # Browser WebAssembly - ${{ if containsValue(parameters.platforms, 'Browser_wasm') }}: diff --git a/eng/pipelines/common/templates/wasi-build-only.yml b/eng/pipelines/common/templates/wasi-build-only.yml new file mode 100644 index 0000000000000..e161b02b1270c --- /dev/null +++ b/eng/pipelines/common/templates/wasi-build-only.yml @@ -0,0 +1,49 @@ +parameters: + alwaysRun: false + extraBuildArgs: '' + isExtraPlatformsBuild: false + nameSuffix: '' + platforms: [] + +jobs: + +# +# Build for WASI/wasm and test it +# +- template: /eng/pipelines/common/platform-matrix.yml + parameters: + jobTemplate: /eng/pipelines/common/global-build-job.yml + helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml + buildConfig: Release + runtimeFlavor: mono + platforms: ${{ parameters.platforms }} + variables: + # map dependencies variables to local variables + - name: alwaysRunVar + value: ${{ parameters.alwaysRun }} + - name: shouldRunOnDefaultPipelines + value: $[ + or( + eq(variables['wasmDarcDependenciesChanged'], true), + eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true), + and( + eq(dependencies.evaluate_paths.outputs['SetPathVars_wasm.containsChange'], true), + eq(dependencies.evaluate_paths.outputs['SetPathVars_non_runtimetests.containsChange'], true)), + eq(dependencies.evaluate_paths.outputs['SetPathVars_wasm_libraries.containsChange'], true), + eq(dependencies.evaluate_paths.outputs['SetPathVars_mono_excluding_wasm.containsChange'], true)) + ] + jobParameters: + isExtraPlatforms: ${{ parameters.isExtraPlatformsBuild }} + testGroup: innerloop + nameSuffix: ${{ parameters.nameSuffix }}_BuildOnly + buildArgs: -s mono+libs+host -c $(_BuildConfig) /p:ArchiveTests=true ${{ parameters.extraBuildArgs }} + timeoutInMinutes: 240 + # if !alwaysRun, then: + # if this is runtime-wasm (isWasmOnlyBuild): + # - then run only if it would not have run on default pipelines (based + # on path changes) + # - else run based on path changes + condition: >- + or( + eq(variables['alwaysRunVar'], true), + eq(variables['isDefaultPipeline'], variables['shouldRunOnDefaultPipelines'])) diff --git a/eng/pipelines/common/templates/wasm-library-tests.yml b/eng/pipelines/common/templates/wasm-library-tests.yml index caf4a09b31eb1..a05ca0bf16681 100644 --- a/eng/pipelines/common/templates/wasm-library-tests.yml +++ b/eng/pipelines/common/templates/wasm-library-tests.yml @@ -70,18 +70,3 @@ jobs: or( eq(variables['alwaysRunVar'], true), eq(variables['isDefaultPipeline'], variables['shouldRunOnDefaultPipelines'])) - # extra steps, run tests - extraStepsTemplate: /eng/pipelines/common/templates/additional-steps-then-helix.yml - extraStepsParameters: - additionalSteps: - - ${{ if eq(parameters.buildAndRunWasi, true) }}: - - script: >- - make -C src/mono/wasi provision-deps all && - make -C src/mono/wasi/sample/console run - name: build_wasi - displayName: Build WASI, and run a sample - - creator: dotnet-bot - testRunNamePrefixSuffix: Mono_$(_BuildConfig) - extraHelixArguments: /p:BrowserHost=$(_hostedOs) $(_wasmRunSmokeTestsOnlyArg) ${{ parameters.extraHelixArgs }} - scenarios: ${{ parameters.scenarios }} diff --git a/eng/targetingpacks.targets b/eng/targetingpacks.targets index 744a0cd20b469..e7386ccb5e8d4 100644 --- a/eng/targetingpacks.targets +++ b/eng/targetingpacks.targets @@ -41,7 +41,7 @@ RuntimeFrameworkName="$(LocalFrameworkOverrideName)" LatestRuntimeFrameworkVersion="$(ProductVersion)" RuntimePackNamePatterns="$(LocalFrameworkOverrideName).Runtime.Mono.**RID**" - RuntimePackRuntimeIdentifiers="linux-arm;linux-armv6;linux-arm64;linux-musl-arm64;linux-bionic-arm64;linux-loongarch64;linux-musl-x64;linux-bionic-x64;linux-x64;osx-x64;rhel.6-x64;win-arm;win-arm64;win-x64;win-x86;linux-musl-arm;osx-arm64;maccatalyst-x64;maccatalyst-arm64;browser-wasm;ios-arm64;ios-arm;iossimulator-arm64;iossimulator-x64;iossimulator-x86;tvos-arm64;tvossimulator-arm64;tvossimulator-x64;android-arm64;android-arm;android-x64;android-x86" + RuntimePackRuntimeIdentifiers="linux-arm;linux-armv6;linux-arm64;linux-musl-arm64;linux-bionic-arm64;linux-loongarch64;linux-musl-x64;linux-bionic-x64;linux-x64;osx-x64;rhel.6-x64;win-arm;win-arm64;win-x64;win-x86;linux-musl-arm;osx-arm64;maccatalyst-x64;maccatalyst-arm64;browser-wasm;wasi-wasm;ios-arm64;ios-arm;iossimulator-arm64;iossimulator-x64;iossimulator-x86;tvos-arm64;tvossimulator-arm64;tvossimulator-x64;android-arm64;android-arm;android-x64;android-x86" RuntimePackLabels="Mono" Condition="'@(KnownRuntimePack)' == '' or !@(KnownRuntimePack->AnyHaveMetadataValue('TargetFramework', '$(NetCoreAppCurrent)'))"/> + + diff --git a/eng/versioning.targets b/eng/versioning.targets index d519199013599..b4f6471c93f95 100644 --- a/eng/versioning.targets +++ b/eng/versioning.targets @@ -65,6 +65,9 @@ true + + true + @@ -78,6 +81,9 @@ + + + diff --git a/src/coreclr/System.Private.CoreLib/src/System/Threading/Monitor.CoreCLR.cs b/src/coreclr/System.Private.CoreLib/src/System/Threading/Monitor.CoreCLR.cs index c3257f9fc10df..56dca6c0d9ec4 100644 --- a/src/coreclr/System.Private.CoreLib/src/System/Threading/Monitor.CoreCLR.cs +++ b/src/coreclr/System.Private.CoreLib/src/System/Threading/Monitor.CoreCLR.cs @@ -147,7 +147,7 @@ public static bool IsEntered(object obj) [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool ObjWait(int millisecondsTimeout, object obj); - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public static bool Wait(object obj, int millisecondsTimeout) { if (obj == null) diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Threading/Monitor.NativeAot.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Threading/Monitor.NativeAot.cs index f5317ff6d22ed..75b1f7102c307 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Threading/Monitor.NativeAot.cs +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Threading/Monitor.NativeAot.cs @@ -126,7 +126,7 @@ public static bool IsEntered(object obj) #region Public Wait/Pulse methods - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public static bool Wait(object obj, int millisecondsTimeout) { Condition condition = GetCondition(obj); diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Threading/ThreadPool.Windows.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Threading/ThreadPool.Windows.cs index 97217e7c615ef..f3a789cbaa276 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Threading/ThreadPool.Windows.cs +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Threading/ThreadPool.Windows.cs @@ -14,7 +14,7 @@ namespace System.Threading // Windows-specific implementation of ThreadPool // #if !FEATURE_WASM_THREADS - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] #endif public sealed class RegisteredWaitHandle : MarshalByRefObject { diff --git a/src/coreclr/pal/src/config.h.in b/src/coreclr/pal/src/config.h.in index 75507804d23a0..5a48d405330de 100644 --- a/src/coreclr/pal/src/config.h.in +++ b/src/coreclr/pal/src/config.h.in @@ -63,6 +63,9 @@ #cmakedefine01 HAS_SYSV_SEMAPHORES #cmakedefine01 HAS_PTHREAD_MUTEXES #cmakedefine HAVE_TTRACE +#cmakedefine01 HAVE_CHMOD +#cmakedefine01 HAVE_FCHMOD +#cmakedefine01 HAVE_PIPE #cmakedefine01 HAVE_PIPE2 #cmakedefine01 HAVE_SCHED_GETAFFINITY #cmakedefine01 HAVE_SCHED_SETAFFINITY diff --git a/src/coreclr/pal/src/configure.cmake b/src/coreclr/pal/src/configure.cmake index 4f900a5555ef6..399174a876412 100644 --- a/src/coreclr/pal/src/configure.cmake +++ b/src/coreclr/pal/src/configure.cmake @@ -135,6 +135,9 @@ check_function_exists(semget HAS_SYSV_SEMAPHORES) check_function_exists(pthread_mutex_init HAS_PTHREAD_MUTEXES) check_function_exists(ttrace HAVE_TTRACE) check_function_exists(pipe2 HAVE_PIPE2) +check_function_exists(pipe HAVE_PIPE) +check_function_exists(chmod HAVE_CHMOD) +check_function_exists(fchmod HAVE_FCHMOD) check_cxx_source_compiles(" #include diff --git a/src/libraries/Common/src/System/Security/Cryptography/DSAOpenSsl.cs b/src/libraries/Common/src/System/Security/Cryptography/DSAOpenSsl.cs index d10cc1ea870cc..203a91cdccfb7 100644 --- a/src/libraries/Common/src/System/Security/Cryptography/DSAOpenSsl.cs +++ b/src/libraries/Common/src/System/Security/Cryptography/DSAOpenSsl.cs @@ -25,7 +25,7 @@ public sealed partial class DSAOpenSsl : DSA, IRuntimeAlgorithm private Lazy? _key; [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] [UnsupportedOSPlatform("windows")] @@ -35,7 +35,7 @@ public DSAOpenSsl() } [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] [UnsupportedOSPlatform("windows")] diff --git a/src/libraries/Common/src/System/Security/Cryptography/ECDiffieHellmanOpenSsl.cs b/src/libraries/Common/src/System/Security/Cryptography/ECDiffieHellmanOpenSsl.cs index 2f962e19fc3ef..4a49794c7d1e4 100644 --- a/src/libraries/Common/src/System/Security/Cryptography/ECDiffieHellmanOpenSsl.cs +++ b/src/libraries/Common/src/System/Security/Cryptography/ECDiffieHellmanOpenSsl.cs @@ -12,7 +12,7 @@ public sealed partial class ECDiffieHellmanOpenSsl : ECDiffieHellman private ECOpenSsl? _key; [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] [UnsupportedOSPlatform("windows")] @@ -24,7 +24,7 @@ public ECDiffieHellmanOpenSsl(ECCurve curve) } [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] [UnsupportedOSPlatform("windows")] @@ -34,7 +34,7 @@ public ECDiffieHellmanOpenSsl() } [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] [UnsupportedOSPlatform("windows")] diff --git a/src/libraries/Common/src/System/Security/Cryptography/ECDsaOpenSsl.cs b/src/libraries/Common/src/System/Security/Cryptography/ECDsaOpenSsl.cs index 242711f8e5cf4..5e33c7fb33627 100644 --- a/src/libraries/Common/src/System/Security/Cryptography/ECDsaOpenSsl.cs +++ b/src/libraries/Common/src/System/Security/Cryptography/ECDsaOpenSsl.cs @@ -23,7 +23,7 @@ public sealed partial class ECDsaOpenSsl : ECDsa, IRuntimeAlgorithm /// The representing the curve. /// if is null. [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] [UnsupportedOSPlatform("windows")] @@ -38,7 +38,7 @@ public ECDsaOpenSsl(ECCurve curve) /// Create an ECDsaOpenSsl algorithm with a random 521 bit key pair. /// [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] [UnsupportedOSPlatform("windows")] @@ -52,7 +52,7 @@ public ECDsaOpenSsl() /// /// Size of the key to generate, in bits. [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] [UnsupportedOSPlatform("windows")] diff --git a/src/libraries/Common/src/System/Security/Cryptography/Helpers.cs b/src/libraries/Common/src/System/Security/Cryptography/Helpers.cs index b1dc4d1de9a04..8c5382aa882d1 100644 --- a/src/libraries/Common/src/System/Security/Cryptography/Helpers.cs +++ b/src/libraries/Common/src/System/Security/Cryptography/Helpers.cs @@ -10,10 +10,10 @@ namespace Internal.Cryptography { internal static partial class Helpers { - [UnsupportedOSPlatformGuard("browser")] + [UnsupportedOSPlatformGuard("browser"), UnsupportedOSPlatformGuard("wasi")] internal static bool HasSymmetricEncryption { get; } = #if NETCOREAPP - !OperatingSystem.IsBrowser(); + !OperatingSystem.IsBrowser() && !OperatingSystem.IsOSPlatform("Wasi"); #else true; #endif @@ -28,16 +28,16 @@ internal static partial class Helpers #if NETCOREAPP [UnsupportedOSPlatformGuard("android")] - [UnsupportedOSPlatformGuard("browser")] - public static bool IsRC2Supported => !OperatingSystem.IsAndroid() && !OperatingSystem.IsBrowser(); + [UnsupportedOSPlatformGuard("browser"), UnsupportedOSPlatformGuard("wasi")] + public static bool IsRC2Supported => !OperatingSystem.IsAndroid() && !OperatingSystem.IsBrowser() && !OperatingSystem.IsOSPlatform("Wasi"); #else public static bool IsRC2Supported => true; #endif - [UnsupportedOSPlatformGuard("browser")] + [UnsupportedOSPlatformGuard("browser"), UnsupportedOSPlatformGuard("wasi")] internal static bool HasMD5 { get; } = #if NETCOREAPP - !OperatingSystem.IsBrowser(); + !OperatingSystem.IsBrowser() && !OperatingSystem.IsOSPlatform("Wasi"); #else true; #endif diff --git a/src/libraries/Common/src/System/Security/Cryptography/RSAOpenSsl.cs b/src/libraries/Common/src/System/Security/Cryptography/RSAOpenSsl.cs index db6046ec7830b..6f606c747a212 100644 --- a/src/libraries/Common/src/System/Security/Cryptography/RSAOpenSsl.cs +++ b/src/libraries/Common/src/System/Security/Cryptography/RSAOpenSsl.cs @@ -20,7 +20,7 @@ public sealed partial class RSAOpenSsl : RSA, IRuntimeAlgorithm private Lazy? _key; [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] [UnsupportedOSPlatform("windows")] @@ -30,7 +30,7 @@ public RSAOpenSsl() } [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] [UnsupportedOSPlatform("windows")] diff --git a/src/libraries/Common/tests/System/IO/ReparsePointUtilities.cs b/src/libraries/Common/tests/System/IO/ReparsePointUtilities.cs index 205e045617d91..063abfe273c76 100644 --- a/src/libraries/Common/tests/System/IO/ReparsePointUtilities.cs +++ b/src/libraries/Common/tests/System/IO/ReparsePointUtilities.cs @@ -76,7 +76,7 @@ public static bool CreateSymbolicLink(string linkPath, string targetPath, bool i #if NETFRAMEWORK bool isWindows = true; #else - if (OperatingSystem.IsIOS() || OperatingSystem.IsTvOS() || OperatingSystem.IsMacCatalyst() || OperatingSystem.IsBrowser()) // OSes that don't support Process.Start() + if (OperatingSystem.IsIOS() || OperatingSystem.IsTvOS() || OperatingSystem.IsMacCatalyst() || OperatingSystem.IsBrowser() || OperatingSystem.IsOSPlatform("Wasi")) // OSes that don't support Process.Start() { return false; } diff --git a/src/libraries/Directory.Build.props b/src/libraries/Directory.Build.props index b46ee2f5249a9..466743c96cce1 100644 --- a/src/libraries/Directory.Build.props +++ b/src/libraries/Directory.Build.props @@ -133,6 +133,11 @@ --interpreter + + $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) + false + $(NoWarn);CA1416 + $(ArtifactsBinDir)dotnet-none\ diff --git a/src/libraries/Microsoft.Extensions.Configuration.Xml/ref/Microsoft.Extensions.Configuration.Xml.cs b/src/libraries/Microsoft.Extensions.Configuration.Xml/ref/Microsoft.Extensions.Configuration.Xml.cs index 84d26a3faf4ea..6c711c597e6a4 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Xml/ref/Microsoft.Extensions.Configuration.Xml.cs +++ b/src/libraries/Microsoft.Extensions.Configuration.Xml/ref/Microsoft.Extensions.Configuration.Xml.cs @@ -33,7 +33,7 @@ public partial class XmlDocumentDecryptor public static readonly Microsoft.Extensions.Configuration.Xml.XmlDocumentDecryptor Instance; protected XmlDocumentDecryptor() { } public System.Xml.XmlReader CreateDecryptingXmlReader(System.IO.Stream input, System.Xml.XmlReaderSettings? settings) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatform("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatform("browser"), System.Runtime.Versioning.UnsupportedOSPlatform("wasi")] protected virtual System.Xml.XmlReader DecryptDocumentAndCreateXmlReader(System.Xml.XmlDocument document) { throw null; } } public partial class XmlStreamConfigurationProvider : Microsoft.Extensions.Configuration.StreamConfigurationProvider diff --git a/src/libraries/Microsoft.Extensions.Configuration.Xml/src/XmlDocumentDecryptor.cs b/src/libraries/Microsoft.Extensions.Configuration.Xml/src/XmlDocumentDecryptor.cs index 2fe2ce2df91a0..d6dd81db711d3 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Xml/src/XmlDocumentDecryptor.cs +++ b/src/libraries/Microsoft.Extensions.Configuration.Xml/src/XmlDocumentDecryptor.cs @@ -91,7 +91,7 @@ public XmlReader CreateDecryptingXmlReader(Stream input, XmlReaderSettings? sett /// /// The document. /// An XmlReader which can read the document. - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] protected virtual XmlReader DecryptDocumentAndCreateXmlReader(XmlDocument document) { // Perform the actual decryption step, updating the XmlDocument in-place. diff --git a/src/libraries/Microsoft.Extensions.FileProviders.Physical/src/PhysicalFileProvider.cs b/src/libraries/Microsoft.Extensions.FileProviders.Physical/src/PhysicalFileProvider.cs index fb2306d56e9f9..0499f4fdb1e90 100644 --- a/src/libraries/Microsoft.Extensions.FileProviders.Physical/src/PhysicalFileProvider.cs +++ b/src/libraries/Microsoft.Extensions.FileProviders.Physical/src/PhysicalFileProvider.cs @@ -164,7 +164,7 @@ internal PhysicalFilesWatcher CreateFileWatcher() FileSystemWatcher? watcher; #if NETCOREAPP // For browser/iOS/tvOS we will proactively fallback to polling since FileSystemWatcher is not supported. - if (OperatingSystem.IsBrowser() || (OperatingSystem.IsIOS() && !OperatingSystem.IsMacCatalyst()) || OperatingSystem.IsTvOS()) + if (OperatingSystem.IsBrowser() || OperatingSystem.IsOSPlatform("Wasi") || (OperatingSystem.IsIOS() && !OperatingSystem.IsMacCatalyst()) || OperatingSystem.IsTvOS()) { UsePollingFileWatcher = true; UseActivePolling = true; diff --git a/src/libraries/Microsoft.Extensions.FileProviders.Physical/src/PhysicalFilesWatcher.cs b/src/libraries/Microsoft.Extensions.FileProviders.Physical/src/PhysicalFilesWatcher.cs index f5b5b4520bec7..5c8f67fa2b515 100644 --- a/src/libraries/Microsoft.Extensions.FileProviders.Physical/src/PhysicalFilesWatcher.cs +++ b/src/libraries/Microsoft.Extensions.FileProviders.Physical/src/PhysicalFilesWatcher.cs @@ -89,7 +89,7 @@ public PhysicalFilesWatcher( if (fileSystemWatcher != null) { #if NETCOREAPP - if (OperatingSystem.IsBrowser() || (OperatingSystem.IsIOS() && !OperatingSystem.IsMacCatalyst()) || OperatingSystem.IsTvOS()) + if (OperatingSystem.IsBrowser() || OperatingSystem.IsOSPlatform("Wasi") || (OperatingSystem.IsIOS() && !OperatingSystem.IsMacCatalyst()) || OperatingSystem.IsTvOS()) { throw new PlatformNotSupportedException(SR.Format(SR.FileSystemWatcher_PlatformNotSupported, typeof(FileSystemWatcher))); } @@ -271,7 +271,7 @@ protected virtual void Dispose(bool disposing) } } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] [SupportedOSPlatform("maccatalyst")] @@ -307,7 +307,7 @@ ex is DirectoryNotFoundException || } } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] [SupportedOSPlatform("maccatalyst")] @@ -316,7 +316,7 @@ private void OnChanged(object sender, FileSystemEventArgs e) OnFileSystemEntryChange(e.FullPath); } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] [SupportedOSPlatform("maccatalyst")] @@ -329,7 +329,7 @@ private void OnError(object sender, ErrorEventArgs e) } } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] [SupportedOSPlatform("maccatalyst")] @@ -355,7 +355,7 @@ ex is SecurityException || } } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] [SupportedOSPlatform("maccatalyst")] @@ -395,7 +395,7 @@ private void ReportChangeForMatchedEntries(string path) } } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] [SupportedOSPlatform("maccatalyst")] @@ -416,7 +416,7 @@ private void TryDisableFileSystemWatcher() } } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] [SupportedOSPlatform("maccatalyst")] diff --git a/src/libraries/Microsoft.Extensions.Hosting.Systemd/ref/Microsoft.Extensions.Hosting.Systemd.cs b/src/libraries/Microsoft.Extensions.Hosting.Systemd/ref/Microsoft.Extensions.Hosting.Systemd.cs index 7d1462aba0005..b559143e7a3d6 100644 --- a/src/libraries/Microsoft.Extensions.Hosting.Systemd/ref/Microsoft.Extensions.Hosting.Systemd.cs +++ b/src/libraries/Microsoft.Extensions.Hosting.Systemd/ref/Microsoft.Extensions.Hosting.Systemd.cs @@ -33,7 +33,7 @@ public static partial class SystemdHelpers public static bool IsSystemdService() { throw null; } } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("maccatalyst")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] @@ -44,7 +44,7 @@ public void Dispose() { } public System.Threading.Tasks.Task StopAsync(System.Threading.CancellationToken cancellationToken) { throw null; } public System.Threading.Tasks.Task WaitForStartAsync(System.Threading.CancellationToken cancellationToken) { throw null; } } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public partial class SystemdNotifier : Microsoft.Extensions.Hosting.Systemd.ISystemdNotifier { public SystemdNotifier() { } diff --git a/src/libraries/Microsoft.Extensions.Hosting.Systemd/src/SystemdLifetime.cs b/src/libraries/Microsoft.Extensions.Hosting.Systemd/src/SystemdLifetime.cs index e1b196fb2a6f5..e631e4afb9c91 100644 --- a/src/libraries/Microsoft.Extensions.Hosting.Systemd/src/SystemdLifetime.cs +++ b/src/libraries/Microsoft.Extensions.Hosting.Systemd/src/SystemdLifetime.cs @@ -13,7 +13,7 @@ namespace Microsoft.Extensions.Hosting.Systemd /// Provides notification messages for application started and stopping, and configures console logging to the systemd format. /// [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("maccatalyst")] [UnsupportedOSPlatform("tvos")] diff --git a/src/libraries/Microsoft.Extensions.Hosting.Systemd/src/SystemdNotifier.cs b/src/libraries/Microsoft.Extensions.Hosting.Systemd/src/SystemdNotifier.cs index bfde5fe73df6a..946f58706e1c1 100644 --- a/src/libraries/Microsoft.Extensions.Hosting.Systemd/src/SystemdNotifier.cs +++ b/src/libraries/Microsoft.Extensions.Hosting.Systemd/src/SystemdNotifier.cs @@ -7,7 +7,7 @@ namespace Microsoft.Extensions.Hosting.Systemd { - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public class SystemdNotifier : ISystemdNotifier { private const string NOTIFY_SOCKET = "NOTIFY_SOCKET"; diff --git a/src/libraries/Microsoft.Extensions.Hosting/ref/Microsoft.Extensions.Hosting.cs b/src/libraries/Microsoft.Extensions.Hosting/ref/Microsoft.Extensions.Hosting.cs index 7910670857169..c51fad8533127 100644 --- a/src/libraries/Microsoft.Extensions.Hosting/ref/Microsoft.Extensions.Hosting.cs +++ b/src/libraries/Microsoft.Extensions.Hosting/ref/Microsoft.Extensions.Hosting.cs @@ -84,22 +84,22 @@ public static partial class HostingHostBuilderExtensions public static Microsoft.Extensions.Hosting.IHostBuilder ConfigureLogging(this Microsoft.Extensions.Hosting.IHostBuilder hostBuilder, System.Action configureLogging) { throw null; } public static Microsoft.Extensions.Hosting.IHostBuilder ConfigureServices(this Microsoft.Extensions.Hosting.IHostBuilder hostBuilder, System.Action configureDelegate) { throw null; } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public static System.Threading.Tasks.Task RunConsoleAsync(this Microsoft.Extensions.Hosting.IHostBuilder hostBuilder, System.Action configureOptions, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public static System.Threading.Tasks.Task RunConsoleAsync(this Microsoft.Extensions.Hosting.IHostBuilder hostBuilder, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public static Microsoft.Extensions.Hosting.IHostBuilder UseConsoleLifetime(this Microsoft.Extensions.Hosting.IHostBuilder hostBuilder) { throw null; } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public static Microsoft.Extensions.Hosting.IHostBuilder UseConsoleLifetime(this Microsoft.Extensions.Hosting.IHostBuilder hostBuilder, System.Action configureOptions) { throw null; } @@ -130,7 +130,7 @@ public void NotifyStopped() { } public void StopApplication() { } } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public partial class ConsoleLifetime : Microsoft.Extensions.Hosting.IHostLifetime, System.IDisposable diff --git a/src/libraries/Microsoft.Extensions.Hosting/src/HostBuilder.netcoreapp.cs b/src/libraries/Microsoft.Extensions.Hosting/src/HostBuilder.netcoreapp.cs index 1407f690de359..d2e975156f1cc 100644 --- a/src/libraries/Microsoft.Extensions.Hosting/src/HostBuilder.netcoreapp.cs +++ b/src/libraries/Microsoft.Extensions.Hosting/src/HostBuilder.netcoreapp.cs @@ -11,7 +11,7 @@ public partial class HostBuilder { private static void AddLifetime(IServiceCollection services) { - if (!OperatingSystem.IsAndroid() && !OperatingSystem.IsBrowser() && !OperatingSystem.IsIOS() && !OperatingSystem.IsTvOS()) + if (!OperatingSystem.IsAndroid() && !OperatingSystem.IsBrowser() && !OperatingSystem.IsOSPlatform("Wasi") && !OperatingSystem.IsIOS() && !OperatingSystem.IsTvOS()) { services.AddSingleton(); } diff --git a/src/libraries/Microsoft.Extensions.Hosting/src/HostingHostBuilderExtensions.cs b/src/libraries/Microsoft.Extensions.Hosting/src/HostingHostBuilderExtensions.cs index ad09104a153ce..a489bceb13042 100644 --- a/src/libraries/Microsoft.Extensions.Hosting/src/HostingHostBuilderExtensions.cs +++ b/src/libraries/Microsoft.Extensions.Hosting/src/HostingHostBuilderExtensions.cs @@ -280,7 +280,7 @@ internal static void AddDefaultServices(HostBuilderContext hostingContext, IServ logging.AddConfiguration(hostingContext.Configuration.GetSection("Logging")); #if NETCOREAPP - if (!OperatingSystem.IsBrowser()) + if (!OperatingSystem.IsBrowser() && !OperatingSystem.IsOSPlatform("Wasi")) #endif { logging.AddConsole(); @@ -321,7 +321,7 @@ internal static ServiceProviderOptions CreateDefaultServiceProviderOptions(HostB /// The to configure. /// The same instance of the for chaining. [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] public static IHostBuilder UseConsoleLifetime(this IHostBuilder hostBuilder) @@ -337,7 +337,7 @@ public static IHostBuilder UseConsoleLifetime(this IHostBuilder hostBuilder) /// The delegate for configuring the . /// The same instance of the for chaining. [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] public static IHostBuilder UseConsoleLifetime(this IHostBuilder hostBuilder, Action configureOptions) @@ -356,7 +356,7 @@ public static IHostBuilder UseConsoleLifetime(this IHostBuilder hostBuilder, Act /// A that can be used to cancel the console. /// A that only completes when the token is triggered or shutdown is triggered. [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] public static Task RunConsoleAsync(this IHostBuilder hostBuilder, CancellationToken cancellationToken = default) @@ -372,7 +372,7 @@ public static Task RunConsoleAsync(this IHostBuilder hostBuilder, CancellationTo /// A that can be used to cancel the console. /// A that only completes when the token is triggered or shutdown is triggered. [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] public static Task RunConsoleAsync(this IHostBuilder hostBuilder, Action configureOptions, CancellationToken cancellationToken = default) diff --git a/src/libraries/Microsoft.Extensions.Hosting/src/Internal/ConsoleLifetime.cs b/src/libraries/Microsoft.Extensions.Hosting/src/Internal/ConsoleLifetime.cs index 372a6146c55d2..f78865467cabd 100644 --- a/src/libraries/Microsoft.Extensions.Hosting/src/Internal/ConsoleLifetime.cs +++ b/src/libraries/Microsoft.Extensions.Hosting/src/Internal/ConsoleLifetime.cs @@ -15,7 +15,7 @@ namespace Microsoft.Extensions.Hosting.Internal /// Listens for Ctrl+C or SIGTERM and initiates shutdown. /// [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] public partial class ConsoleLifetime : IHostLifetime, IDisposable diff --git a/src/libraries/Microsoft.Extensions.Logging.Console/ref/Microsoft.Extensions.Logging.Console.cs b/src/libraries/Microsoft.Extensions.Logging.Console/ref/Microsoft.Extensions.Logging.Console.cs index 0941865d6e3db..752b3800d6c19 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Console/ref/Microsoft.Extensions.Logging.Console.cs +++ b/src/libraries/Microsoft.Extensions.Logging.Console/ref/Microsoft.Extensions.Logging.Console.cs @@ -6,7 +6,7 @@ namespace Microsoft.Extensions.Logging { - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static partial class ConsoleLoggerExtensions { public static Microsoft.Extensions.Logging.ILoggingBuilder AddConsole(this Microsoft.Extensions.Logging.ILoggingBuilder builder) { throw null; } @@ -72,7 +72,7 @@ public ConsoleLoggerOptions() { } public bool UseUtcTimestamp { get { throw null; } set { } } } [Microsoft.Extensions.Logging.ProviderAliasAttribute("Console")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public partial class ConsoleLoggerProvider : Microsoft.Extensions.Logging.ILoggerProvider, Microsoft.Extensions.Logging.ISupportExternalScope, System.IDisposable { public ConsoleLoggerProvider(Microsoft.Extensions.Options.IOptionsMonitor options) { } diff --git a/src/libraries/Microsoft.Extensions.Logging.Console/src/AnsiParsingLogConsole.cs b/src/libraries/Microsoft.Extensions.Logging.Console/src/AnsiParsingLogConsole.cs index 8cab45f3ffc06..cb2c4c0d3a1bf 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Console/src/AnsiParsingLogConsole.cs +++ b/src/libraries/Microsoft.Extensions.Logging.Console/src/AnsiParsingLogConsole.cs @@ -8,7 +8,7 @@ namespace Microsoft.Extensions.Logging.Console { [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] internal sealed class AnsiParsingLogConsole : IConsole diff --git a/src/libraries/Microsoft.Extensions.Logging.Console/src/ConsoleLogger.cs b/src/libraries/Microsoft.Extensions.Logging.Console/src/ConsoleLogger.cs index 3a542e6063635..edbad042e2711 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Console/src/ConsoleLogger.cs +++ b/src/libraries/Microsoft.Extensions.Logging.Console/src/ConsoleLogger.cs @@ -12,7 +12,7 @@ namespace Microsoft.Extensions.Logging.Console /// /// A logger that writes messages in the console. /// - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] internal sealed class ConsoleLogger : ILogger { private readonly string _name; diff --git a/src/libraries/Microsoft.Extensions.Logging.Console/src/ConsoleLoggerExtensions.cs b/src/libraries/Microsoft.Extensions.Logging.Console/src/ConsoleLoggerExtensions.cs index 160e099097f8c..f896bee082f67 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Console/src/ConsoleLoggerExtensions.cs +++ b/src/libraries/Microsoft.Extensions.Logging.Console/src/ConsoleLoggerExtensions.cs @@ -15,7 +15,7 @@ namespace Microsoft.Extensions.Logging { - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public static class ConsoleLoggerExtensions { internal const string RequiresDynamicCodeMessage = "Binding TOptions to configuration values may require generating dynamic code at runtime."; @@ -163,7 +163,7 @@ private static ILoggingBuilder AddFormatterWithName(this ILoggingBuilder builder } } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] internal sealed class ConsoleLoggerFormatterConfigureOptions : ConfigureFromConfigurationOptions where TOptions : ConsoleFormatterOptions where TFormatter : ConsoleFormatter @@ -176,7 +176,7 @@ public ConsoleLoggerFormatterConfigureOptions(ILoggerProviderConfiguration : ConfigurationChangeTokenSource where TOptions : ConsoleFormatterOptions where TFormatter : ConsoleFormatter diff --git a/src/libraries/Microsoft.Extensions.Logging.Console/src/ConsoleLoggerProcessor.cs b/src/libraries/Microsoft.Extensions.Logging.Console/src/ConsoleLoggerProcessor.cs index ff48c3880c418..51face2a0cd01 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Console/src/ConsoleLoggerProcessor.cs +++ b/src/libraries/Microsoft.Extensions.Logging.Console/src/ConsoleLoggerProcessor.cs @@ -11,7 +11,7 @@ namespace Microsoft.Extensions.Logging.Console { - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] internal class ConsoleLoggerProcessor : IDisposable { private readonly Queue _messageQueue; diff --git a/src/libraries/Microsoft.Extensions.Logging.Console/src/ConsoleLoggerProvider.cs b/src/libraries/Microsoft.Extensions.Logging.Console/src/ConsoleLoggerProvider.cs index 6bbb9b7e3f46c..8dfabeb12637a 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Console/src/ConsoleLoggerProvider.cs +++ b/src/libraries/Microsoft.Extensions.Logging.Console/src/ConsoleLoggerProvider.cs @@ -14,7 +14,7 @@ namespace Microsoft.Extensions.Logging.Console /// /// A provider of instances. /// - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [ProviderAlias("Console")] public class ConsoleLoggerProvider : ILoggerProvider, ISupportExternalScope { diff --git a/src/libraries/System.CodeDom/Directory.Build.props b/src/libraries/System.CodeDom/Directory.Build.props index 72712f3351c12..5377378125810 100644 --- a/src/libraries/System.CodeDom/Directory.Build.props +++ b/src/libraries/System.CodeDom/Directory.Build.props @@ -2,6 +2,6 @@ true - browser;ios;tvos;maccatalyst + browser;wasi;ios;tvos;maccatalyst \ No newline at end of file diff --git a/src/libraries/System.Collections.Concurrent/ref/System.Collections.Concurrent.cs b/src/libraries/System.Collections.Concurrent/ref/System.Collections.Concurrent.cs index 6c2b09321b7f9..fd84493400d19 100644 --- a/src/libraries/System.Collections.Concurrent/ref/System.Collections.Concurrent.cs +++ b/src/libraries/System.Collections.Concurrent/ref/System.Collections.Concurrent.cs @@ -7,7 +7,7 @@ #if !BUILDING_CORELIB_REFERENCE namespace System.Collections.Concurrent { - [System.Runtime.Versioning.UnsupportedOSPlatform("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatform("browser"), System.Runtime.Versioning.UnsupportedOSPlatform("wasi")] public partial class BlockingCollection : System.Collections.Generic.IEnumerable, System.Collections.Generic.IReadOnlyCollection, System.Collections.ICollection, System.Collections.IEnumerable, System.IDisposable { public BlockingCollection() { } diff --git a/src/libraries/System.Collections.Concurrent/src/System/Collections/Concurrent/BlockingCollection.cs b/src/libraries/System.Collections.Concurrent/src/System/Collections/Concurrent/BlockingCollection.cs index ec3e26c82d812..f310ec1d072ca 100644 --- a/src/libraries/System.Collections.Concurrent/src/System/Collections/Concurrent/BlockingCollection.cs +++ b/src/libraries/System.Collections.Concurrent/src/System/Collections/Concurrent/BlockingCollection.cs @@ -39,7 +39,7 @@ namespace System.Collections.Concurrent /// away as an . /// /// Specifies the type of elements in the collection. - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [DebuggerTypeProxy(typeof(BlockingCollectionDebugView<>))] [DebuggerDisplay("Count = {Count}, Type = {_collection}")] public class BlockingCollection : IEnumerable, ICollection, IDisposable, IReadOnlyCollection @@ -1746,7 +1746,7 @@ public BlockingCollectionDebugView(BlockingCollection collection) } /// Returns a snapshot of the underlying collection's elements. - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [DebuggerBrowsable(DebuggerBrowsableState.RootHidden)] public T[] Items { diff --git a/src/libraries/System.ComponentModel.TypeConverter/ref/System.ComponentModel.TypeConverter.cs b/src/libraries/System.ComponentModel.TypeConverter/ref/System.ComponentModel.TypeConverter.cs index 8e77546fccb68..f7650b0e00793 100644 --- a/src/libraries/System.ComponentModel.TypeConverter/ref/System.ComponentModel.TypeConverter.cs +++ b/src/libraries/System.ComponentModel.TypeConverter/ref/System.ComponentModel.TypeConverter.cs @@ -734,9 +734,9 @@ public sealed partial class LicenseManager internal LicenseManager() { } public static System.ComponentModel.LicenseContext CurrentContext { get { throw null; } set { } } public static System.ComponentModel.LicenseUsageMode UsageMode { get { throw null; } } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static object? CreateWithContext([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)] System.Type type, System.ComponentModel.LicenseContext creationContext) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static object? CreateWithContext([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)] System.Type type, System.ComponentModel.LicenseContext creationContext, object[] args) { throw null; } public static bool IsLicensed(System.Type type) { throw null; } public static bool IsValid(System.Type type) { throw null; } @@ -919,7 +919,7 @@ public MaskedTextProvider(string mask, System.Globalization.CultureInfo? culture public bool Add(string input, out int testPosition, out System.ComponentModel.MaskedTextResultHint resultHint) { throw null; } public void Clear() { } public void Clear(out System.ComponentModel.MaskedTextResultHint resultHint) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public object Clone() { throw null; } public int FindAssignedEditPositionFrom(int position, bool direction) { throw null; } public int FindAssignedEditPositionInRange(int startPosition, int endPosition, bool direction) { throw null; } @@ -2350,7 +2350,7 @@ public partial class ExtendedProtectionPolicyTypeConverter : System.ComponentMod { public ExtendedProtectionPolicyTypeConverter() { } public override bool CanConvertTo(System.ComponentModel.ITypeDescriptorContext? context, [System.Diagnostics.CodeAnalysis.NotNullWhen(true)] System.Type? destinationType) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public override object? ConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object? value, System.Type destinationType) { throw null; } } } diff --git a/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/LicenseManager.cs b/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/LicenseManager.cs index b672334a38375..de7341e512767 100644 --- a/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/LicenseManager.cs +++ b/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/LicenseManager.cs @@ -115,7 +115,7 @@ private static void CacheProvider(Type type, LicenseProvider? provider) /// creationContext /// as the context in which the licensed instance can be used. /// - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public static object? CreateWithContext( [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type type, LicenseContext creationContext) @@ -128,7 +128,7 @@ private static void CacheProvider(Type type, LicenseProvider? provider) /// specified arguments, using creationContext as the context in which the licensed /// instance can be used. /// - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public static object? CreateWithContext( [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type type, LicenseContext creationContext, diff --git a/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/MaskedTextProvider.cs b/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/MaskedTextProvider.cs index 20c083f9ff152..859a27400d59a 100644 --- a/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/MaskedTextProvider.cs +++ b/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/MaskedTextProvider.cs @@ -462,7 +462,7 @@ private void Initialize() /// Derived classes can override this method and call base.Clone to get proper cloning semantics but must /// implement the full-parameter constructor (passing parameters to the base constructor as well). /// - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public object Clone() { MaskedTextProvider clonedProvider; 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 c918ac07258d0..fc47f7c1418d9 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 @@ -18,7 +18,7 @@ public override bool CanConvertTo(ITypeDescriptorContext? context, [NotNullWhen( return destinationType == typeof(InstanceDescriptor) || base.CanConvertTo(context, destinationType); } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public override object? ConvertTo(ITypeDescriptorContext? context, CultureInfo? culture, object? value, Type destinationType) { if (destinationType == typeof(InstanceDescriptor)) diff --git a/src/libraries/System.Configuration.ConfigurationManager/Directory.Build.props b/src/libraries/System.Configuration.ConfigurationManager/Directory.Build.props index c843a6347ce61..3a3d8f9832479 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.Console/ref/System.Console.cs b/src/libraries/System.Console/ref/System.Console.cs index dfcce82fb96b8..f23a632b4d837 100644 --- a/src/libraries/System.Console/ref/System.Console.cs +++ b/src/libraries/System.Console/ref/System.Console.cs @@ -9,7 +9,7 @@ namespace System public static partial class Console { [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public static System.ConsoleColor BackgroundColor { get { throw null; } set { } } @@ -18,30 +18,30 @@ public static partial class Console [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] public static bool CapsLock { get { throw null; } } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public static int CursorLeft { get { throw null; } set { } } public static int CursorSize { [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] get { throw null; } [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] set { } } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public static int CursorTop { get { throw null; } set { } } public static bool CursorVisible { [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] get { throw null; } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] set { } } public static System.IO.TextWriter Error { get { throw null; } } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public static System.ConsoleColor ForegroundColor { get { throw null; } set { } } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public static System.IO.TextReader In { get { throw null; } } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public static System.Text.Encoding InputEncoding { get { throw null; } set { } } @@ -50,12 +50,12 @@ public static partial class Console public static bool IsOutputRedirected { get { throw null; } } public static bool KeyAvailable { get { throw null; } } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public static int LargestWindowHeight { get { throw null; } } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public static int LargestWindowWidth { get { throw null; } } @@ -65,29 +65,29 @@ public static partial class Console public static System.Text.Encoding OutputEncoding { get { throw null; } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] set { } } public static string Title { [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] get { throw null; } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] set { } } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public static bool TreatControlCAsInput { get { throw null; } set { } } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public static int WindowHeight { get { throw null; } set { } } public static int WindowLeft { get { throw null; } [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] set { } } public static int WindowTop { get { throw null; } [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] set { } } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public static int WindowWidth { get { throw null; } set { } } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public static event System.ConsoleCancelEventHandler? CancelKeyPress { add { } remove { } } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public static void Beep() { } @@ -98,7 +98,7 @@ public static void Beep(int frequency, int duration) { } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public static void Clear() { } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public static (int Left, int Top) GetCursorPosition() { throw null; } @@ -109,46 +109,46 @@ public static void MoveBufferArea(int sourceLeft, int sourceTop, int sourceWidth public static System.IO.Stream OpenStandardError() { throw null; } public static System.IO.Stream OpenStandardError(int bufferSize) { throw null; } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public static System.IO.Stream OpenStandardInput() { throw null; } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static System.IO.Stream OpenStandardInput(int bufferSize) { throw null; } public static System.IO.Stream OpenStandardOutput() { throw null; } public static System.IO.Stream OpenStandardOutput(int bufferSize) { throw null; } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static int Read() { throw null; } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public static System.ConsoleKeyInfo ReadKey() { throw null; } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public static System.ConsoleKeyInfo ReadKey(bool intercept) { throw null; } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static string? ReadLine() { throw null; } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public static void ResetColor() { } [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] public static void SetBufferSize(int width, int height) { } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public static void SetCursorPosition(int left, int top) { } public static void SetError(System.IO.TextWriter newError) { } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public static void SetIn(System.IO.TextReader newIn) { } @@ -156,7 +156,7 @@ public static void SetOut(System.IO.TextWriter newOut) { } [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] public static void SetWindowPosition(int left, int top) { } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public static void SetWindowSize(int width, int height) { } diff --git a/src/libraries/System.Console/src/System.Console.csproj b/src/libraries/System.Console/src/System.Console.csproj index 2097f08efe716..43f8f2241e157 100644 --- a/src/libraries/System.Console/src/System.Console.csproj +++ b/src/libraries/System.Console/src/System.Console.csproj @@ -1,13 +1,16 @@ true - $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-Android;$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-tvOS;$(NetCoreAppCurrent)-Browser;$(NetCoreAppCurrent) + $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-Android;$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-tvOS;$(NetCoreAppCurrent)-Browser;$(NetCoreAppCurrent)-wasi;$(NetCoreAppCurrent) $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) SR.PlatformNotSupported_SystemConsole + + $(DefineConstants);TARGET_WASI + @@ -47,7 +50,7 @@ Common\Interop\Android\Interop.Libraries.cs - + - + + Link="Common\Interop\Unix\Interop.SetTerminalInvalidationHandler.cs" + Condition="'$(TargetPlatformIdentifier)' != 'wasi'" + /> EnsureInitialized() public static int CursorSize { [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] get { return ConsolePal.CursorSize; } @@ -322,7 +322,7 @@ public static bool CapsLock internal const ConsoleColor UnknownColor = (ConsoleColor)(-1); [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] public static ConsoleColor BackgroundColor @@ -332,7 +332,7 @@ public static ConsoleColor BackgroundColor } [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] public static ConsoleColor ForegroundColor @@ -342,7 +342,7 @@ public static ConsoleColor ForegroundColor } [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] public static void ResetColor() @@ -353,7 +353,7 @@ public static void ResetColor() public static int BufferWidth { [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] get { return ConsolePal.BufferWidth; } @@ -364,7 +364,7 @@ public static int BufferWidth public static int BufferHeight { [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] get { return ConsolePal.BufferHeight; } @@ -393,7 +393,7 @@ public static int WindowTop } [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] public static int WindowWidth @@ -416,7 +416,7 @@ public static int WindowWidth } [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] public static int WindowHeight @@ -445,7 +445,7 @@ public static void SetWindowPosition(int left, int top) } [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] public static void SetWindowSize(int width, int height) @@ -469,7 +469,7 @@ public static void SetWindowSize(int width, int height) } [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] public static int LargestWindowWidth @@ -478,7 +478,7 @@ public static int LargestWindowWidth } [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] public static int LargestWindowHeight @@ -491,14 +491,14 @@ public static bool CursorVisible [SupportedOSPlatform("windows")] get { return ConsolePal.CursorVisible; } [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] set { ConsolePal.CursorVisible = value; } } [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] public static int CursorLeft @@ -508,7 +508,7 @@ public static int CursorLeft } [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] public static int CursorTop @@ -523,7 +523,7 @@ public static int CursorTop /// Columns are numbered from left to right starting at 0. Rows are numbered from top to bottom starting at 0. /// [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] public static (int Left, int Top) GetCursorPosition() @@ -536,7 +536,7 @@ public static string Title [SupportedOSPlatform("windows")] get { return ConsolePal.Title; } [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] set @@ -546,7 +546,7 @@ public static string Title } [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] public static void Beep() @@ -581,7 +581,7 @@ public static void Clear() } [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] public static void SetCursorPosition(int left, int top) @@ -596,7 +596,7 @@ public static void SetCursorPosition(int left, int top) } [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] public static event ConsoleCancelEventHandler? CancelKeyPress @@ -639,7 +639,7 @@ public static event ConsoleCancelEventHandler? CancelKeyPress } [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] public static bool TreatControlCAsInput @@ -649,7 +649,7 @@ public static bool TreatControlCAsInput } [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] public static Stream OpenStandardInput() @@ -658,7 +658,7 @@ public static Stream OpenStandardInput() } [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public static Stream OpenStandardInput(int bufferSize) { // bufferSize is ignored, other than in argument validation, even in the .NET Framework @@ -700,7 +700,7 @@ public static Stream OpenStandardError(int bufferSize) } [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] public static void SetIn(TextReader newIn) @@ -750,7 +750,7 @@ private static void CheckNonNull(object obj, string paramName) // [MethodImplAttribute(MethodImplOptions.NoInlining)] [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public static int Read() { return In.Read(); @@ -758,7 +758,7 @@ public static int Read() [MethodImplAttribute(MethodImplOptions.NoInlining)] [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public static string? ReadLine() { return In.ReadLine(); diff --git a/src/libraries/System.Console/src/System/ConsolePal.Unix.cs b/src/libraries/System.Console/src/System/ConsolePal.Unix.cs index 5d22a24ae678e..606a8e3ccb5b8 100644 --- a/src/libraries/System.Console/src/System/ConsolePal.Unix.cs +++ b/src/libraries/System.Console/src/System/ConsolePal.Unix.cs @@ -914,7 +914,9 @@ private static unsafe void EnsureInitializedCore() { // Register a callback for signals that may invalidate our cached terminal settings. // This includes: SIGCONT, SIGCHLD, SIGWINCH. +#if !TARGET_WASI Interop.Sys.SetTerminalInvalidationHandler(&InvalidateTerminalSettings); +#endif // Load special control character codes used for input processing var controlCharacterNames = new Interop.Sys.ControlCharacterNames[4] diff --git a/src/libraries/System.Data.Odbc/Directory.Build.props b/src/libraries/System.Data.Odbc/Directory.Build.props index c843a6347ce61..3a3d8f9832479 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.DiagnosticSource.csproj b/src/libraries/System.Diagnostics.DiagnosticSource/src/System.Diagnostics.DiagnosticSource.csproj index b3f55c9254d7c..3a8c5856cf6a0 100644 --- a/src/libraries/System.Diagnostics.DiagnosticSource/src/System.Diagnostics.DiagnosticSource.csproj +++ b/src/libraries/System.Diagnostics.DiagnosticSource/src/System.Diagnostics.DiagnosticSource.csproj @@ -19,6 +19,9 @@ System.Diagnostics.DiagnosticSource $(DefineConstants);ALLOW_PARTIALLY_TRUSTED_CALLERS;ENABLE_HTTP_HANDLER $(DefineConstants);W3C_DEFAULT_ID_FORMAT;MEMORYMARSHAL_SUPPORT;OS_ISBROWSER_SUPPORT true + + $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) + $(NoWarn);CA1416 diff --git a/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Metrics/AggregationManager.cs b/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Metrics/AggregationManager.cs index 8af2391019299..f90e1cdfc2669 100644 --- a/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Metrics/AggregationManager.cs +++ b/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Metrics/AggregationManager.cs @@ -11,7 +11,7 @@ namespace System.Diagnostics.Metrics { - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [SecuritySafeCritical] internal sealed class AggregationManager { 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 163cc031a2e67..ba613692cb2a7 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 @@ -236,6 +236,13 @@ public void OnEventCommand(EventCommandEventArgs command) return; } #endif +//#if OS_ISWASI_SUPPORT TODOWASI + if (OperatingSystem.IsOSPlatform("Wasi")) // TODO replace with https://github.com/dotnet/runtime/issues/78389 + { + Parent.Error("", "System.Diagnostics.Metrics EventSource not supported on WASI"); + return; + } +//#endif if (command.Command == EventCommand.Update || command.Command == EventCommand.Disable || command.Command == EventCommand.Enable) { @@ -379,7 +386,7 @@ private bool LogError(Exception e) private static readonly char[] s_instrumentSeparators = new char[] { '\r', '\n', ',', ';' }; - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] private void ParseSpecs(string? metricsSpecs) { if (metricsSpecs == null) diff --git a/src/libraries/System.Diagnostics.FileVersionInfo/Directory.Build.props b/src/libraries/System.Diagnostics.FileVersionInfo/Directory.Build.props index ce244cbea5619..58979d42f0695 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 ce244cbea5619..58979d42f0695 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 a513b8aa86159..5b32a9e8f072e 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.IsOSPlatform("Wasi")) // Process isn't supported on Browser { s_processName = processName = string.Empty; } diff --git a/src/libraries/System.Diagnostics.Tracing/ref/System.Diagnostics.Tracing.Counters.cs b/src/libraries/System.Diagnostics.Tracing/ref/System.Diagnostics.Tracing.Counters.cs index 79a8e9ddd909c..d28f66002684b 100644 --- a/src/libraries/System.Diagnostics.Tracing/ref/System.Diagnostics.Tracing.Counters.cs +++ b/src/libraries/System.Diagnostics.Tracing/ref/System.Diagnostics.Tracing.Counters.cs @@ -4,7 +4,7 @@ namespace System.Diagnostics.Tracing { #if !FEATURE_WASM_PERFTRACING - [System.Runtime.Versioning.UnsupportedOSPlatform("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatform("browser"), System.Runtime.Versioning.UnsupportedOSPlatform("wasi")] #endif public abstract partial class DiagnosticCounter : System.IDisposable { @@ -17,7 +17,7 @@ public void AddMetadata(string key, string? value) { } public void Dispose() { } } #if !FEATURE_WASM_PERFTRACING - [System.Runtime.Versioning.UnsupportedOSPlatform("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatform("browser"), System.Runtime.Versioning.UnsupportedOSPlatform("wasi")] #endif public partial class PollingCounter : System.Diagnostics.Tracing.DiagnosticCounter { @@ -25,7 +25,7 @@ public PollingCounter(string name, System.Diagnostics.Tracing.EventSource eventS public override string ToString() { throw null; } } #if !FEATURE_WASM_PERFTRACING - [System.Runtime.Versioning.UnsupportedOSPlatform("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatform("browser"), System.Runtime.Versioning.UnsupportedOSPlatform("wasi")] #endif public partial class IncrementingEventCounter : System.Diagnostics.Tracing.DiagnosticCounter { @@ -35,7 +35,7 @@ public void Increment(double increment = 1) { } public override string ToString() { throw null; } } #if !FEATURE_WASM_PERFTRACING - [System.Runtime.Versioning.UnsupportedOSPlatform("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatform("browser"), System.Runtime.Versioning.UnsupportedOSPlatform("wasi")] #endif public partial class IncrementingPollingCounter : System.Diagnostics.Tracing.DiagnosticCounter { @@ -44,7 +44,7 @@ public IncrementingPollingCounter(string name, System.Diagnostics.Tracing.EventS public override string ToString() { throw null; } } #if !FEATURE_WASM_PERFTRACING - [System.Runtime.Versioning.UnsupportedOSPlatform("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatform("browser"), System.Runtime.Versioning.UnsupportedOSPlatform("wasi")] #endif public partial class EventCounter : System.Diagnostics.Tracing.DiagnosticCounter { diff --git a/src/libraries/System.DirectoryServices.Protocols/Directory.Build.props b/src/libraries/System.DirectoryServices.Protocols/Directory.Build.props index 525d9a0d12ab6..ed868ac7937d9 100644 --- a/src/libraries/System.DirectoryServices.Protocols/Directory.Build.props +++ b/src/libraries/System.DirectoryServices.Protocols/Directory.Build.props @@ -7,6 +7,6 @@ 4.0.0.0 Microsoft true - browser;android;ios;tvos + browser;wasi;android;ios;tvos diff --git a/src/libraries/System.IO.Compression.Brotli/Directory.Build.props b/src/libraries/System.IO.Compression.Brotli/Directory.Build.props index f3f5769f93616..76ee806bc1a2b 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.Compression/src/CompatibilitySuppressions.xml b/src/libraries/System.IO.Compression/src/CompatibilitySuppressions.xml index 5914451471cbb..8d4094d4b8c18 100644 --- a/src/libraries/System.IO.Compression/src/CompatibilitySuppressions.xml +++ b/src/libraries/System.IO.Compression/src/CompatibilitySuppressions.xml @@ -7,6 +7,12 @@ ref/net7.0/System.IO.Compression.dll runtimes/browser/lib/net7.0/System.IO.Compression.dll + + CP0001 + T:System.IO.Compression.ZLibException + ref/net7.0/System.IO.Compression.dll + runtimes/wasi/lib/net7.0/System.IO.Compression.dll + CP0001 T:System.IO.Compression.ZLibException diff --git a/src/libraries/System.IO.Compression/src/System.IO.Compression.csproj b/src/libraries/System.IO.Compression/src/System.IO.Compression.csproj index 150b3efdb70ea..5179e9a2370ed 100644 --- a/src/libraries/System.IO.Compression/src/System.IO.Compression.csproj +++ b/src/libraries/System.IO.Compression/src/System.IO.Compression.csproj @@ -1,7 +1,7 @@ true - $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-Browser;$(NetCoreAppCurrent) + $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-Browser;$(NetCoreAppCurrent)-wasi;$(NetCoreAppCurrent) @@ -50,7 +50,7 @@ Link="Common\Interop\Windows\Interop.Libraries.cs" /> - + 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 ce244cbea5619..58979d42f0695 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.MemoryMappedFiles/src/System.IO.MemoryMappedFiles.csproj b/src/libraries/System.IO.MemoryMappedFiles/src/System.IO.MemoryMappedFiles.csproj index 9be9a376620fd..4dcee115f02f0 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 @@ true - $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-Browser;$(NetCoreAppCurrent) + $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-Browser;$(NetCoreAppCurrent)-wasi;$(NetCoreAppCurrent) @@ -80,7 +80,7 @@ - + Gets the system's page size. protected static Lazy s_pageSize = new Lazy(() => { - if (OperatingSystem.IsBrowser()) + if (OperatingSystem.IsBrowser() || OperatingSystem.IsOSPlatform("Wasi")) 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 ce244cbea5619..58979d42f0695 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.IO.Ports/Directory.Build.props b/src/libraries/System.IO.Ports/Directory.Build.props index 42ef4884cef5d..a93b4c306837b 100644 --- a/src/libraries/System.IO.Ports/Directory.Build.props +++ b/src/libraries/System.IO.Ports/Directory.Build.props @@ -2,6 +2,6 @@ true - browser;android;ios;tvos + browser;wasi;android;ios;tvos diff --git a/src/libraries/System.Linq.Parallel/src/System.Linq.Parallel.csproj b/src/libraries/System.Linq.Parallel/src/System.Linq.Parallel.csproj index b9bcf9eefa255..15898f8a267dd 100644 --- a/src/libraries/System.Linq.Parallel/src/System.Linq.Parallel.csproj +++ b/src/libraries/System.Linq.Parallel/src/System.Linq.Parallel.csproj @@ -3,6 +3,11 @@ true $(NetCoreAppCurrent) + + + $(NoWarn);CA1416 + + diff --git a/src/libraries/System.Linq.Parallel/src/System/Linq/Parallel/Channels/AsynchronousChannel.cs b/src/libraries/System.Linq.Parallel/src/System/Linq/Parallel/Channels/AsynchronousChannel.cs index 95c8d1f658ba1..822966243d868 100644 --- a/src/libraries/System.Linq.Parallel/src/System/Linq/Parallel/Channels/AsynchronousChannel.cs +++ b/src/libraries/System.Linq.Parallel/src/System/Linq/Parallel/Channels/AsynchronousChannel.cs @@ -17,7 +17,7 @@ namespace System.Linq.Parallel /// This is a bounded channel meant for single-producer/single-consumer scenarios. /// /// Specifies the type of data in the channel. - [System.Runtime.Versioning.UnsupportedOSPlatform("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatform("browser"), System.Runtime.Versioning.UnsupportedOSPlatform("wasi")] internal sealed class AsynchronousChannel : IDisposable { // The producer will be blocked once the channel reaches a capacity, and unblocked diff --git a/src/libraries/System.Linq.Parallel/src/System/Linq/Parallel/Merging/AsynchronousChannelMergeEnumerator.cs b/src/libraries/System.Linq.Parallel/src/System/Linq/Parallel/Merging/AsynchronousChannelMergeEnumerator.cs index 161fb73749130..63c15d41025c0 100644 --- a/src/libraries/System.Linq.Parallel/src/System/Linq/Parallel/Merging/AsynchronousChannelMergeEnumerator.cs +++ b/src/libraries/System.Linq.Parallel/src/System/Linq/Parallel/Merging/AsynchronousChannelMergeEnumerator.cs @@ -26,7 +26,7 @@ namespace System.Linq.Parallel /// /// /// - [System.Runtime.Versioning.UnsupportedOSPlatform("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatform("browser"), System.Runtime.Versioning.UnsupportedOSPlatform("wasi")] internal sealed class AsynchronousChannelMergeEnumerator : MergeEnumerator { private readonly AsynchronousChannel[] _channels; // The channels being enumerated. diff --git a/src/libraries/System.Linq.Parallel/src/System/Linq/Parallel/Merging/MergeExecutor.cs b/src/libraries/System.Linq.Parallel/src/System/Linq/Parallel/Merging/MergeExecutor.cs index 5a18d6fd93ca6..773c6313ed1fb 100644 --- a/src/libraries/System.Linq.Parallel/src/System/Linq/Parallel/Merging/MergeExecutor.cs +++ b/src/libraries/System.Linq.Parallel/src/System/Linq/Parallel/Merging/MergeExecutor.cs @@ -141,7 +141,7 @@ public IEnumerator GetEnumerator() // An array of asynchronous channels, one for each partition. // - [System.Runtime.Versioning.UnsupportedOSPlatform("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatform("browser"), System.Runtime.Versioning.UnsupportedOSPlatform("wasi")] internal static AsynchronousChannel[] MakeAsynchronousChannels(int partitionCount, ParallelMergeOptions options, IntValueEvent? consumerEvent, CancellationToken cancellationToken) { AsynchronousChannel[] channels = new AsynchronousChannel[partitionCount]; diff --git a/src/libraries/System.Linq.Parallel/src/System/Linq/Parallel/Merging/OrderPreservingPipeliningMergeHelper.cs b/src/libraries/System.Linq.Parallel/src/System/Linq/Parallel/Merging/OrderPreservingPipeliningMergeHelper.cs index ddf0377cc9397..9e8fab2836f43 100644 --- a/src/libraries/System.Linq.Parallel/src/System/Linq/Parallel/Merging/OrderPreservingPipeliningMergeHelper.cs +++ b/src/libraries/System.Linq.Parallel/src/System/Linq/Parallel/Merging/OrderPreservingPipeliningMergeHelper.cs @@ -36,7 +36,7 @@ namespace System.Linq.Parallel /// Finally, if the producer notices that its buffer has exceeded an even greater threshold, it will /// go to sleep and wait until the consumer takes the entire buffer. /// - [System.Runtime.Versioning.UnsupportedOSPlatform("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatform("browser"), System.Runtime.Versioning.UnsupportedOSPlatform("wasi")] internal sealed class OrderPreservingPipeliningMergeHelper : IMergeHelper { private readonly QueryTaskGroupState _taskGroupState; // State shared among tasks. diff --git a/src/libraries/System.Linq.Parallel/src/System/Linq/Parallel/Scheduling/OrderPreservingPipeliningSpoolingTask.cs b/src/libraries/System.Linq.Parallel/src/System/Linq/Parallel/Scheduling/OrderPreservingPipeliningSpoolingTask.cs index b419c38ce7839..e15e87e0e1354 100644 --- a/src/libraries/System.Linq.Parallel/src/System/Linq/Parallel/Scheduling/OrderPreservingPipeliningSpoolingTask.cs +++ b/src/libraries/System.Linq.Parallel/src/System/Linq/Parallel/Scheduling/OrderPreservingPipeliningSpoolingTask.cs @@ -18,7 +18,7 @@ namespace System.Linq.Parallel { - [System.Runtime.Versioning.UnsupportedOSPlatform("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatform("browser"), System.Runtime.Versioning.UnsupportedOSPlatform("wasi")] internal sealed class OrderPreservingPipeliningSpoolingTask : SpoolingTaskBase { private readonly QueryTaskGroupState _taskGroupState; // State shared among tasks. diff --git a/src/libraries/System.Linq.Parallel/src/System/Linq/Parallel/Scheduling/SpoolingTask.cs b/src/libraries/System.Linq.Parallel/src/System/Linq/Parallel/Scheduling/SpoolingTask.cs index 198fd693c458d..a7eb275973828 100644 --- a/src/libraries/System.Linq.Parallel/src/System/Linq/Parallel/Scheduling/SpoolingTask.cs +++ b/src/libraries/System.Linq.Parallel/src/System/Linq/Parallel/Scheduling/SpoolingTask.cs @@ -82,7 +82,7 @@ internal static void SpoolStopAndGo( // taskScheduler - the task manager on which to execute // - [System.Runtime.Versioning.UnsupportedOSPlatform("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatform("browser"), System.Runtime.Versioning.UnsupportedOSPlatform("wasi")] internal static void SpoolPipeline( QueryTaskGroupState groupState, PartitionedStream partitions, AsynchronousChannel[] channels, TaskScheduler taskScheduler) @@ -262,7 +262,7 @@ protected override void SpoolingFinally() /// /// /// - [System.Runtime.Versioning.UnsupportedOSPlatform("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatform("browser"), System.Runtime.Versioning.UnsupportedOSPlatform("wasi")] internal sealed class PipelineSpoolingTask : SpoolingTaskBase { // The data source from which to pull data. diff --git a/src/libraries/System.Linq.Parallel/src/System/Linq/Parallel/Utils/Sorting.cs b/src/libraries/System.Linq.Parallel/src/System/Linq/Parallel/Utils/Sorting.cs index 5a0fb29343b15..35d2a0a0c0fad 100644 --- a/src/libraries/System.Linq.Parallel/src/System/Linq/Parallel/Utils/Sorting.cs +++ b/src/libraries/System.Linq.Parallel/src/System/Linq/Parallel/Utils/Sorting.cs @@ -351,7 +351,7 @@ private void QuickSortIndicesInPlace(GrowingArray keys, List // negatively impact speedups. // - [System.Runtime.Versioning.UnsupportedOSPlatform("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatform("browser"), System.Runtime.Versioning.UnsupportedOSPlatform("wasi")] private void MergeSortCooperatively() { CancellationToken cancelToken = _groupState.CancellationState.MergedCancellationToken; 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 81de50225cbd8..9d8ce440ffdf9 100644 --- a/src/libraries/System.Linq.Parallel/src/System/Linq/ParallelEnumerable.cs +++ b/src/libraries/System.Linq.Parallel/src/System/Linq/ParallelEnumerable.cs @@ -65,7 +65,7 @@ public static class ParallelEnumerable // When running in single partition mode, PLINQ operations will occur on a single partition and will not // be executed in parallel, but will retain PLINQ semantics (exceptions wrapped as aggregates, etc). [System.Runtime.Versioning.SupportedOSPlatformGuard("browser")] - internal static bool SinglePartitionMode => OperatingSystem.IsBrowser(); + internal static bool SinglePartitionMode => OperatingSystem.IsBrowser() || OperatingSystem.IsOSPlatform("Wasi"); //----------------------------------------------------------------------------------- // Converts any IEnumerable into something that can be the target of parallel diff --git a/src/libraries/System.Linq/src/CompatibilitySuppressions.xml b/src/libraries/System.Linq/src/CompatibilitySuppressions.xml index bbdfa98547610..df413125cabf9 100644 --- a/src/libraries/System.Linq/src/CompatibilitySuppressions.xml +++ b/src/libraries/System.Linq/src/CompatibilitySuppressions.xml @@ -19,6 +19,12 @@ ref/net7.0/System.Linq.dll runtimes/browser/lib/net7.0/System.Linq.dll + + CP0001 + T:System.Linq.Grouping`2 + ref/net7.0/System.Linq.dll + runtimes/wasi/lib/net7.0/System.Linq.dll + CP0001 T:System.Linq.Grouping`2 diff --git a/src/libraries/System.Linq/src/System.Linq.csproj b/src/libraries/System.Linq/src/System.Linq.csproj index e0509ff215fd8..993638eedd83d 100644 --- a/src/libraries/System.Linq/src/System.Linq.csproj +++ b/src/libraries/System.Linq/src/System.Linq.csproj @@ -1,11 +1,11 @@ - $(NetCoreAppCurrent);$(NetCoreAppCurrent)-Browser;$(NetCoreAppCurrent)-Android;$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-tvOS + $(NetCoreAppCurrent);$(NetCoreAppCurrent)-Browser;$(NetCoreAppCurrent)-wasi;$(NetCoreAppCurrent)-Android;$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-tvOS $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) - true + true diff --git a/src/libraries/System.Net.Http/ref/System.Net.Http.cs b/src/libraries/System.Net.Http/ref/System.Net.Http.cs index ebbbc59fea446..8e3aba1e23a90 100644 --- a/src/libraries/System.Net.Http/ref/System.Net.Http.cs +++ b/src/libraries/System.Net.Http/ref/System.Net.Http.cs @@ -96,13 +96,13 @@ protected override void Dispose(bool disposing) { } public System.Threading.Tasks.Task PutAsync([System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri, System.Net.Http.HttpContent? content, System.Threading.CancellationToken cancellationToken) { throw null; } public System.Threading.Tasks.Task PutAsync(System.Uri? requestUri, System.Net.Http.HttpContent? content) { throw null; } public System.Threading.Tasks.Task PutAsync(System.Uri? requestUri, System.Net.Http.HttpContent? content, System.Threading.CancellationToken cancellationToken) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public System.Net.Http.HttpResponseMessage Send(System.Net.Http.HttpRequestMessage request) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public System.Net.Http.HttpResponseMessage Send(System.Net.Http.HttpRequestMessage request, System.Net.Http.HttpCompletionOption completionOption) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public System.Net.Http.HttpResponseMessage Send(System.Net.Http.HttpRequestMessage request, System.Net.Http.HttpCompletionOption completionOption, System.Threading.CancellationToken cancellationToken) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public override System.Net.Http.HttpResponseMessage Send(System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) { throw null; } public System.Threading.Tasks.Task SendAsync(System.Net.Http.HttpRequestMessage request) { throw null; } public System.Threading.Tasks.Task SendAsync(System.Net.Http.HttpRequestMessage request, System.Net.Http.HttpCompletionOption completionOption) { throw null; } @@ -113,47 +113,47 @@ public partial class HttpClientHandler : System.Net.Http.HttpMessageHandler { public HttpClientHandler() { } public bool AllowAutoRedirect { get { throw null; } set { } } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public System.Net.DecompressionMethods AutomaticDecompression { get { throw null; } set { } } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public bool CheckCertificateRevocationList { get { throw null; } set { } } public System.Net.Http.ClientCertificateOption ClientCertificateOptions { get { throw null; } set { } } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public System.Security.Cryptography.X509Certificates.X509CertificateCollection ClientCertificates { get { throw null; } } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public System.Net.CookieContainer CookieContainer { get { throw null; } set { } } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public System.Net.ICredentials? Credentials { get { throw null; } set { } } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static System.Func DangerousAcceptAnyServerCertificateValidator { get { throw null; } } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public System.Net.ICredentials? DefaultProxyCredentials { get { throw null; } set { } } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public int MaxAutomaticRedirections { get { throw null; } set { } } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public int MaxConnectionsPerServer { get { throw null; } set { } } public long MaxRequestContentBufferSize { get { throw null; } set { } } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public int MaxResponseHeadersLength { get { throw null; } set { } } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public bool PreAuthenticate { get { throw null; } set { } } public System.Collections.Generic.IDictionary Properties { get { throw null; } } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public System.Net.IWebProxy? Proxy { get { throw null; } set { } } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public System.Func? ServerCertificateCustomValidationCallback { get { throw null; } set { } } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public System.Security.Authentication.SslProtocols SslProtocols { get { throw null; } set { } } public virtual bool SupportsAutomaticDecompression { get { throw null; } } public virtual bool SupportsProxy { get { throw null; } } public virtual bool SupportsRedirectConfiguration { get { throw null; } } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public bool UseCookies { get { throw null; } set { } } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public bool UseDefaultCredentials { get { throw null; } set { } } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public bool UseProxy { get { throw null; } set { } } protected override void Dispose(bool disposing) { } // @@ -161,7 +161,7 @@ protected override void Dispose(bool disposing) { } // API compat will fail until this is fixed // //[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] //[System.Runtime.Versioning.UnsupportedOSPlatformAttributeUnsupportedOSPlatform("ios")] //[System.Runtime.Versioning.UnsupportedOSPlatformAttributeUnsupportedOSPlatform("tvos")] protected internal override System.Net.Http.HttpResponseMessage Send(System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) { throw null; } @@ -215,7 +215,7 @@ public HttpMessageInvoker(System.Net.Http.HttpMessageHandler handler) { } public HttpMessageInvoker(System.Net.Http.HttpMessageHandler handler, bool disposeHandler) { } public void Dispose() { } protected virtual void Dispose(bool disposing) { } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public virtual System.Net.Http.HttpResponseMessage Send(System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) { throw null; } public virtual System.Threading.Tasks.Task SendAsync(System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) { throw null; } } @@ -369,12 +369,12 @@ protected override void SerializeToStream(System.IO.Stream stream, System.Net.Tr protected override System.Threading.Tasks.Task SerializeToStreamAsync(System.IO.Stream stream, System.Net.TransportContext? context, System.Threading.CancellationToken cancellationToken) { throw null; } protected internal override bool TryComputeLength(out long length) { throw null; } } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public sealed partial class SocketsHttpHandler : System.Net.Http.HttpMessageHandler { public SocketsHttpHandler() { } public int InitialHttp2StreamWindowSize { get { throw null; } set { } } - [System.Runtime.Versioning.UnsupportedOSPlatformGuardAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformGuardAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformGuardAttribute("wasi")] public static bool IsSupported { get { throw null; } } public bool AllowAutoRedirect { get { throw null; } set { } } public System.Net.DecompressionMethods AutomaticDecompression { get { throw null; } set { } } diff --git a/src/libraries/System.Net.Http/src/ILLink/ILLink.Substitutions.xml b/src/libraries/System.Net.Http/src/ILLink/ILLink.Substitutions.xml index 5e70f6fbb5d7d..57af1e08afa78 100644 --- a/src/libraries/System.Net.Http/src/ILLink/ILLink.Substitutions.xml +++ b/src/libraries/System.Net.Http/src/ILLink/ILLink.Substitutions.xml @@ -1,7 +1,7 @@ - - - - - + + + + + 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 fadb5f1bd51ec..c882589d8f830 100644 --- a/src/libraries/System.Net.Http/src/System.Net.Http.csproj +++ b/src/libraries/System.Net.Http/src/System.Net.Http.csproj @@ -5,6 +5,7 @@ $(DefineConstants);HTTP_DLL $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Linux;$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-FreeBSD;$(NetCoreAppCurrent)-MacCatalyst;$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-tvOS;$(NetCoreAppCurrent)-Browser;$(NetCoreAppCurrent)-illumos;$(NetCoreAppCurrent)-Solaris;$(NetCoreAppCurrent)-Android;$(NetCoreAppCurrent) true + wasi @@ -17,6 +18,7 @@ $(DefineConstants);TARGET_MACCATALYST $(DefineConstants);TARGET_TVOS $(DefineConstants);TARGET_BROWSER + $(DefineConstants);TARGET_WASI $(MSBuildThisFileDirectory)ILLink\ @@ -24,7 +26,7 @@ - + @@ -156,7 +158,7 @@ Link="Common\System\Text\ValueStringBuilder.AppendSpanFormattable.cs" /> - + @@ -304,12 +306,12 @@ - + - + @@ -385,7 +387,7 @@ - + - + diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/BrowserHttpHandler/SocketsHttpHandler.cs b/src/libraries/System.Net.Http/src/System/Net/Http/BrowserHttpHandler/SocketsHttpHandler.cs index 1cd0dbdb7a645..b72d6b552ab2f 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/BrowserHttpHandler/SocketsHttpHandler.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/BrowserHttpHandler/SocketsHttpHandler.cs @@ -12,10 +12,10 @@ namespace System.Net.Http { - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public sealed class SocketsHttpHandler : HttpMessageHandler { - [UnsupportedOSPlatformGuard("browser")] + [UnsupportedOSPlatformGuard("browser"), UnsupportedOSPlatformGuard("wasi")] public static bool IsSupported => false; public bool UseCookies diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.cs b/src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.cs index 83f4ab8db1166..b039d44b57474 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.cs @@ -450,19 +450,19 @@ public Task DeleteAsync(Uri? requestUri, CancellationToken #region Advanced Send Overloads - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public HttpResponseMessage Send(HttpRequestMessage request) => Send(request, DefaultCompletionOption, cancellationToken: default); - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public HttpResponseMessage Send(HttpRequestMessage request, HttpCompletionOption completionOption) => Send(request, completionOption, cancellationToken: default); - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public override HttpResponseMessage Send(HttpRequestMessage request, CancellationToken cancellationToken) => Send(request, DefaultCompletionOption, cancellationToken); - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public HttpResponseMessage Send(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken) { CheckRequestBeforeSend(request); diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/HttpClientHandler.AnyMobile.cs b/src/libraries/System.Net.Http/src/System/Net/Http/HttpClientHandler.AnyMobile.cs index a355a7af61e03..339bd5d48f311 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/HttpClientHandler.AnyMobile.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/HttpClientHandler.AnyMobile.cs @@ -73,7 +73,7 @@ protected override void Dispose(bool disposing) base.Dispose(disposing); } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public bool UseCookies { get @@ -100,7 +100,7 @@ public bool UseCookies } } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public CookieContainer CookieContainer { get @@ -129,7 +129,7 @@ public CookieContainer CookieContainer } } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public ICredentials? DefaultProxyCredentials { get @@ -156,7 +156,7 @@ public ICredentials? DefaultProxyCredentials } } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public bool UseDefaultCredentials { // SocketsHttpHandler doesn't have a separate UseDefaultCredentials property. There @@ -211,7 +211,7 @@ public bool UseDefaultCredentials } } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public ICredentials? Credentials { get @@ -265,7 +265,7 @@ public bool AllowAutoRedirect } } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public int MaxConnectionsPerServer { get @@ -325,7 +325,7 @@ public long MaxRequestContentBufferSize } } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public int MaxResponseHeadersLength { get @@ -394,7 +394,7 @@ public ClientCertificateOption ClientCertificateOptions } } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public X509CertificateCollection ClientCertificates { get @@ -416,7 +416,7 @@ public X509CertificateCollection ClientCertificates } } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public Func? ServerCertificateCustomValidationCallback { get @@ -446,7 +446,7 @@ public X509CertificateCollection ClientCertificates } } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public bool CheckCertificateRevocationList { get @@ -474,7 +474,7 @@ public bool CheckCertificateRevocationList } } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public SslProtocols SslProtocols { get @@ -562,7 +562,7 @@ public virtual bool SupportsRedirectConfiguration } } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public DecompressionMethods AutomaticDecompression { get @@ -589,7 +589,7 @@ public DecompressionMethods AutomaticDecompression } } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public bool UseProxy { get @@ -616,7 +616,7 @@ public bool UseProxy } } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] public IWebProxy? Proxy @@ -645,7 +645,7 @@ public IWebProxy? Proxy } } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public bool PreAuthenticate { get @@ -672,7 +672,7 @@ public bool PreAuthenticate } } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public int MaxAutomaticRedirections { get @@ -704,7 +704,7 @@ public int MaxAutomaticRedirections // API compat will fail until this is fixed // //[UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] //[UnsupportedOSPlatform("ios")] //[UnsupportedOSPlatform("tvos")] protected internal override HttpResponseMessage Send(HttpRequestMessage request, @@ -733,7 +733,7 @@ protected internal override Task SendAsync(HttpRequestMessa // lazy-load the validator func so it can be trimmed by the ILLinker if it isn't used. private static Func? s_dangerousAcceptAnyServerCertificateValidator; - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public static Func DangerousAcceptAnyServerCertificateValidator { get diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/HttpClientHandler.cs b/src/libraries/System.Net.Http/src/System/Net/Http/HttpClientHandler.cs index b1946ac433118..c2ba64f20a449 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/HttpClientHandler.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/HttpClientHandler.cs @@ -63,14 +63,14 @@ protected override void Dispose(bool disposing) public virtual bool SupportsProxy => HttpHandlerType.SupportsProxy; public virtual bool SupportsRedirectConfiguration => HttpHandlerType.SupportsRedirectConfiguration; - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public bool UseCookies { get => _underlyingHandler.UseCookies; set => _underlyingHandler.UseCookies = value; } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public CookieContainer CookieContainer { get => _underlyingHandler.CookieContainer; @@ -82,21 +82,21 @@ public CookieContainer CookieContainer } } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public DecompressionMethods AutomaticDecompression { get => _underlyingHandler.AutomaticDecompression; set => _underlyingHandler.AutomaticDecompression = value; } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public bool UseProxy { get => _underlyingHandler.UseProxy; set => _underlyingHandler.UseProxy = value; } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] public IWebProxy? Proxy @@ -105,21 +105,21 @@ public IWebProxy? Proxy set => _underlyingHandler.Proxy = value; } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public ICredentials? DefaultProxyCredentials { get => _underlyingHandler.DefaultProxyCredentials; set => _underlyingHandler.DefaultProxyCredentials = value; } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public bool PreAuthenticate { get => _underlyingHandler.PreAuthenticate; set => _underlyingHandler.PreAuthenticate = value; } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public bool UseDefaultCredentials { // SocketsHttpHandler doesn't have a separate UseDefaultCredentials property. There @@ -142,7 +142,7 @@ public bool UseDefaultCredentials } } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public ICredentials? Credentials { get => _underlyingHandler.Credentials; @@ -155,14 +155,14 @@ public bool AllowAutoRedirect set => _underlyingHandler.AllowAutoRedirect = value; } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public int MaxAutomaticRedirections { get => _underlyingHandler.MaxAutomaticRedirections; set => _underlyingHandler.MaxAutomaticRedirections = value; } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public int MaxConnectionsPerServer { get => _underlyingHandler.MaxConnectionsPerServer; @@ -202,7 +202,7 @@ public long MaxRequestContentBufferSize } } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public int MaxResponseHeadersLength { get => _underlyingHandler.MaxResponseHeadersLength; @@ -242,7 +242,7 @@ public ClientCertificateOption ClientCertificateOptions } } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public X509CertificateCollection ClientCertificates { get @@ -257,7 +257,7 @@ public X509CertificateCollection ClientCertificates } } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public Func? ServerCertificateCustomValidationCallback { #if TARGET_BROWSER @@ -275,7 +275,7 @@ public X509CertificateCollection ClientCertificates #endif } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public bool CheckCertificateRevocationList { get => _underlyingHandler.SslOptions.CertificateRevocationCheckMode == X509RevocationMode.Online; @@ -286,7 +286,7 @@ public bool CheckCertificateRevocationList } } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public SslProtocols SslProtocols { get => _underlyingHandler.SslOptions.EnabledSslProtocols; @@ -304,7 +304,7 @@ public SslProtocols SslProtocols // API compat will fail until this is fixed // //[UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] //[UnsupportedOSPlatform("ios")] //[UnsupportedOSPlatform("tvos")] protected internal override HttpResponseMessage Send(HttpRequestMessage request, CancellationToken cancellationToken) => @@ -315,7 +315,7 @@ protected internal override Task SendAsync(HttpRequestMessa // lazy-load the validator func so it can be trimmed by the ILLinker if it isn't used. private static Func? s_dangerousAcceptAnyServerCertificateValidator; - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public static Func DangerousAcceptAnyServerCertificateValidator => Volatile.Read(ref s_dangerousAcceptAnyServerCertificateValidator) ?? Interlocked.CompareExchange(ref s_dangerousAcceptAnyServerCertificateValidator, delegate { return true; }, null) ?? 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 3553e0890552a..5eb4facf6ff65 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 @@ -13,7 +13,7 @@ namespace System.Net.Http { - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public sealed class SocketsHttpHandler : HttpMessageHandler { private readonly HttpConnectionSettings _settings = new HttpConnectionSettings(); @@ -33,8 +33,8 @@ 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(); + [UnsupportedOSPlatformGuard("browser"), UnsupportedOSPlatformGuard("wasi")] + public static bool IsSupported => !OperatingSystem.IsBrowser() && !OperatingSystem.IsOSPlatform("Wasi"); public bool UseCookies { diff --git a/src/libraries/System.Net.HttpListener/Directory.Build.props b/src/libraries/System.Net.HttpListener/Directory.Build.props index c843a6347ce61..3a3d8f9832479 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/ref/System.Net.Mail.cs b/src/libraries/System.Net.Mail/ref/System.Net.Mail.cs index 6c91e785def67..8c6c5ced5d42c 100644 --- a/src/libraries/System.Net.Mail/ref/System.Net.Mail.cs +++ b/src/libraries/System.Net.Mail/ref/System.Net.Mail.cs @@ -165,7 +165,7 @@ public enum MailPriority High = 2, } public delegate void SendCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e); - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public partial class SmtpClient : System.IDisposable { public SmtpClient() { } 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 5d2ce4cc28099..61e9001c00834 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 @@  true - $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-Browser;$(NetCoreAppCurrent) + $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-Browser;$(NetCoreAppCurrent)-wasi;$(NetCoreAppCurrent) @@ -78,12 +78,12 @@ Link="Common\System\HexConverter.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.Browser.cs index 0266f161b4546..4ce88790e11cc 100644 --- a/src/libraries/System.Net.Mail/src/System/Net/Mail/SmtpClient.Browser.cs +++ b/src/libraries/System.Net.Mail/src/System/Net/Mail/SmtpClient.Browser.cs @@ -27,7 +27,7 @@ public enum SmtpDeliveryFormat International = 1, // SMTPUTF8 - Email Address Internationalization (EAI) } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public class SmtpClient : IDisposable { #pragma warning disable CS0067 // Field is not used diff --git a/src/libraries/System.Net.Mail/src/System/Net/Mail/SmtpClient.cs b/src/libraries/System.Net.Mail/src/System/Net/Mail/SmtpClient.cs index d323c244dda87..9bcb1bd6520ab 100644 --- a/src/libraries/System.Net.Mail/src/System/Net/Mail/SmtpClient.cs +++ b/src/libraries/System.Net.Mail/src/System/Net/Mail/SmtpClient.cs @@ -32,7 +32,7 @@ public enum SmtpDeliveryFormat International = 1, // SMTPUTF8 - Email Address Internationalization (EAI) } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public class SmtpClient : IDisposable { private string? _host; diff --git a/src/libraries/System.Net.NameResolution/Directory.Build.props b/src/libraries/System.Net.NameResolution/Directory.Build.props index ce244cbea5619..58979d42f0695 100644 --- a/src/libraries/System.Net.NameResolution/Directory.Build.props +++ b/src/libraries/System.Net.NameResolution/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.NameResolution/src/System.Net.NameResolution.csproj b/src/libraries/System.Net.NameResolution/src/System.Net.NameResolution.csproj index 6d7ee08de0bc5..ae1e6fd7053e1 100644 --- a/src/libraries/System.Net.NameResolution/src/System.Net.NameResolution.csproj +++ b/src/libraries/System.Net.NameResolution/src/System.Net.NameResolution.csproj @@ -1,13 +1,13 @@ true - $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-Browser;$(NetCoreAppCurrent) + $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-Browser;$(NetCoreAppCurrent)-wasi;$(NetCoreAppCurrent) $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) - SR.SystemNetNameResolution_PlatformNotSupported - ExcludeApiList.PNSE.Browser.txt + SR.SystemNetNameResolution_PlatformNotSupported + ExcludeApiList.PNSE.Browser.txt @@ -100,7 +100,7 @@ - + diff --git a/src/libraries/System.Net.NetworkInformation/Directory.Build.props b/src/libraries/System.Net.NetworkInformation/Directory.Build.props index ce244cbea5619..58979d42f0695 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 ce244cbea5619..58979d42f0695 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.Primitives/src/CompatibilitySuppressions.xml b/src/libraries/System.Net.Primitives/src/CompatibilitySuppressions.xml index b359c8b66a64f..cba3412551413 100644 --- a/src/libraries/System.Net.Primitives/src/CompatibilitySuppressions.xml +++ b/src/libraries/System.Net.Primitives/src/CompatibilitySuppressions.xml @@ -13,6 +13,18 @@ ref/net7.0/System.Net.Primitives.dll runtimes/browser/lib/net7.0/System.Net.Primitives.dll + + CP0001 + T:System.Net.CookieVariant + ref/net7.0/System.Net.Primitives.dll + runtimes/wasi/lib/net7.0/System.Net.Primitives.dll + + + CP0001 + T:System.Net.PathList + ref/net7.0/System.Net.Primitives.dll + runtimes/wasi/lib/net7.0/System.Net.Primitives.dll + CP0001 T:System.Net.CookieVariant diff --git a/src/libraries/System.Net.Primitives/src/System.Net.Primitives.csproj b/src/libraries/System.Net.Primitives/src/System.Net.Primitives.csproj index b77d6366c7a96..c61e34eda1485 100644 --- a/src/libraries/System.Net.Primitives/src/System.Net.Primitives.csproj +++ b/src/libraries/System.Net.Primitives/src/System.Net.Primitives.csproj @@ -2,7 +2,7 @@ true false - $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-Browser;$(NetCoreAppCurrent) + $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-Browser;$(NetCoreAppCurrent)-wasi;$(NetCoreAppCurrent) $(DefineConstants);SYSTEM_NET_PRIMITIVES_DLL @@ -113,7 +113,7 @@ - + @@ -144,7 +144,7 @@ - + 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 ce244cbea5619..58979d42f0695 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.ServicePoint/ref/System.Net.ServicePoint.cs b/src/libraries/System.Net.ServicePoint/ref/System.Net.ServicePoint.cs index a8282e9d3cc24..454eb446ac9eb 100644 --- a/src/libraries/System.Net.ServicePoint/ref/System.Net.ServicePoint.cs +++ b/src/libraries/System.Net.ServicePoint/ref/System.Net.ServicePoint.cs @@ -48,7 +48,7 @@ internal ServicePointManager() { } public static int DefaultConnectionLimit { get { throw null; } set { } } public static int DnsRefreshTimeout { get { throw null; } set { } } public static bool EnableDnsRoundRobin { get { throw null; } set { } } - [System.Runtime.Versioning.UnsupportedOSPlatform("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatform("browser"), System.Runtime.Versioning.UnsupportedOSPlatform("wasi")] public static System.Net.Security.EncryptionPolicy EncryptionPolicy { get { throw null; } } public static bool Expect100Continue { get { throw null; } set { } } public static int MaxServicePointIdleTime { get { throw null; } set { } } diff --git a/src/libraries/System.Net.ServicePoint/src/System/Net/ServicePointManager.cs b/src/libraries/System.Net.ServicePoint/src/System/Net/ServicePointManager.cs index 1013bbcd4d2f2..b83365505bb4e 100644 --- a/src/libraries/System.Net.ServicePoint/src/System/Net/ServicePointManager.cs +++ b/src/libraries/System.Net.ServicePoint/src/System/Net/ServicePointManager.cs @@ -103,7 +103,7 @@ public static int DnsRefreshTimeout public static bool CheckCertificateRevocationList { get; set; } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public static EncryptionPolicy EncryptionPolicy { get; } = EncryptionPolicy.RequireEncryption; [Obsolete(Obsoletions.WebRequestMessage, DiagnosticId = Obsoletions.WebRequestDiagId, UrlFormat = Obsoletions.SharedUrlFormat)] diff --git a/src/libraries/System.Net.Sockets/Directory.Build.props b/src/libraries/System.Net.Sockets/Directory.Build.props index ce244cbea5619..58979d42f0695 100644 --- a/src/libraries/System.Net.Sockets/Directory.Build.props +++ b/src/libraries/System.Net.Sockets/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.WebClient/Directory.Build.props b/src/libraries/System.Net.WebClient/Directory.Build.props index c843a6347ce61..3a3d8f9832479 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.WebClient/src/System.Net.WebClient.csproj b/src/libraries/System.Net.WebClient/src/System.Net.WebClient.csproj index fdbfd8f017d68..3b0b9533cf661 100644 --- a/src/libraries/System.Net.WebClient/src/System.Net.WebClient.csproj +++ b/src/libraries/System.Net.WebClient/src/System.Net.WebClient.csproj @@ -1,13 +1,13 @@ true - $(NetCoreAppCurrent);$(NetCoreAppCurrent)-Browser + $(NetCoreAppCurrent);$(NetCoreAppCurrent)-Browser;$(NetCoreAppCurrent)-wasi $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) - SR.SystemNetWebClient_PlatformNotSupported + SR.SystemNetWebClient_PlatformNotSupported - + 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 fbe0e197d113c..1a6e5df4e90f6 100644 --- a/src/libraries/System.Net.WebProxy/src/System.Net.WebProxy.csproj +++ b/src/libraries/System.Net.WebProxy/src/System.Net.WebProxy.csproj @@ -1,13 +1,14 @@ true - $(NetCoreAppCurrent);$(NetCoreAppCurrent)-Browser + $(NetCoreAppCurrent);$(NetCoreAppCurrent)-Browser;$(NetCoreAppCurrent)-wasi + $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) - - + + diff --git a/src/libraries/System.Net.WebSockets.Client/ref/System.Net.WebSockets.Client.cs b/src/libraries/System.Net.WebSockets.Client/ref/System.Net.WebSockets.Client.cs index d7b7a97d72495..bd6a2e6c8ab56 100644 --- a/src/libraries/System.Net.WebSockets.Client/ref/System.Net.WebSockets.Client.cs +++ b/src/libraries/System.Net.WebSockets.Client/ref/System.Net.WebSockets.Client.cs @@ -30,32 +30,32 @@ public override void Dispose() { } public sealed partial class ClientWebSocketOptions { internal ClientWebSocketOptions() { } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public System.Security.Cryptography.X509Certificates.X509CertificateCollection ClientCertificates { get { throw null; } set { } } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public System.Net.CookieContainer? Cookies { get { throw null; } set { } } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public bool CollectHttpResponseDetails { get { throw null; } set { } } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public System.Net.ICredentials? Credentials { get { throw null; } set { } } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public System.TimeSpan KeepAliveInterval { get { throw null; } set { } } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public System.Net.WebSockets.WebSocketDeflateOptions? DangerousDeflateOptions { get { throw null; } set { } } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public System.Net.IWebProxy? Proxy { get { throw null; } set { } } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public System.Net.Security.RemoteCertificateValidationCallback? RemoteCertificateValidationCallback { get { throw null; } set { } } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public bool UseDefaultCredentials { get { throw null; } set { } } - public System.Version HttpVersion { get { throw null; } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] set { } } - public System.Net.Http.HttpVersionPolicy HttpVersionPolicy { get { throw null; } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] set { } } + public System.Version HttpVersion { get { throw null; } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] set { } } + public System.Net.Http.HttpVersionPolicy HttpVersionPolicy { get { throw null; } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] set { } } public void AddSubProtocol(string subProtocol) { } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public void SetBuffer(int receiveBufferSize, int sendBufferSize) { } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public void SetBuffer(int receiveBufferSize, int sendBufferSize, System.ArraySegment buffer) { } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public void SetRequestHeader(string headerName, string? headerValue) { } } } 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 b7da9d3e90bec..a078ac5e1725c 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 @@ -1,7 +1,10 @@ True - $(NetCoreAppCurrent);$(NetCoreAppCurrent)-Browser + $(NetCoreAppCurrent);$(NetCoreAppCurrent)-Browser;$(NetCoreAppCurrent)-wasi + $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) + wasi + $(NoWarn);CA1418;CA1416 $(DefineConstants);TARGET_BROWSER diff --git a/src/libraries/System.Net.WebSockets.Client/src/System/Net/WebSockets/BrowserWebSockets/ClientWebSocketOptions.cs b/src/libraries/System.Net.WebSockets.Client/src/System/Net/WebSockets/BrowserWebSockets/ClientWebSocketOptions.cs index 59096fc864d3a..0a2c9f18d5e05 100644 --- a/src/libraries/System.Net.WebSockets.Client/src/System/Net/WebSockets/BrowserWebSockets/ClientWebSocketOptions.cs +++ b/src/libraries/System.Net.WebSockets.Client/src/System/Net/WebSockets/BrowserWebSockets/ClientWebSocketOptions.cs @@ -19,14 +19,14 @@ internal ClientWebSocketOptions() #region HTTP Settings - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] // Note that some headers are restricted like Host. public void SetRequestHeader(string headerName, string headerValue) { throw new PlatformNotSupportedException(); } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public bool UseDefaultCredentials { get => throw new PlatformNotSupportedException(); @@ -36,53 +36,53 @@ public bool UseDefaultCredentials public Version HttpVersion { get => Net.HttpVersion.Version11; - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] set => throw new PlatformNotSupportedException(); } public System.Net.Http.HttpVersionPolicy HttpVersionPolicy { get => HttpVersionPolicy.RequestVersionOrLower; - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] set => throw new PlatformNotSupportedException(); } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public System.Net.ICredentials Credentials { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public System.Net.IWebProxy Proxy { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public X509CertificateCollection ClientCertificates { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public System.Net.Security.RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public System.Net.CookieContainer Cookies { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public bool CollectHttpResponseDetails { get => throw new PlatformNotSupportedException(); @@ -115,27 +115,27 @@ public void AddSubProtocol(string subProtocol) internal List RequestedSubProtocols => _requestedSubProtocols ??= new List(); - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public TimeSpan KeepAliveInterval { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public WebSocketDeflateOptions? DangerousDeflateOptions { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public void SetBuffer(int receiveBufferSize, int sendBufferSize) { throw new PlatformNotSupportedException(); } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public void SetBuffer(int receiveBufferSize, int sendBufferSize, ArraySegment buffer) { throw new PlatformNotSupportedException(); diff --git a/src/libraries/System.Net.WebSockets.Client/src/System/Net/WebSockets/ClientWebSocketOptions.cs b/src/libraries/System.Net.WebSockets.Client/src/System/Net/WebSockets/ClientWebSocketOptions.cs index f5d51871981bc..d5435173609b3 100644 --- a/src/libraries/System.Net.WebSockets.Client/src/System/Net/WebSockets/ClientWebSocketOptions.cs +++ b/src/libraries/System.Net.WebSockets.Client/src/System/Net/WebSockets/ClientWebSocketOptions.cs @@ -47,7 +47,7 @@ internal ClientWebSocketOptions() { } // prevent external instantiation public Version HttpVersion { get => _version; - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] set { ThrowIfReadOnly(); @@ -61,7 +61,7 @@ public Version HttpVersion public HttpVersionPolicy HttpVersionPolicy { get => _versionPolicy; - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] set { ThrowIfReadOnly(); @@ -69,7 +69,7 @@ public HttpVersionPolicy HttpVersionPolicy } } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] // Note that some headers are restricted like Host. public void SetRequestHeader(string headerName, string? headerValue) { @@ -83,7 +83,7 @@ public void SetRequestHeader(string headerName, string? headerValue) internal List RequestedSubProtocols => _requestedSubProtocols ??= new List(); - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public bool UseDefaultCredentials { get => _useDefaultCredentials; @@ -94,7 +94,7 @@ public bool UseDefaultCredentials } } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public ICredentials? Credentials { get => _credentials; @@ -105,7 +105,7 @@ public ICredentials? Credentials } } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public IWebProxy? Proxy { get => _proxy; @@ -116,7 +116,7 @@ public IWebProxy? Proxy } } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public X509CertificateCollection ClientCertificates { get => _clientCertificates ??= new X509CertificateCollection(); @@ -128,7 +128,7 @@ public X509CertificateCollection ClientCertificates } } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public RemoteCertificateValidationCallback? RemoteCertificateValidationCallback { get => _remoteCertificateValidationCallback; @@ -139,7 +139,7 @@ public RemoteCertificateValidationCallback? RemoteCertificateValidationCallback } } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public CookieContainer? Cookies { get => _cookies; @@ -171,7 +171,7 @@ public void AddSubProtocol(string subProtocol) subprotocols.Add(subProtocol); } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public TimeSpan KeepAliveInterval { get => _keepAliveInterval; @@ -197,13 +197,13 @@ public TimeSpan KeepAliveInterval /// It is strongly advised to turn off compression when sending data containing secrets by /// specifying flag for such messages. /// - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public WebSocketDeflateOptions? DangerousDeflateOptions { get; set; } internal int ReceiveBufferSize => _receiveBufferSize; internal ArraySegment? Buffer => _buffer; - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public void SetBuffer(int receiveBufferSize, int sendBufferSize) { ThrowIfReadOnly(); @@ -221,7 +221,7 @@ public void SetBuffer(int receiveBufferSize, int sendBufferSize) _buffer = null; } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public void SetBuffer(int receiveBufferSize, int sendBufferSize, ArraySegment buffer) { ThrowIfReadOnly(); @@ -248,7 +248,7 @@ public void SetBuffer(int receiveBufferSize, int sendBufferSize, ArraySegment /// Indicates whether and should be set when establishing the connection. /// - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public bool CollectHttpResponseDetails { get => _collectHttpResponseDetails; diff --git a/src/libraries/System.Net.WebSockets.Client/src/System/Net/WebSockets/WebSocketHandle.Managed.cs b/src/libraries/System.Net.WebSockets.Client/src/System/Net/WebSockets/WebSocketHandle.Managed.cs index 962fe93322e0e..a9770b6a772d7 100644 --- a/src/libraries/System.Net.WebSockets.Client/src/System/Net/WebSockets/WebSocketHandle.Managed.cs +++ b/src/libraries/System.Net.WebSockets.Client/src/System/Net/WebSockets/WebSocketHandle.Managed.cs @@ -280,8 +280,9 @@ private static HttpMessageInvoker SetupInvoker(ClientWebSocketOptions options, o handler.PooledConnectionLifetime = TimeSpan.Zero; handler.CookieContainer = options.Cookies; handler.UseCookies = options.Cookies != null; +#if !TARGET_WASI handler.SslOptions.RemoteCertificateValidationCallback = options.RemoteCertificateValidationCallback; - +#endif handler.Credentials = options.UseDefaultCredentials ? CredentialCache.DefaultCredentials : options.Credentials; @@ -297,9 +298,11 @@ private static HttpMessageInvoker SetupInvoker(ClientWebSocketOptions options, o if (options._clientCertificates?.Count > 0) // use field to avoid lazily initializing the collection { +#if !TARGET_WASI Debug.Assert(handler.SslOptions.ClientCertificates == null); handler.SslOptions.ClientCertificates = new X509Certificate2Collection(); handler.SslOptions.ClientCertificates.AddRange(options.ClientCertificates); +#endif } return new HttpMessageInvoker(handler); diff --git a/src/libraries/System.Net.WebSockets/src/System.Net.WebSockets.csproj b/src/libraries/System.Net.WebSockets/src/System.Net.WebSockets.csproj index c0c4ded0d332a..4133f2e95950c 100644 --- a/src/libraries/System.Net.WebSockets/src/System.Net.WebSockets.csproj +++ b/src/libraries/System.Net.WebSockets/src/System.Net.WebSockets.csproj @@ -1,7 +1,7 @@ True - $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-Browser;$(NetCoreAppCurrent) + $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-Browser;$(NetCoreAppCurrent)-wasi;$(NetCoreAppCurrent) @@ -40,7 +40,7 @@ Link="Common\Interop\Windows\Interop.Libraries.cs" /> - + diff --git a/src/libraries/System.Private.CoreLib/src/Internal/Runtime/InteropServices/ComponentActivator.cs b/src/libraries/System.Private.CoreLib/src/Internal/Runtime/InteropServices/ComponentActivator.cs index 12961f17bdb63..6d17c5e86444a 100644 --- a/src/libraries/System.Private.CoreLib/src/Internal/Runtime/InteropServices/ComponentActivator.cs +++ b/src/libraries/System.Private.CoreLib/src/Internal/Runtime/InteropServices/ComponentActivator.cs @@ -17,7 +17,7 @@ internal static partial class ComponentActivator private const string NativeAOTIncompatibleWarningMessage = "The native code for the method requested might not be available at runtime."; [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("maccatalyst")] [UnsupportedOSPlatform("tvos")] @@ -53,7 +53,7 @@ private static string MarshalToString(IntPtr arg, string argName) [RequiresDynamicCode(NativeAOTIncompatibleWarningMessage)] [RequiresUnreferencedCode(TrimIncompatibleWarningMessage, Url = "https://aka.ms/dotnet-illink/nativehost")] [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("maccatalyst")] [UnsupportedOSPlatform("tvos")] @@ -167,7 +167,7 @@ public static unsafe int GetFunctionPointer(IntPtr typeNameNative, [RequiresUnreferencedCode(TrimIncompatibleWarningMessage, Url = "https://aka.ms/dotnet-illink/nativehost")] [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] private static IsolatedComponentLoadContext GetIsolatedComponentLoadContext(string assemblyPath) diff --git a/src/libraries/System.Private.CoreLib/src/Internal/Runtime/InteropServices/IsolatedComponentLoadContext.cs b/src/libraries/System.Private.CoreLib/src/Internal/Runtime/InteropServices/IsolatedComponentLoadContext.cs index 94ed1f4441ba8..0e5e12877f168 100644 --- a/src/libraries/System.Private.CoreLib/src/Internal/Runtime/InteropServices/IsolatedComponentLoadContext.cs +++ b/src/libraries/System.Private.CoreLib/src/Internal/Runtime/InteropServices/IsolatedComponentLoadContext.cs @@ -15,7 +15,7 @@ namespace Internal.Runtime.InteropServices /// dependencies within the ALC and not pollute the default ALC. /// [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("maccatalyst")] [UnsupportedOSPlatform("tvos")] 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 fb5c8faad4688..a4894c29624a6 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.IsOSPlatform("Wasi") // #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.Private.CoreLib.Shared.projitems b/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems index 8a9f56346a92d..45c9aa98333a1 100644 --- a/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems +++ b/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems @@ -12,7 +12,7 @@ enable true true - true + true true true true @@ -20,7 +20,7 @@ $(MSBuildThisFileDirectory)ILLink\ true true - true + true $(DefineConstants);BIGENDIAN @@ -2039,7 +2039,7 @@ - + Common\Interop\Unix\Interop.Errors.cs @@ -2289,7 +2289,7 @@ - + @@ -2298,7 +2298,7 @@ - + @@ -2332,7 +2332,7 @@ - + @@ -2436,7 +2436,7 @@ - + @@ -2449,11 +2449,11 @@ - + - + @@ -2471,7 +2471,7 @@ - + diff --git a/src/libraries/System.Private.CoreLib/src/System/AppContext.AnyOS.cs b/src/libraries/System.Private.CoreLib/src/System/AppContext.AnyOS.cs index 2dc7015dda0a3..b2c83e67dd453 100644 --- a/src/libraries/System.Private.CoreLib/src/System/AppContext.AnyOS.cs +++ b/src/libraries/System.Private.CoreLib/src/System/AppContext.AnyOS.cs @@ -12,7 +12,7 @@ namespace System { public static partial class AppContext { -#if !TARGET_BROWSER +#if !TARGET_BROWSER && !TARGET_WASI [UnconditionalSuppressMessage("SingleFile", "IL3000: Avoid accessing Assembly file path when publishing as a single file", Justification = "Single File apps should always set APP_CONTEXT_BASE_DIRECTORY therefore code handles Assembly.Location equals null")] private static string GetBaseDirectoryCore() diff --git a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/CounterGroup.cs b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/CounterGroup.cs index 703738efbc3c9..7c1209091bb0e 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/CounterGroup.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/CounterGroup.cs @@ -9,7 +9,7 @@ namespace System.Diagnostics.Tracing { #if !ES_BUILD_STANDALONE #if !FEATURE_WASM_PERFTRACING - [System.Runtime.Versioning.UnsupportedOSPlatform("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatform("browser"), System.Runtime.Versioning.UnsupportedOSPlatform("wasi")] #endif #endif internal sealed class CounterGroup diff --git a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/DiagnosticCounter.cs b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/DiagnosticCounter.cs index 3bbb7eca48f68..ab62eaf6cab81 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/DiagnosticCounter.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/DiagnosticCounter.cs @@ -14,7 +14,7 @@ namespace System.Diagnostics.Tracing /// #if !ES_BUILD_STANDALONE #if !FEATURE_WASM_PERFTRACING - [System.Runtime.Versioning.UnsupportedOSPlatform("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatform("browser"), System.Runtime.Versioning.UnsupportedOSPlatform("wasi")] #endif #endif public abstract class DiagnosticCounter : IDisposable diff --git a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventCounter.cs b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventCounter.cs index a2fa85a262be4..edf4897a6a627 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventCounter.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventCounter.cs @@ -18,7 +18,7 @@ namespace System.Diagnostics.Tracing /// #if !ES_BUILD_STANDALONE #if !FEATURE_WASM_PERFTRACING - [System.Runtime.Versioning.UnsupportedOSPlatform("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatform("browser"), System.Runtime.Versioning.UnsupportedOSPlatform("wasi")] #endif #endif public partial class EventCounter : DiagnosticCounter diff --git a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs index 14186011ecef7..c8fcd9e9b3079 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs @@ -1327,12 +1327,12 @@ protected unsafe void WriteEventWithRelatedActivityIdCore(int eventId, Guid* rel if (m_Dispatchers != null && metadata.EnabledForAnyListener) { -#if MONO && !TARGET_BROWSER +#if MONO && !TARGET_BROWSER && !TARGET_WASI // On Mono, managed events from NativeRuntimeEventSource are written using WriteEventCore which can be // written doubly because EventPipe tries to pump it back up to EventListener via NativeRuntimeEventSource.ProcessEvents. // So we need to prevent this from getting written directly to the Listeners. if (this.GetType() != typeof(NativeRuntimeEventSource)) -#endif // MONO && !TARGET_BROWSER +#endif // MONO && !TARGET_BROWSER && !TARGET_WASI { var eventCallbackArgs = new EventWrittenEventArgs(this, eventId, pActivityId, relatedActivityId); WriteToAllListeners(eventCallbackArgs, eventDataCount, data); diff --git a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/IncrementingEventCounter.cs b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/IncrementingEventCounter.cs index 3779b2639b8d6..952f60e6918a8 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/IncrementingEventCounter.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/IncrementingEventCounter.cs @@ -14,7 +14,7 @@ namespace System.Diagnostics.Tracing /// #if !ES_BUILD_STANDALONE #if !FEATURE_WASM_PERFTRACING - [System.Runtime.Versioning.UnsupportedOSPlatform("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatform("browser"), System.Runtime.Versioning.UnsupportedOSPlatform("wasi")] #endif #endif public partial class IncrementingEventCounter : DiagnosticCounter diff --git a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/IncrementingPollingCounter.cs b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/IncrementingPollingCounter.cs index bc952cec2a2ad..ffdfe314d0732 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/IncrementingPollingCounter.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/IncrementingPollingCounter.cs @@ -16,7 +16,7 @@ namespace System.Diagnostics.Tracing /// #if !ES_BUILD_STANDALONE #if !FEATURE_WASM_PERFTRACING - [System.Runtime.Versioning.UnsupportedOSPlatform("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatform("browser"), System.Runtime.Versioning.UnsupportedOSPlatform("wasi")] #endif #endif public partial class IncrementingPollingCounter : DiagnosticCounter diff --git a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/PollingCounter.cs b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/PollingCounter.cs index 450f47abca640..95e5c9d161a26 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/PollingCounter.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/PollingCounter.cs @@ -15,7 +15,7 @@ namespace System.Diagnostics.Tracing /// #if !ES_BUILD_STANDALONE #if !FEATURE_WASM_PERFTRACING - [System.Runtime.Versioning.UnsupportedOSPlatform("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatform("browser"), System.Runtime.Versioning.UnsupportedOSPlatform("wasi")] #endif #endif public partial class PollingCounter : DiagnosticCounter 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 46850d3d090df..5bafbba00838e 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 @@ -36,7 +36,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.IsOSPlatform("Wasi") || 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 cfe698fabcd98..c2b99f7dfd72d 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 @@ -101,7 +101,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.IsOSPlatform("Wasi")) && (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/Guid.Unix.cs b/src/libraries/System.Private.CoreLib/src/System/Guid.Unix.cs index 9455ff312b307..a5757bc599a18 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Guid.Unix.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Guid.Unix.cs @@ -12,10 +12,15 @@ public static unsafe Guid NewGuid() { Guid g; +#if !TARGET_WASI // Guid.NewGuid is often used as a cheap source of random data that are sometimes used for security purposes. // Windows implementation uses secure RNG to implement it. We use secure RNG for Unix too to avoid subtle security // vulnerabilities in applications that depend on it. See https://github.com/dotnet/runtime/issues/42752 for details. Interop.GetCryptographicallySecureRandomBytes((byte*)&g, sizeof(Guid)); +#else + // TODOWASI: crypto secure random bytes + Interop.GetRandomBytes((byte*)&g, sizeof(Guid)); +#endif const ushort VersionMask = 0xF000; const ushort RandomGuidVersion = 0x4000; diff --git a/src/libraries/System.Private.CoreLib/src/System/IO/FileStatus.Unix.cs b/src/libraries/System.Private.CoreLib/src/System/IO/FileStatus.Unix.cs index fe14a0aa99a19..f6342bd32250b 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IO/FileStatus.Unix.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IO/FileStatus.Unix.cs @@ -57,7 +57,7 @@ private bool HasReadOnlyFlag return false; } -#if TARGET_BROWSER +#if TARGET_BROWSER || TARGET_WASI var mode = ((UnixFileMode)_fileCache.Mode & FileSystem.ValidUnixFileModes); bool isUserReadOnly = (mode & UnixFileMode.UserRead) != 0 && // has read permission (mode & UnixFileMode.UserWrite) == 0; // but not write permission @@ -81,7 +81,7 @@ private bool HasReadOnlyFlag } } -#if !TARGET_BROWSER +#if !TARGET_BROWSER && !TARGET_WASI // HasReadOnlyFlag cache. // Must only be used after calling EnsureCachesInitialized. private int _isReadOnlyCache; @@ -394,7 +394,7 @@ private unsafe void SetAccessOrWriteTimeCore(SafeFileHandle? handle, string? pat long seconds = time.ToUnixTimeSeconds(); long nanoseconds = UnixTimeSecondsToNanoseconds(time, seconds); -#if TARGET_BROWSER +#if TARGET_BROWSER && !TARGET_WASI buf[0].TvSec = seconds; buf[0].TvNsec = nanoseconds; buf[1].TvSec = seconds; @@ -499,7 +499,7 @@ internal void RefreshCaches(SafeFileHandle? handle, ReadOnlySpan path) { Debug.Assert(handle is not null || path.Length > 0); -#if !TARGET_BROWSER +#if !TARGET_BROWSER && !TARGET_WASI _isReadOnlyCache = -1; #endif int rv = handle is not null ? diff --git a/src/libraries/System.Private.CoreLib/src/System/IO/FileSystem.Unix.cs b/src/libraries/System.Private.CoreLib/src/System/IO/FileSystem.Unix.cs index f28cd70f08f83..fef892e1874aa 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IO/FileSystem.Unix.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IO/FileSystem.Unix.cs @@ -395,7 +395,7 @@ private static void MoveDirectory(string sourceFullPath, string destFullPath, bo // When the path ends with a directory separator, it must not be a file. // On Unix 'rename' fails with ENOTDIR, on wasm we need to manually check. - if (OperatingSystem.IsBrowser() && Path.EndsInDirectorySeparator(sourceFullPath) && FileExists(sourceFullPath)) + if ((OperatingSystem.IsBrowser() || OperatingSystem.IsOSPlatform("Wasi")) && Path.EndsInDirectorySeparator(sourceFullPath) && FileExists(sourceFullPath)) { throw new IOException(SR.Format(SR.IO_PathNotFound_Path, sourceFullPath)); } diff --git a/src/libraries/System.Private.CoreLib/src/System/Reflection/Assembly.cs b/src/libraries/System.Private.CoreLib/src/System/Reflection/Assembly.cs index f6445df9671b8..00095ffb7f48b 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Reflection/Assembly.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Reflection/Assembly.cs @@ -265,10 +265,10 @@ public static Assembly LoadFile(string path) return result; // we cannot check for file presence on BROWSER. The files could be embedded and not physically present. -#if !TARGET_BROWSER +#if !TARGET_BROWSER && !TARGET_WASI if (!File.Exists(normalizedPath)) throw new FileNotFoundException(SR.Format(SR.FileNotFound_LoadFile, normalizedPath), normalizedPath); -#endif // !TARGET_BROWSER +#endif // !TARGET_BROWSER && !TARGET_WASI AssemblyLoadContext alc = new IndividualAssemblyLoadContext($"Assembly.LoadFile({normalizedPath})"); result = alc.LoadFromAssemblyPath(normalizedPath); diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/ComWrappers.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/ComWrappers.cs index 08769a6ab32fd..ac07ad1042a33 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/ComWrappers.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/ComWrappers.cs @@ -70,7 +70,7 @@ public enum CreateObjectFlags /// Class for managing wrappers of COM IUnknown types. /// [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] [CLSCompliant(false)] diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/PosixSignalRegistration.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/PosixSignalRegistration.cs index 6cec67330022e..037a6a9e84ddf 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/PosixSignalRegistration.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/PosixSignalRegistration.cs @@ -31,7 +31,7 @@ public sealed partial class PosixSignalRegistration : IDisposable /// On Unix, terminal configuration can be canceled for and . /// [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] public static PosixSignalRegistration Create(PosixSignal signal, Action handler) diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Loader/AssemblyDependencyResolver.PlatformNotSupported.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Loader/AssemblyDependencyResolver.PlatformNotSupported.cs index 5f0597bf337be..dea6aad724143 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Loader/AssemblyDependencyResolver.PlatformNotSupported.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Loader/AssemblyDependencyResolver.PlatformNotSupported.cs @@ -7,7 +7,7 @@ namespace System.Runtime.Loader { [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] public sealed class AssemblyDependencyResolver diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Loader/AssemblyDependencyResolver.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Loader/AssemblyDependencyResolver.cs index 6e523ab9a2e4b..46ae82c8b2bf8 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Loader/AssemblyDependencyResolver.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Loader/AssemblyDependencyResolver.cs @@ -11,7 +11,7 @@ namespace System.Runtime.Loader { [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] public sealed class AssemblyDependencyResolver diff --git a/src/libraries/System.Private.CoreLib/src/System/Text/NormalizationForm.cs b/src/libraries/System.Private.CoreLib/src/System/Text/NormalizationForm.cs index 3254499051a15..d5913bdce2508 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Text/NormalizationForm.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Text/NormalizationForm.cs @@ -9,9 +9,9 @@ public enum NormalizationForm { FormC = 1, FormD = 2, - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] FormKC = 5, - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] FormKD = 6 } } diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/EventWaitHandle.Windows.cs b/src/libraries/System.Private.CoreLib/src/System/Threading/EventWaitHandle.Windows.cs index 95750074698b0..bc41f1bde322e 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Threading/EventWaitHandle.Windows.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Threading/EventWaitHandle.Windows.cs @@ -18,7 +18,7 @@ private EventWaitHandle(SafeWaitHandle handle) private void CreateEventCore(bool initialState, EventResetMode mode, string? name, out bool createdNew) { -#if TARGET_UNIX || TARGET_BROWSER +#if TARGET_UNIX || TARGET_BROWSER || TARGET_WASI if (name != null) throw new PlatformNotSupportedException(SR.PlatformNotSupported_NamedSynchronizationPrimitives); #endif 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 cdcfe33ee97ac..1193bae1a97b6 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Threading/ManualResetEventSlim.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Threading/ManualResetEventSlim.cs @@ -353,7 +353,7 @@ public void Reset() /// The caller of this method blocks indefinitely until the current instance is set. The caller will /// return immediately if the event is currently in a set state. /// - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public void Wait() { Wait(Timeout.Infinite, CancellationToken.None); @@ -374,7 +374,7 @@ public void Wait() /// The caller of this method blocks indefinitely until the current instance is set. The caller will /// return immediately if the event is currently in a set state. /// - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public void Wait(CancellationToken cancellationToken) { Wait(Timeout.Infinite, cancellationToken); @@ -395,7 +395,7 @@ public void Wait(CancellationToken cancellationToken) /// /// The maximum number of waiters has been exceeded. /// - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public bool Wait(TimeSpan timeout) { long totalMilliseconds = (long)timeout.TotalMilliseconds; @@ -427,7 +427,7 @@ public bool Wait(TimeSpan timeout) /// /// The maximum number of waiters has been exceeded. /// - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public bool Wait(TimeSpan timeout, CancellationToken cancellationToken) { long totalMilliseconds = (long)timeout.TotalMilliseconds; @@ -452,7 +452,7 @@ public bool Wait(TimeSpan timeout, CancellationToken cancellationToken) /// /// The maximum number of waiters has been exceeded. /// - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public bool Wait(int millisecondsTimeout) { return Wait(millisecondsTimeout, CancellationToken.None); @@ -476,7 +476,7 @@ public bool Wait(int millisecondsTimeout) /// /// was canceled. - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public bool Wait(int millisecondsTimeout, CancellationToken cancellationToken) { ThrowIfDisposed(); diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/Monitor.cs b/src/libraries/System.Private.CoreLib/src/System/Threading/Monitor.cs index 7354bd9d12aa6..559edc81d6b6b 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Threading/Monitor.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Threading/Monitor.cs @@ -13,19 +13,19 @@ public static bool TryEnter(object obj, TimeSpan timeout) public static void TryEnter(object obj, TimeSpan timeout, ref bool lockTaken) => TryEnter(obj, WaitHandle.ToTimeoutMilliseconds(timeout), ref lockTaken); - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public static bool Wait(object obj, TimeSpan timeout) => Wait(obj, WaitHandle.ToTimeoutMilliseconds(timeout)); - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public static bool Wait(object obj) => Wait(obj, Timeout.Infinite); // Remoting is not supported, exitContext argument is unused - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public static bool Wait(object obj, int millisecondsTimeout, bool exitContext) => Wait(obj, millisecondsTimeout); // Remoting is not supported, exitContext argument is unused - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public static bool Wait(object obj, TimeSpan timeout, bool exitContext) => Wait(obj, WaitHandle.ToTimeoutMilliseconds(timeout)); } diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/Mutex.Windows.cs b/src/libraries/System.Private.CoreLib/src/System/Threading/Mutex.Windows.cs index ab5663297cdc5..10a91926c3e02 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Threading/Mutex.Windows.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Threading/Mutex.Windows.cs @@ -24,7 +24,7 @@ private void CreateMutexCore(bool initiallyOwned, string? name, out bool created if (mutexHandle.IsInvalid) { mutexHandle.SetHandleAsInvalid(); -#if TARGET_UNIX || TARGET_BROWSER +#if TARGET_UNIX || TARGET_BROWSER || TARGET_WASI if (errorCode == Interop.Errors.ERROR_FILENAME_EXCED_RANGE) // On Unix, length validation is done by CoreCLR's PAL after converting to utf-8 throw new ArgumentException(SR.Argument_WaitHandleNameTooLong, nameof(name)); @@ -56,7 +56,7 @@ private static OpenExistingResult OpenExistingWorker(string name, out Mutex? res myHandle.Dispose(); -#if TARGET_UNIX || TARGET_BROWSER +#if TARGET_UNIX || TARGET_BROWSER || TARGET_WASI if (errorCode == Interop.Errors.ERROR_FILENAME_EXCED_RANGE) { // On Unix, length validation is done by CoreCLR's PAL after converting to utf-8 diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/Overlapped.cs b/src/libraries/System.Private.CoreLib/src/System/Threading/Overlapped.cs index 0f130cdc53aa8..29446e444073c 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Threading/Overlapped.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Threading/Overlapped.cs @@ -184,7 +184,7 @@ public static void Free(NativeOverlapped* nativeOverlappedPtr) _pNativeOverlapped = pNativeOverlapped; #if FEATURE_PERFTRACING -#if !(TARGET_BROWSER && !FEATURE_WASM_THREADS) +#if !((TARGET_BROWSER || TARGET_WASI) && !FEATURE_WASM_THREADS) if (NativeRuntimeEventSource.Log.IsEnabled()) NativeRuntimeEventSource.Log.ThreadPoolIOPack(pNativeOverlapped); #endif 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 e216cbb78d55c..ac31f6613440c 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 @@ -11,7 +11,7 @@ namespace System.Threading /// An object representing the registration of a via . /// #if !FEATURE_WASM_THREADS - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] #endif public sealed partial class RegisteredWaitHandle : MarshalByRefObject { diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/Semaphore.Windows.cs b/src/libraries/System.Private.CoreLib/src/System/Threading/Semaphore.Windows.cs index a4cb8323ef5b2..027e9fe93f468 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Threading/Semaphore.Windows.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Threading/Semaphore.Windows.cs @@ -23,7 +23,7 @@ private void CreateSemaphoreCore(int initialCount, int maximumCount, string? nam Debug.Assert(maximumCount >= 1); Debug.Assert(initialCount <= maximumCount); -#if TARGET_UNIX || TARGET_BROWSER +#if TARGET_UNIX || TARGET_BROWSER || TARGET_WASI if (name != null) throw new PlatformNotSupportedException(SR.PlatformNotSupported_NamedSynchronizationPrimitives); #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 9f8413e543216..4e6787500af0e 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Threading/SemaphoreSlim.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Threading/SemaphoreSlim.cs @@ -171,7 +171,7 @@ public SemaphoreSlim(int initialCount, int maxCount) /// /// The current instance has already been /// disposed. - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public void Wait() { // Call wait with infinite timeout @@ -188,7 +188,7 @@ public void Wait() /// canceled. /// The current instance has already been /// disposed. - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public void Wait(CancellationToken cancellationToken) { // Call wait with infinite timeout @@ -207,7 +207,7 @@ public void Wait(CancellationToken cancellationToken) /// is a negative /// number other than -1 milliseconds, which represents an infinite time-out -or- timeout is greater /// than . - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public bool Wait(TimeSpan timeout) { // Validate the timeout @@ -238,7 +238,7 @@ public bool Wait(TimeSpan timeout) /// number other than -1 milliseconds, which represents an infinite time-out -or- timeout is greater /// than . /// was canceled. - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public bool Wait(TimeSpan timeout, CancellationToken cancellationToken) { // Validate the timeout @@ -263,7 +263,7 @@ public bool Wait(TimeSpan timeout, CancellationToken cancellationToken) /// otherwise, false. /// is a /// negative number other than -1, which represents an infinite time-out. - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public bool Wait(int millisecondsTimeout) { return Wait(millisecondsTimeout, CancellationToken.None); @@ -281,7 +281,7 @@ public bool Wait(int millisecondsTimeout) /// is a negative number other than -1, /// which represents an infinite time-out. /// was canceled. - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public bool Wait(int millisecondsTimeout, CancellationToken cancellationToken) { CheckDispose(); @@ -427,7 +427,7 @@ public bool Wait(int millisecondsTimeout, CancellationToken cancellationToken) /// The start ticks to calculate the elapsed time /// The CancellationToken to observe. /// true if the monitor received a signal, false if the timeout expired - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] private bool WaitUntilCountOrTimeout(int millisecondsTimeout, uint startTime, CancellationToken cancellationToken) { int remainingWaitMilliseconds = Timeout.Infinite; 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 d6d7a87e46d54..1a8a4198e708c 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 @@ -4617,7 +4617,7 @@ internal void RemoveContinuation(object continuationObject) // could be TaskCont /// At least one of the instances was canceled -or- an exception was thrown during /// the execution of at least one of the instances. /// - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [MethodImpl(MethodImplOptions.NoOptimization)] // this is needed for the parallel debugger public static void WaitAll(params Task[] tasks) { @@ -4660,7 +4660,7 @@ public static void WaitAll(params Task[] tasks) /// infinite time-out -or- timeout is greater than /// . /// - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [MethodImpl(MethodImplOptions.NoOptimization)] // this is needed for the parallel debugger public static bool WaitAll(Task[] tasks, TimeSpan timeout) { @@ -4699,7 +4699,7 @@ public static bool WaitAll(Task[] tasks, TimeSpan timeout) /// is a negative number other than -1, which represents an /// infinite time-out. /// - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [MethodImpl(MethodImplOptions.NoOptimization)] // this is needed for the parallel debugger public static bool WaitAll(Task[] tasks, int millisecondsTimeout) { @@ -4728,7 +4728,7 @@ public static bool WaitAll(Task[] tasks, int millisecondsTimeout) /// /// The was canceled. /// - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [MethodImpl(MethodImplOptions.NoOptimization)] // this is needed for the parallel debugger public static void WaitAll(Task[] tasks, CancellationToken cancellationToken) { @@ -4769,14 +4769,14 @@ public static void WaitAll(Task[] tasks, CancellationToken cancellationToken) /// /// The was canceled. /// - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [MethodImpl(MethodImplOptions.NoOptimization)] // this is needed for the parallel debugger public static bool WaitAll(Task[] tasks, int millisecondsTimeout, CancellationToken cancellationToken) => WaitAllCore(tasks, millisecondsTimeout, cancellationToken); // Separated out to allow it to be optimized (caller is marked NoOptimization for VS parallel debugger // to be able to see the method on the stack and inspect arguments). - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] private static bool WaitAllCore(Task[] tasks, int millisecondsTimeout, CancellationToken cancellationToken) { if (tasks == null) @@ -4915,7 +4915,7 @@ private static void AddToList(T item, ref List? list, int initSize) /// The timeout. /// The cancellation token. /// true if all of the tasks completed; otherwise, false. - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] private static bool WaitAllBlockingCore(List tasks, int millisecondsTimeout, CancellationToken cancellationToken) { Debug.Assert(tasks != null, "Expected a non-null list of tasks"); 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 4c165a913929a..2257c8c1b68a5 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 @@ -23,7 +23,7 @@ public static partial class TaskAsyncEnumerableExtensions /// unless the returned is enumerated by calling its method. /// Async enumeration does not happen in the background; each MoveNext call will invoke the underlying exactly once. /// - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public static IEnumerable ToBlockingEnumerable(this IAsyncEnumerable source, CancellationToken cancellationToken = default) { IAsyncEnumerator enumerator = source.GetAsyncEnumerator(cancellationToken); @@ -76,7 +76,7 @@ public ManualResetEventWithAwaiterSupport() _onCompleted = Set; } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public void Wait(TAwaiter awaiter) where TAwaiter : ICriticalNotifyCompletion { awaiter.UnsafeOnCompleted(_onCompleted); 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 a27ced32def89..ad91527a1bd8e 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Threading/Thread.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Threading/Thread.cs @@ -153,16 +153,16 @@ public Thread(ParameterizedThreadStart start, int maxStackSize) Initialize(); } -#if !TARGET_BROWSER || FEATURE_WASM_THREADS - [UnsupportedOSPlatformGuard("browser")] +#if !(TARGET_BROWSER || TARGET_WASI) || FEATURE_WASM_THREADS + [UnsupportedOSPlatformGuard("browser"), UnsupportedOSPlatformGuard("wasi")] internal static bool IsThreadStartSupported => true; internal static bool IsInternalThreadStartSupported => true; #elif FEATURE_WASM_PERFTRACING - [UnsupportedOSPlatformGuard("browser")] + [UnsupportedOSPlatformGuard("browser"), UnsupportedOSPlatformGuard("wasi")] internal static bool IsThreadStartSupported => false; internal static bool IsInternalThreadStartSupported => true; #else - [UnsupportedOSPlatformGuard("browser")] + [UnsupportedOSPlatformGuard("browser"), UnsupportedOSPlatformGuard("wasi")] internal static bool IsThreadStartSupported => false; internal static bool IsInternalThreadStartSupported => false; #endif @@ -182,7 +182,7 @@ internal static void ThrowIfNoThreadStart(bool internalThread = false) /// There is not enough memory available to start this thread. /// This thread was created using a delegate instead of a delegate. #if !FEATURE_WASM_THREADS - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] #endif public void Start(object? parameter) => Start(parameter, captureContext: true); @@ -196,7 +196,7 @@ internal static void ThrowIfNoThreadStart(bool internalThread = false) /// explicitly avoids capturing the current context and flowing it to the invocation. /// #if !FEATURE_WASM_THREADS - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] #endif public void UnsafeStart(object? parameter) => Start(parameter, captureContext: false); @@ -227,7 +227,7 @@ private void Start(object? parameter, bool captureContext, bool internalThread = /// The thread has already been started. /// There is not enough memory available to start this thread. #if !FEATURE_WASM_THREADS - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] #endif public void Start() => Start(captureContext: true); @@ -239,7 +239,7 @@ private void Start(object? parameter, bool captureContext, bool internalThread = /// explicitly avoids capturing the current context and flowing it to the invocation. /// #if !FEATURE_WASM_THREADS - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] #endif public void UnsafeStart() => Start(captureContext: false); 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 8ad921e002cd5..a0409221a3700 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Threading/ThreadPoolWorkQueue.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Threading/ThreadPoolWorkQueue.cs @@ -1374,7 +1374,7 @@ public static partial class ThreadPool internal static bool EnableWorkerTracking => IsWorkerTrackingEnabledInConfig && EventSource.IsSupported; #if !FEATURE_WASM_THREADS - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] #endif [CLSCompliant(false)] public static RegisteredWaitHandle RegisterWaitForSingleObject( @@ -1391,7 +1391,7 @@ public static RegisteredWaitHandle RegisterWaitForSingleObject( } #if !FEATURE_WASM_THREADS - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] #endif [CLSCompliant(false)] public static RegisteredWaitHandle UnsafeRegisterWaitForSingleObject( @@ -1408,7 +1408,7 @@ public static RegisteredWaitHandle UnsafeRegisterWaitForSingleObject( } #if !FEATURE_WASM_THREADS - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] #endif public static RegisteredWaitHandle RegisterWaitForSingleObject( WaitHandle waitObject, @@ -1424,7 +1424,7 @@ public static RegisteredWaitHandle RegisterWaitForSingleObject( } #if !FEATURE_WASM_THREADS - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] #endif public static RegisteredWaitHandle UnsafeRegisterWaitForSingleObject( WaitHandle waitObject, @@ -1440,7 +1440,7 @@ public static RegisteredWaitHandle UnsafeRegisterWaitForSingleObject( } #if !FEATURE_WASM_THREADS - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] #endif public static RegisteredWaitHandle RegisterWaitForSingleObject( WaitHandle waitObject, @@ -1458,7 +1458,7 @@ public static RegisteredWaitHandle RegisterWaitForSingleObject( } #if !FEATURE_WASM_THREADS - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] #endif public static RegisteredWaitHandle UnsafeRegisterWaitForSingleObject( WaitHandle waitObject, @@ -1476,7 +1476,7 @@ public static RegisteredWaitHandle UnsafeRegisterWaitForSingleObject( } #if !FEATURE_WASM_THREADS - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] #endif public static RegisteredWaitHandle RegisterWaitForSingleObject( WaitHandle waitObject, @@ -1495,7 +1495,7 @@ bool executeOnlyOnce } #if !FEATURE_WASM_THREADS - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] #endif public static RegisteredWaitHandle UnsafeRegisterWaitForSingleObject( WaitHandle waitObject, diff --git a/src/libraries/System.Private.Xml/src/System/Xml/XmlUrlResolver.cs b/src/libraries/System.Private.Xml/src/System/Xml/XmlUrlResolver.cs index 558ad2e4b0218..1ff8aea96feb7 100644 --- a/src/libraries/System.Private.Xml/src/System/Xml/XmlUrlResolver.cs +++ b/src/libraries/System.Private.Xml/src/System/Xml/XmlUrlResolver.cs @@ -22,13 +22,13 @@ public partial class XmlUrlResolver : XmlResolver public XmlUrlResolver() { } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public override ICredentials? Credentials { set { _credentials = value; } } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public IWebProxy? Proxy { set { _proxy = value; } diff --git a/src/libraries/System.Reflection.Metadata/tests/Metadata/Decoding/CustomAttributeDecoderTests.cs b/src/libraries/System.Reflection.Metadata/tests/Metadata/Decoding/CustomAttributeDecoderTests.cs index 62944bef46d20..5d6b096956628 100644 --- a/src/libraries/System.Reflection.Metadata/tests/Metadata/Decoding/CustomAttributeDecoderTests.cs +++ b/src/libraries/System.Reflection.Metadata/tests/Metadata/Decoding/CustomAttributeDecoderTests.cs @@ -197,7 +197,7 @@ public void TestCustomAttributeDecoderUsingReflection() } } -#if NETCOREAPP && !TARGET_BROWSER // Generic attribute is not supported on .NET Framework. +#if NETCOREAPP && !TARGET_BROWSER && !TARGET_WASI // Generic attribute is not supported on .NET Framework. [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] [ActiveIssue("https://github.com/dotnet/runtime/issues/60579", TestPlatforms.iOS | TestPlatforms.tvOS)] public void TestCustomAttributeDecoderGenericUsingReflection() diff --git a/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/Configuration/CachingSectionGroup.cs b/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/Configuration/CachingSectionGroup.cs index 327dd53ba4073..ae0c332d3a0a6 100644 --- a/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/Configuration/CachingSectionGroup.cs +++ b/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/Configuration/CachingSectionGroup.cs @@ -8,7 +8,7 @@ namespace System.Runtime.Caching.Configuration { #if NETCOREAPP - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] #endif internal sealed class CachingSectionGroup : ConfigurationSectionGroup { diff --git a/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/Configuration/MemoryCacheElement.cs b/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/Configuration/MemoryCacheElement.cs index 9fcfd59126aa4..16f336e0c0d49 100644 --- a/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/Configuration/MemoryCacheElement.cs +++ b/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/Configuration/MemoryCacheElement.cs @@ -9,7 +9,7 @@ namespace System.Runtime.Caching.Configuration { #if NETCOREAPP - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] #endif internal sealed class MemoryCacheElement : ConfigurationElement { diff --git a/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/Configuration/MemoryCacheSection.cs b/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/Configuration/MemoryCacheSection.cs index 05e0387374ec8..b574e134f3fbf 100644 --- a/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/Configuration/MemoryCacheSection.cs +++ b/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/Configuration/MemoryCacheSection.cs @@ -22,7 +22,7 @@ namespace System.Runtime.Caching.Configuration */ #if NETCOREAPP - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] #endif internal sealed class MemoryCacheSection : ConfigurationSection { diff --git a/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/Configuration/MemoryCacheSettingsCollection.cs b/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/Configuration/MemoryCacheSettingsCollection.cs index e3c1a5bd3eb1d..8c0c004240bcf 100644 --- a/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/Configuration/MemoryCacheSettingsCollection.cs +++ b/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/Configuration/MemoryCacheSettingsCollection.cs @@ -8,7 +8,7 @@ namespace System.Runtime.Caching.Configuration { #if NETCOREAPP - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] #endif [ConfigurationCollection(typeof(MemoryCacheElement), CollectionType = ConfigurationElementCollectionType.AddRemoveClearMap)] diff --git a/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/Counters.cs b/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/Counters.cs index 8d3f7237d27af..a3f6351c7e357 100644 --- a/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/Counters.cs +++ b/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/Counters.cs @@ -10,7 +10,7 @@ namespace System.Runtime.Caching { #if NETCOREAPP - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] #endif internal sealed class Counters : EventSource { diff --git a/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/FileChangeNotificationSystem.cs b/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/FileChangeNotificationSystem.cs index 22595a4bd5845..0ac48d555304d 100644 --- a/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/FileChangeNotificationSystem.cs +++ b/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/FileChangeNotificationSystem.cs @@ -12,7 +12,7 @@ namespace System.Runtime.Caching { #if NETCOREAPP - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] [SupportedOSPlatform("maccatalyst")] 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 85730638cd743..3879af4ead559 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 NETCOREAPP - if (OperatingSystem.IsBrowser() || (OperatingSystem.IsIOS() && !OperatingSystem.IsMacCatalyst()) || OperatingSystem.IsTvOS()) + if (OperatingSystem.IsOSPlatform("Wasi") || OperatingSystem.IsBrowser() || (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 e740eed69ed51..84bc2a5e9147f 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 @@ -41,8 +41,8 @@ public class MemoryCache : ObjectCache, IEnumerable, IDisposable private EventHandler _onAppDomainUnload; private UnhandledExceptionEventHandler _onUnhandledException; #if NETCOREAPP - [UnsupportedOSPlatformGuard("browser")] - private static bool _countersSupported => !OperatingSystem.IsBrowser(); + [UnsupportedOSPlatformGuard("browser"), UnsupportedOSPlatformGuard("wasi")] + private static bool _countersSupported => !OperatingSystem.IsBrowser() && !OperatingSystem.IsOSPlatform("Wasi"); #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 96cfc3bda655b..633cfc384b185 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,8 @@ internal sealed class MemoryCacheStatistics : IDisposable private readonly MemoryCache _memoryCache; private readonly PhysicalMemoryMonitor _physicalMemoryMonitor; #if NETCOREAPP - [UnsupportedOSPlatformGuard("browser")] - private static bool _configSupported => !OperatingSystem.IsBrowser(); + [UnsupportedOSPlatformGuard("browser"), UnsupportedOSPlatformGuard("wasi")] + private static bool _configSupported => !OperatingSystem.IsBrowser() && !OperatingSystem.IsOSPlatform("Wasi"); #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 343f3beb4a845..90768c5aab65c 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,8 @@ internal sealed class MemoryCacheStore : IDisposable private readonly MemoryCache _cache; private readonly Counters _perfCounters; #if NETCOREAPP - [UnsupportedOSPlatformGuard("browser")] - private static bool _countersSupported => !OperatingSystem.IsBrowser(); + [UnsupportedOSPlatformGuard("browser"), UnsupportedOSPlatformGuard("wasi")] + private static bool _countersSupported => !OperatingSystem.IsBrowser() && !OperatingSystem.IsOSPlatform("Wasi"); #else private static bool _countersSupported => true; #endif diff --git a/src/libraries/System.Runtime.Extensions/tests/System/EnvironmentTests.cs b/src/libraries/System.Runtime.Extensions/tests/System/EnvironmentTests.cs index 55c666ba0b8b4..9782ad0cec546 100644 --- a/src/libraries/System.Runtime.Extensions/tests/System/EnvironmentTests.cs +++ b/src/libraries/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.IsOSPlatform("Wasi")) ? 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.IsOSPlatform("Wasi")) ? "Other " : "Unix "; Assert.Contains(expectedOS, versionString); } diff --git a/src/libraries/System.Runtime.InteropServices/ref/System.Runtime.InteropServices.cs b/src/libraries/System.Runtime.InteropServices/ref/System.Runtime.InteropServices.cs index c1ace3807df84..db0fc6d0a60e7 100644 --- a/src/libraries/System.Runtime.InteropServices/ref/System.Runtime.InteropServices.cs +++ b/src/libraries/System.Runtime.InteropServices/ref/System.Runtime.InteropServices.cs @@ -546,7 +546,7 @@ public ComSourceInterfacesAttribute(System.Type sourceInterface1, System.Type so public string Value { get { throw null; } } } [System.Runtime.Versioning.UnsupportedOSPlatform("android")] - [System.Runtime.Versioning.UnsupportedOSPlatform("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatform("browser"), System.Runtime.Versioning.UnsupportedOSPlatform("wasi")] [System.Runtime.Versioning.UnsupportedOSPlatform("ios")] [System.Runtime.Versioning.UnsupportedOSPlatform("tvos")] [System.CLSCompliantAttribute(false)] @@ -1369,7 +1369,7 @@ public sealed partial class PosixSignalRegistration : System.IDisposable { internal PosixSignalRegistration() { } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public static System.Runtime.InteropServices.PosixSignalRegistration Create(System.Runtime.InteropServices.PosixSignal signal, System.Action handler) { throw null; } diff --git a/src/libraries/System.Runtime.Loader/ref/System.Runtime.Loader.cs b/src/libraries/System.Runtime.Loader/ref/System.Runtime.Loader.cs index a6ab1de1524fd..76a72ab514280 100644 --- a/src/libraries/System.Runtime.Loader/ref/System.Runtime.Loader.cs +++ b/src/libraries/System.Runtime.Loader/ref/System.Runtime.Loader.cs @@ -41,7 +41,7 @@ public class MetadataUpdateOriginalTypeAttribute : Attribute namespace System.Runtime.Loader { [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public sealed partial class AssemblyDependencyResolver diff --git a/src/libraries/System.Runtime.Serialization.Formatters/ref/System.Runtime.Serialization.Formatters.csproj b/src/libraries/System.Runtime.Serialization.Formatters/ref/System.Runtime.Serialization.Formatters.csproj index d6f7d98bc527d..bf3180575eb51 100644 --- a/src/libraries/System.Runtime.Serialization.Formatters/ref/System.Runtime.Serialization.Formatters.csproj +++ b/src/libraries/System.Runtime.Serialization.Formatters/ref/System.Runtime.Serialization.Formatters.csproj @@ -1,6 +1,7 @@ $(NetCoreAppCurrent) + $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) diff --git a/src/libraries/System.Runtime.Serialization.Formatters/src/CompatibilitySuppressions.xml b/src/libraries/System.Runtime.Serialization.Formatters/src/CompatibilitySuppressions.xml index edac62595c48a..5dca51f6147da 100644 --- a/src/libraries/System.Runtime.Serialization.Formatters/src/CompatibilitySuppressions.xml +++ b/src/libraries/System.Runtime.Serialization.Formatters/src/CompatibilitySuppressions.xml @@ -37,6 +37,18 @@ ref/net7.0/System.Runtime.Serialization.Formatters.dll runtimes/browser/lib/net7.0/System.Runtime.Serialization.Formatters.dll + + CP0001 + T:System.Runtime.Serialization.SerializationEventHandler + ref/net7.0/System.Runtime.Serialization.Formatters.dll + runtimes/wasi/lib/net7.0/System.Runtime.Serialization.Formatters.dll + + + CP0001 + T:System.Runtime.Serialization.TypeLoadExceptionHolder + ref/net7.0/System.Runtime.Serialization.Formatters.dll + runtimes/wasi/lib/net7.0/System.Runtime.Serialization.Formatters.dll + CP0001 T:System.Runtime.Serialization.SerializationEventHandler diff --git a/src/libraries/System.Runtime.Serialization.Formatters/src/System.Runtime.Serialization.Formatters.csproj b/src/libraries/System.Runtime.Serialization.Formatters/src/System.Runtime.Serialization.Formatters.csproj index bbb10a1f4ce4b..ebd413ee0fcde 100644 --- a/src/libraries/System.Runtime.Serialization.Formatters/src/System.Runtime.Serialization.Formatters.csproj +++ b/src/libraries/System.Runtime.Serialization.Formatters/src/System.Runtime.Serialization.Formatters.csproj @@ -1,6 +1,6 @@ - $(NetCoreAppCurrent);$(NetCoreAppCurrent)-Browser;$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-tvOS;$(NetCoreAppCurrent)-Android + $(NetCoreAppCurrent);$(NetCoreAppCurrent)-Browser;$(NetCoreAppCurrent)-wasi;$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-tvOS;$(NetCoreAppCurrent)-Android $(MSBuildThisFileDirectory)ILLink\ true diff --git a/src/libraries/System.Runtime.Serialization.Schema/Directory.Build.props b/src/libraries/System.Runtime.Serialization.Schema/Directory.Build.props index e7d357018da7b..7d407028f6632 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/ref/System.Runtime.cs b/src/libraries/System.Runtime/ref/System.Runtime.cs index e9e5ed6eb9489..ae906101abceb 100644 --- a/src/libraries/System.Runtime/ref/System.Runtime.cs +++ b/src/libraries/System.Runtime/ref/System.Runtime.cs @@ -14081,9 +14081,9 @@ public enum NormalizationForm { FormC = 1, FormD = 2, - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] FormKC = 5, - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] FormKD = 6, } public readonly partial struct Rune : System.IComparable, System.IComparable, System.IEquatable, System.IFormattable, System.ISpanFormattable @@ -14525,15 +14525,15 @@ public void Wait() { } public void Wait(System.Threading.CancellationToken cancellationToken) { } public bool Wait(System.TimeSpan timeout) { throw null; } public bool Wait(System.TimeSpan timeout, System.Threading.CancellationToken cancellationToken) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static void WaitAll(params System.Threading.Tasks.Task[] tasks) { } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static bool WaitAll(System.Threading.Tasks.Task[] tasks, int millisecondsTimeout) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static bool WaitAll(System.Threading.Tasks.Task[] tasks, int millisecondsTimeout, System.Threading.CancellationToken cancellationToken) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static void WaitAll(System.Threading.Tasks.Task[] tasks, System.Threading.CancellationToken cancellationToken) { } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static bool WaitAll(System.Threading.Tasks.Task[] tasks, System.TimeSpan timeout) { throw null; } public static int WaitAny(params System.Threading.Tasks.Task[] tasks) { throw null; } public static int WaitAny(System.Threading.Tasks.Task[] tasks, int millisecondsTimeout) { throw null; } @@ -14559,7 +14559,7 @@ public static partial class TaskAsyncEnumerableExtensions { public static System.Runtime.CompilerServices.ConfiguredAsyncDisposable ConfigureAwait(this System.IAsyncDisposable source, bool continueOnCapturedContext) { throw null; } public static System.Runtime.CompilerServices.ConfiguredCancelableAsyncEnumerable ConfigureAwait(this System.Collections.Generic.IAsyncEnumerable source, bool continueOnCapturedContext) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static System.Collections.Generic.IEnumerable ToBlockingEnumerable(this System.Collections.Generic.IAsyncEnumerable source, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static System.Runtime.CompilerServices.ConfiguredCancelableAsyncEnumerable WithCancellation(this System.Collections.Generic.IAsyncEnumerable source, System.Threading.CancellationToken cancellationToken) { throw null; } } diff --git a/src/libraries/System.Security.Cryptography.Cose/Directory.Build.props b/src/libraries/System.Security.Cryptography.Cose/Directory.Build.props index c4db04cc6c252..d13e60dc1f013 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.Csp/Directory.Build.props b/src/libraries/System.Security.Cryptography.Csp/Directory.Build.props index ce244cbea5619..58979d42f0695 100644 --- a/src/libraries/System.Security.Cryptography.Csp/Directory.Build.props +++ b/src/libraries/System.Security.Cryptography.Csp/Directory.Build.props @@ -3,6 +3,6 @@ Microsoft true - browser + browser;wasi \ No newline at end of file diff --git a/src/libraries/System.Security.Cryptography.Encoding/Directory.Build.props b/src/libraries/System.Security.Cryptography.Encoding/Directory.Build.props index ce244cbea5619..58979d42f0695 100644 --- a/src/libraries/System.Security.Cryptography.Encoding/Directory.Build.props +++ b/src/libraries/System.Security.Cryptography.Encoding/Directory.Build.props @@ -3,6 +3,6 @@ Microsoft true - browser + browser;wasi \ No newline at end of file diff --git a/src/libraries/System.Security.Cryptography.OpenSsl/Directory.Build.props b/src/libraries/System.Security.Cryptography.OpenSsl/Directory.Build.props index 1e1390709dcc5..4342451c25a83 100644 --- a/src/libraries/System.Security.Cryptography.OpenSsl/Directory.Build.props +++ b/src/libraries/System.Security.Cryptography.OpenSsl/Directory.Build.props @@ -3,6 +3,6 @@ Microsoft true - windows;browser;android;ios;tvos + windows;browser;wasi;android;ios;tvos diff --git a/src/libraries/System.Security.Cryptography.Pkcs/Directory.Build.props b/src/libraries/System.Security.Cryptography.Pkcs/Directory.Build.props index 1f799d605feb9..e3cd1bcddea8e 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.X509Certificates/Directory.Build.props b/src/libraries/System.Security.Cryptography.X509Certificates/Directory.Build.props index ce244cbea5619..58979d42f0695 100644 --- a/src/libraries/System.Security.Cryptography.X509Certificates/Directory.Build.props +++ b/src/libraries/System.Security.Cryptography.X509Certificates/Directory.Build.props @@ -3,6 +3,6 @@ Microsoft true - browser + browser;wasi \ No newline at end of file diff --git a/src/libraries/System.Security.Cryptography.Xml/Directory.Build.props b/src/libraries/System.Security.Cryptography.Xml/Directory.Build.props index c843a6347ce61..3a3d8f9832479 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.Security.Cryptography/ref/System.Security.Cryptography.cs b/src/libraries/System.Security.Cryptography/ref/System.Security.Cryptography.cs index 2a40af5a1f91f..cc1ad65b5af06 100644 --- a/src/libraries/System.Security.Cryptography/ref/System.Security.Cryptography.cs +++ b/src/libraries/System.Security.Cryptography/ref/System.Security.Cryptography.cs @@ -47,13 +47,13 @@ namespace System.Security.Cryptography public abstract partial class Aes : System.Security.Cryptography.SymmetricAlgorithm { protected Aes() { } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static new System.Security.Cryptography.Aes Create() { throw null; } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")] [System.ObsoleteAttribute("Cryptographic factory methods accepting an algorithm name are obsolete. Use the parameterless Create factory method on the algorithm type instead.", DiagnosticId="SYSLIB0045", UrlFormat="https://aka.ms/dotnet-warnings/{0}")] public static new System.Security.Cryptography.Aes? Create(string algorithmName) { throw null; } } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public sealed partial class AesCcm : System.IDisposable @@ -99,7 +99,7 @@ public override void GenerateKey() { } [System.ObsoleteAttribute("Derived cryptographic types are obsolete. Use the Create method on the base type instead.", DiagnosticId="SYSLIB0021", UrlFormat="https://aka.ms/dotnet-warnings/{0}")] public sealed partial class AesCryptoServiceProvider : System.Security.Cryptography.Aes { - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public AesCryptoServiceProvider() { } public override int BlockSize { get { throw null; } set { } } public override int FeedbackSize { get { throw null; } set { } } @@ -118,7 +118,7 @@ protected override void Dispose(bool disposing) { } public override void GenerateIV() { } public override void GenerateKey() { } } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public sealed partial class AesGcm : System.IDisposable @@ -136,7 +136,7 @@ public void Encrypt(byte[] nonce, byte[] plaintext, byte[] ciphertext, byte[] ta } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] [System.ObsoleteAttribute("Derived cryptographic types are obsolete. Use the Create method on the base type instead.", DiagnosticId="SYSLIB0021", UrlFormat="https://aka.ms/dotnet-warnings/{0}")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public sealed partial class AesManaged : System.Security.Cryptography.Aes { public AesManaged() { } @@ -276,7 +276,7 @@ public AuthenticationTagMismatchException() { } public AuthenticationTagMismatchException(string? message) { } public AuthenticationTagMismatchException(string? message, System.Exception? inner) { } } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public sealed partial class ChaCha20Poly1305 : System.IDisposable @@ -520,18 +520,18 @@ public partial class CryptoConfig { public CryptoConfig() { } public static bool AllowOnlyFipsAlgorithms { get { throw null; } } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static void AddAlgorithm(System.Type algorithm, params string[] names) { } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static void AddOID(string oid, params string[] names) { } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")] public static object? CreateFromName(string name) { throw null; } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")] public static object? CreateFromName(string name, params object?[]? args) { throw null; } [System.ObsoleteAttribute("EncodeOID is obsolete. Use the ASN.1 functionality provided in System.Formats.Asn1.", DiagnosticId="SYSLIB0031", UrlFormat="https://aka.ms/dotnet-warnings/{0}")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static byte[] EncodeOID(string str) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static string? MapNameToOID(string name) { throw null; } } public static partial class CryptographicOperations @@ -645,7 +645,7 @@ public abstract partial class DES : System.Security.Cryptography.SymmetricAlgori { protected DES() { } public override byte[] Key { get { throw null; } set { } } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static new System.Security.Cryptography.DES Create() { throw null; } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")] [System.ObsoleteAttribute("Cryptographic factory methods accepting an algorithm name are obsolete. Use the parameterless Create factory method on the algorithm type instead.", DiagnosticId="SYSLIB0045", UrlFormat="https://aka.ms/dotnet-warnings/{0}")] @@ -668,15 +668,15 @@ public override void GenerateKey() { } public abstract partial class DSA : System.Security.Cryptography.AsymmetricAlgorithm { protected DSA() { } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public static new System.Security.Cryptography.DSA Create() { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public static System.Security.Cryptography.DSA Create(int keySizeInBits) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public static System.Security.Cryptography.DSA Create(System.Security.Cryptography.DSAParameters parameters) { throw null; } @@ -804,31 +804,31 @@ public override void ImportParameters(System.Security.Cryptography.DSAParameters public sealed partial class DSAOpenSsl : System.Security.Cryptography.DSA { [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("windows")] public DSAOpenSsl() { } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("windows")] public DSAOpenSsl(int keySize) { } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("windows")] public DSAOpenSsl(System.IntPtr handle) { } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("windows")] public DSAOpenSsl(System.Security.Cryptography.DSAParameters parameters) { } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("windows")] @@ -954,11 +954,11 @@ protected ECDiffieHellman() { } public override string KeyExchangeAlgorithm { get { throw null; } } public abstract System.Security.Cryptography.ECDiffieHellmanPublicKey PublicKey { get; } public override string? SignatureAlgorithm { get { throw null; } } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static new System.Security.Cryptography.ECDiffieHellman Create() { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static System.Security.Cryptography.ECDiffieHellman Create(System.Security.Cryptography.ECCurve curve) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static System.Security.Cryptography.ECDiffieHellman Create(System.Security.Cryptography.ECParameters parameters) { throw null; } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")] [System.ObsoleteAttribute("Cryptographic factory methods accepting an algorithm name are obsolete. Use the parameterless Create factory method on the algorithm type instead.", DiagnosticId="SYSLIB0045", UrlFormat="https://aka.ms/dotnet-warnings/{0}")] @@ -1043,31 +1043,31 @@ public enum ECDiffieHellmanKeyDerivationFunction public sealed partial class ECDiffieHellmanOpenSsl : System.Security.Cryptography.ECDiffieHellman { [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("windows")] public ECDiffieHellmanOpenSsl() { } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("windows")] public ECDiffieHellmanOpenSsl(int keySize) { } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("windows")] public ECDiffieHellmanOpenSsl(System.IntPtr handle) { } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("windows")] public ECDiffieHellmanOpenSsl(System.Security.Cryptography.ECCurve curve) { } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("windows")] @@ -1098,11 +1098,11 @@ public abstract partial class ECDsa : System.Security.Cryptography.ECAlgorithm protected ECDsa() { } public override string? KeyExchangeAlgorithm { get { throw null; } } public override string SignatureAlgorithm { get { throw null; } } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static new System.Security.Cryptography.ECDsa Create() { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static System.Security.Cryptography.ECDsa Create(System.Security.Cryptography.ECCurve curve) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static System.Security.Cryptography.ECDsa Create(System.Security.Cryptography.ECParameters parameters) { throw null; } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")] [System.ObsoleteAttribute("Cryptographic factory methods accepting an algorithm name are obsolete. Use the parameterless Create factory method on the algorithm type instead.", DiagnosticId="SYSLIB0045", UrlFormat="https://aka.ms/dotnet-warnings/{0}")] @@ -1201,31 +1201,31 @@ public override void ImportParameters(System.Security.Cryptography.ECParameters public sealed partial class ECDsaOpenSsl : System.Security.Cryptography.ECDsa { [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("windows")] public ECDsaOpenSsl() { } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("windows")] public ECDsaOpenSsl(int keySize) { } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("windows")] public ECDsaOpenSsl(System.IntPtr handle) { } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("windows")] public ECDsaOpenSsl(System.Security.Cryptography.ECCurve curve) { } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("windows")] @@ -1354,35 +1354,35 @@ public partial class HMACMD5 : System.Security.Cryptography.HMAC { public const int HashSizeInBits = 128; public const int HashSizeInBytes = 16; - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public HMACMD5() { } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public HMACMD5(byte[] key) { } public override byte[] Key { get { throw null; } set { } } protected override void Dispose(bool disposing) { } protected override void HashCore(byte[] rgb, int ib, int cb) { } protected override void HashCore(System.ReadOnlySpan source) { } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static byte[] HashData(byte[] key, byte[] source) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static byte[] HashData(byte[] key, System.IO.Stream source) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static byte[] HashData(System.ReadOnlySpan key, System.IO.Stream source) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static int HashData(System.ReadOnlySpan key, System.IO.Stream source, System.Span destination) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static byte[] HashData(System.ReadOnlySpan key, System.ReadOnlySpan source) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static int HashData(System.ReadOnlySpan key, System.ReadOnlySpan source, System.Span destination) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static System.Threading.Tasks.ValueTask HashDataAsync(byte[] key, System.IO.Stream source, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static System.Threading.Tasks.ValueTask HashDataAsync(System.ReadOnlyMemory key, System.IO.Stream source, System.Memory destination, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static System.Threading.Tasks.ValueTask HashDataAsync(System.ReadOnlyMemory key, System.IO.Stream source, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } protected override byte[] HashFinal() { throw null; } public override void Initialize() { } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static bool TryHashData(System.ReadOnlySpan key, System.ReadOnlySpan source, System.Span destination, out int bytesWritten) { throw null; } protected override bool TryHashFinal(System.Span destination, out int bytesWritten) { throw null; } } @@ -1557,26 +1557,26 @@ public abstract partial class MD5 : System.Security.Cryptography.HashAlgorithm public const int HashSizeInBits = 128; public const int HashSizeInBytes = 16; protected MD5() { } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static new System.Security.Cryptography.MD5 Create() { throw null; } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")] [System.ObsoleteAttribute("Cryptographic factory methods accepting an algorithm name are obsolete. Use the parameterless Create factory method on the algorithm type instead.", DiagnosticId="SYSLIB0045", UrlFormat="https://aka.ms/dotnet-warnings/{0}")] public static new System.Security.Cryptography.MD5? Create(string algName) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static byte[] HashData(byte[] source) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static byte[] HashData(System.IO.Stream source) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static int HashData(System.IO.Stream source, System.Span destination) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static byte[] HashData(System.ReadOnlySpan source) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static int HashData(System.ReadOnlySpan source, System.Span destination) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static System.Threading.Tasks.ValueTask HashDataAsync(System.IO.Stream source, System.Memory destination, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static System.Threading.Tasks.ValueTask HashDataAsync(System.IO.Stream source, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static bool TryHashData(System.ReadOnlySpan source, System.Span destination, out int bytesWritten) { throw null; } } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] @@ -1737,7 +1737,7 @@ protected RC2() { } public virtual int EffectiveKeySize { get { throw null; } set { } } public override int KeySize { get { throw null; } set { } } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static new System.Security.Cryptography.RC2 Create() { throw null; } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")] [System.ObsoleteAttribute("Cryptographic factory methods accepting an algorithm name are obsolete. Use the parameterless Create factory method on the algorithm type instead.", DiagnosticId="SYSLIB0045", UrlFormat="https://aka.ms/dotnet-warnings/{0}")] @@ -1748,7 +1748,7 @@ protected RC2() { } public sealed partial class RC2CryptoServiceProvider : System.Security.Cryptography.RC2 { [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public RC2CryptoServiceProvider() { } public override int EffectiveKeySize { get { throw null; } set { } } public bool UseSalt { get { throw null; } [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] set { } } @@ -1792,7 +1792,7 @@ public override void Reset() { } public abstract partial class Rijndael : System.Security.Cryptography.SymmetricAlgorithm { protected Rijndael() { } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static new System.Security.Cryptography.Rijndael Create() { throw null; } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")] [System.ObsoleteAttribute("Cryptographic factory methods accepting an algorithm name are obsolete. Use the parameterless Create factory method on the algorithm type instead.", DiagnosticId="SYSLIB0045", UrlFormat="https://aka.ms/dotnet-warnings/{0}")] @@ -1800,7 +1800,7 @@ protected Rijndael() { } } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] [System.ObsoleteAttribute("The Rijndael and RijndaelManaged types are obsolete. Use Aes instead.", DiagnosticId="SYSLIB0022", UrlFormat="https://aka.ms/dotnet-warnings/{0}")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public sealed partial class RijndaelManaged : System.Security.Cryptography.Rijndael { public RijndaelManaged() { } @@ -1840,11 +1840,11 @@ public abstract partial class RSA : System.Security.Cryptography.AsymmetricAlgor protected RSA() { } public override string? KeyExchangeAlgorithm { get { throw null; } } public override string SignatureAlgorithm { get { throw null; } } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static new System.Security.Cryptography.RSA Create() { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static System.Security.Cryptography.RSA Create(int keySizeInBits) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static System.Security.Cryptography.RSA Create(System.Security.Cryptography.RSAParameters parameters) { throw null; } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")] [System.ObsoleteAttribute("Cryptographic factory methods accepting an algorithm name are obsolete. Use the parameterless Create factory method on the algorithm type instead.", DiagnosticId="SYSLIB0045", UrlFormat="https://aka.ms/dotnet-warnings/{0}")] @@ -1940,9 +1940,9 @@ public override void ImportParameters(System.Security.Cryptography.RSAParameters } public sealed partial class RSACryptoServiceProvider : System.Security.Cryptography.RSA, System.Security.Cryptography.ICspAsymmetricAlgorithm { - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public RSACryptoServiceProvider() { } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public RSACryptoServiceProvider(int dwKeySize) { } [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] public RSACryptoServiceProvider(int dwKeySize, System.Security.Cryptography.CspParameters? parameters) { } @@ -2028,31 +2028,31 @@ public override void SetKey(System.Security.Cryptography.AsymmetricAlgorithm key public sealed partial class RSAOpenSsl : System.Security.Cryptography.RSA { [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("windows")] public RSAOpenSsl() { } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("windows")] public RSAOpenSsl(int keySize) { } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("windows")] public RSAOpenSsl(System.IntPtr handle) { } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("windows")] public RSAOpenSsl(System.Security.Cryptography.RSAParameters parameters) { } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("windows")] @@ -2091,7 +2091,7 @@ public RSAPKCS1KeyExchangeFormatter(System.Security.Cryptography.AsymmetricAlgor public override byte[] CreateKeyExchange(byte[] rgbData, System.Type? symAlgType) { throw null; } public override void SetKey(System.Security.Cryptography.AsymmetricAlgorithm key) { } } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public partial class RSAPKCS1SignatureDeformatter : System.Security.Cryptography.AsymmetricSignatureDeformatter { public RSAPKCS1SignatureDeformatter() { } @@ -2100,7 +2100,7 @@ public override void SetHashAlgorithm(string strName) { } public override void SetKey(System.Security.Cryptography.AsymmetricAlgorithm key) { } public override bool VerifySignature(byte[] rgbHash, byte[] rgbSignature) { throw null; } } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public partial class RSAPKCS1SignatureFormatter : System.Security.Cryptography.AsymmetricSignatureFormatter { public RSAPKCS1SignatureFormatter() { } @@ -2130,20 +2130,20 @@ public enum RSASignaturePaddingMode public sealed partial class SafeEvpPKeyHandle : System.Runtime.InteropServices.SafeHandle { [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("windows")] public SafeEvpPKeyHandle() : base (default(System.IntPtr), default(bool)) { } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("windows")] public SafeEvpPKeyHandle(System.IntPtr handle, bool ownsHandle) : base (default(System.IntPtr), default(bool)) { } public override bool IsInvalid { get { throw null; } } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("windows")] @@ -2424,7 +2424,7 @@ public abstract partial class TripleDES : System.Security.Cryptography.Symmetric { protected TripleDES() { } public override byte[] Key { get { throw null; } set { } } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static new System.Security.Cryptography.TripleDES Create() { throw null; } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")] [System.ObsoleteAttribute("Cryptographic factory methods accepting an algorithm name are obsolete. Use the parameterless Create factory method on the algorithm type instead.", DiagnosticId="SYSLIB0045", UrlFormat="https://aka.ms/dotnet-warnings/{0}")] @@ -2482,7 +2482,7 @@ public override void GenerateKey() { } } namespace System.Security.Cryptography.X509Certificates { - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public sealed partial class CertificateRequest { public CertificateRequest(System.Security.Cryptography.X509Certificates.X500DistinguishedName subjectName, System.Security.Cryptography.ECDsa key, System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { } @@ -2567,15 +2567,15 @@ public PublicKey(System.Security.Cryptography.Oid oid, System.Security.Cryptogra public System.Security.Cryptography.Oid Oid { get { throw null; } } public static System.Security.Cryptography.X509Certificates.PublicKey CreateFromSubjectPublicKeyInfo(System.ReadOnlySpan source, out int bytesRead) { throw null; } public byte[] ExportSubjectPublicKeyInfo() { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public System.Security.Cryptography.DSA? GetDSAPublicKey() { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public System.Security.Cryptography.ECDiffieHellman? GetECDiffieHellmanPublicKey() { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public System.Security.Cryptography.ECDsa? GetECDsaPublicKey() { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public System.Security.Cryptography.RSA? GetRSAPublicKey() { throw null; } public bool TryExportSubjectPublicKeyInfo(System.Span destination, out int bytesWritten) { throw null; } } @@ -2707,44 +2707,44 @@ public override void CopyFrom(System.Security.Cryptography.AsnEncodedData asnEnc public partial class X509Certificate : System.IDisposable, System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable { [System.ObsoleteAttribute("X509Certificate and X509Certificate2 are immutable. Use the appropriate constructor to create a new certificate.", DiagnosticId="SYSLIB0026", UrlFormat="https://aka.ms/dotnet-warnings/{0}")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public X509Certificate() { } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public X509Certificate(byte[] data) { } [System.CLSCompliantAttribute(false)] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public X509Certificate(byte[] rawData, System.Security.SecureString? password) { } [System.CLSCompliantAttribute(false)] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public X509Certificate(byte[] rawData, System.Security.SecureString? password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags) { } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public X509Certificate(byte[] rawData, string? password) { } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public X509Certificate(byte[] rawData, string? password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags) { } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public X509Certificate(System.IntPtr handle) { } public X509Certificate(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public X509Certificate(System.Security.Cryptography.X509Certificates.X509Certificate cert) { } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public X509Certificate(string fileName) { } [System.CLSCompliantAttribute(false)] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public X509Certificate(string fileName, System.Security.SecureString? password) { } [System.CLSCompliantAttribute(false)] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public X509Certificate(string fileName, System.Security.SecureString? password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags) { } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public X509Certificate(string fileName, string? password) { } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public X509Certificate(string fileName, string? password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags) { } public System.IntPtr Handle { get { throw null; } } public string Issuer { get { throw null; } } public System.ReadOnlyMemory SerialNumberBytes { get { throw null; } } public string Subject { get { throw null; } } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static System.Security.Cryptography.X509Certificates.X509Certificate CreateFromCertFile(string filename) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static System.Security.Cryptography.X509Certificates.X509Certificate CreateFromSignedFile(string filename) { throw null; } public void Dispose() { } protected virtual void Dispose(bool disposing) { } @@ -2800,42 +2800,42 @@ void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Ser public partial class X509Certificate2 : System.Security.Cryptography.X509Certificates.X509Certificate { [System.ObsoleteAttribute("X509Certificate and X509Certificate2 are immutable. Use the appropriate constructor to create a new certificate.", DiagnosticId="SYSLIB0026", UrlFormat="https://aka.ms/dotnet-warnings/{0}")] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public X509Certificate2() { } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public X509Certificate2(byte[] rawData) { } [System.CLSCompliantAttribute(false)] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public X509Certificate2(byte[] rawData, System.Security.SecureString? password) { } [System.CLSCompliantAttribute(false)] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public X509Certificate2(byte[] rawData, System.Security.SecureString? password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags) { } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public X509Certificate2(byte[] rawData, string? password) { } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public X509Certificate2(byte[] rawData, string? password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags) { } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public X509Certificate2(System.IntPtr handle) { } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public X509Certificate2(System.ReadOnlySpan rawData) { } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public X509Certificate2(System.ReadOnlySpan rawData, System.ReadOnlySpan password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags = System.Security.Cryptography.X509Certificates.X509KeyStorageFlags.DefaultKeySet) { } protected X509Certificate2(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public X509Certificate2(System.Security.Cryptography.X509Certificates.X509Certificate certificate) { } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public X509Certificate2(string fileName) { } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public X509Certificate2(string fileName, System.ReadOnlySpan password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags = System.Security.Cryptography.X509Certificates.X509KeyStorageFlags.DefaultKeySet) { } [System.CLSCompliantAttribute(false)] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public X509Certificate2(string fileName, System.Security.SecureString? password) { } [System.CLSCompliantAttribute(false)] - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public X509Certificate2(string fileName, System.Security.SecureString? password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags) { } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public X509Certificate2(string fileName, string? password) { } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public X509Certificate2(string fileName, string? password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags) { } public bool Archived { get { throw null; } [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] set { } } public System.Security.Cryptography.X509Certificates.X509ExtensionCollection Extensions { get { throw null; } } @@ -2855,22 +2855,22 @@ public X509Certificate2(string fileName, string? password, System.Security.Crypt public string Thumbprint { get { throw null; } } public int Version { get { throw null; } } public System.Security.Cryptography.X509Certificates.X509Certificate2 CopyWithPrivateKey(System.Security.Cryptography.ECDiffieHellman privateKey) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static System.Security.Cryptography.X509Certificates.X509Certificate2 CreateFromEncryptedPem(System.ReadOnlySpan certPem, System.ReadOnlySpan keyPem, System.ReadOnlySpan password) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static System.Security.Cryptography.X509Certificates.X509Certificate2 CreateFromEncryptedPemFile(string certPemFilePath, System.ReadOnlySpan password, string? keyPemFilePath = null) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static System.Security.Cryptography.X509Certificates.X509Certificate2 CreateFromPem(System.ReadOnlySpan certPem) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static System.Security.Cryptography.X509Certificates.X509Certificate2 CreateFromPem(System.ReadOnlySpan certPem, System.ReadOnlySpan keyPem) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static System.Security.Cryptography.X509Certificates.X509Certificate2 CreateFromPemFile(string certPemFilePath, string? keyPemFilePath = null) { throw null; } public string ExportCertificatePem() { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static System.Security.Cryptography.X509Certificates.X509ContentType GetCertContentType(byte[] rawData) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static System.Security.Cryptography.X509Certificates.X509ContentType GetCertContentType(System.ReadOnlySpan rawData) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static System.Security.Cryptography.X509Certificates.X509ContentType GetCertContentType(string fileName) { throw null; } public System.Security.Cryptography.ECDiffieHellman? GetECDiffieHellmanPrivateKey() { throw null; } public System.Security.Cryptography.ECDiffieHellman? GetECDiffieHellmanPublicKey() { throw null; } @@ -2985,7 +2985,7 @@ public X509Chain(System.IntPtr chainContext) { } public System.Security.Cryptography.X509Certificates.X509ChainPolicy ChainPolicy { get { throw null; } set { } } public System.Security.Cryptography.X509Certificates.X509ChainStatus[] ChainStatus { get { throw null; } } public Microsoft.Win32.SafeHandles.SafeX509ChainHandle? SafeHandle { get { throw null; } } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public bool Build(System.Security.Cryptography.X509Certificates.X509Certificate2 certificate) { throw null; } public static System.Security.Cryptography.X509Certificates.X509Chain Create() { throw null; } public void Dispose() { } diff --git a/src/libraries/System.Security.Cryptography/src/System.Security.Cryptography.csproj b/src/libraries/System.Security.Cryptography/src/System.Security.Cryptography.csproj index 99e10abbe0595..37f3691de7cbd 100644 --- a/src/libraries/System.Security.Cryptography/src/System.Security.Cryptography.csproj +++ b/src/libraries/System.Security.Cryptography/src/System.Security.Cryptography.csproj @@ -2,7 +2,7 @@ true $(DefineConstants);INTERNAL_ASYMMETRIC_IMPLEMENTATIONS - $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-Android;$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-tvOS;$(NetCoreAppCurrent)-Browser;$(NetCoreAppCurrent) + $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-Android;$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-tvOS;$(NetCoreAppCurrent)-Browser;$(NetCoreAppCurrent)-wasi;$(NetCoreAppCurrent) $(NoWarn);CA5350;CA5351;CA5379;CA5384;SYSLIB0026 $(NoWarn);CS0809 @@ -549,7 +549,7 @@ System\Security\Cryptography\X509Certificates\Asn1\PolicyInformationAsn.xml - + @@ -1836,7 +1836,7 @@ - + diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/Aes.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/Aes.cs index e00abeeac2d7a..cd7872c7dd3eb 100644 --- a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/Aes.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/Aes.cs @@ -20,7 +20,7 @@ protected Aes() ModeValue = CipherMode.CBC; } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public static new Aes Create() { return new AesImplementation(); diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesCcm.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesCcm.cs index 74d974f7cefe7..cebb27ed93728 100644 --- a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesCcm.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesCcm.cs @@ -6,7 +6,7 @@ namespace System.Security.Cryptography { - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] public sealed partial class AesCcm : IDisposable diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesCryptoServiceProvider.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesCryptoServiceProvider.cs index 2e081e8a06493..a7095a8a59324 100644 --- a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesCryptoServiceProvider.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesCryptoServiceProvider.cs @@ -12,7 +12,7 @@ public sealed class AesCryptoServiceProvider : Aes { private readonly Aes _impl; - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public AesCryptoServiceProvider() { // This class wraps Aes diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesGcm.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesGcm.cs index 104d280452482..f52cb0f9b2fe9 100644 --- a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesGcm.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesGcm.cs @@ -6,7 +6,7 @@ namespace System.Security.Cryptography { - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] public sealed partial class AesGcm : IDisposable diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesManaged.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesManaged.cs index dc62371051733..76e9094ad18f2 100644 --- a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesManaged.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesManaged.cs @@ -8,7 +8,7 @@ namespace System.Security.Cryptography { [Obsolete(Obsoletions.DerivedCryptographicTypesMessage, DiagnosticId = Obsoletions.DerivedCryptographicTypesDiagId, UrlFormat = Obsoletions.SharedUrlFormat)] [EditorBrowsable(EditorBrowsableState.Never)] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public sealed class AesManaged : Aes { private readonly Aes _impl; diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ChaCha20Poly1305.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ChaCha20Poly1305.cs index 63ac0a3f7eca2..6942b4ec93fb8 100644 --- a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ChaCha20Poly1305.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ChaCha20Poly1305.cs @@ -6,7 +6,7 @@ namespace System.Security.Cryptography { - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] public sealed partial class ChaCha20Poly1305 : IDisposable diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/CryptoConfig.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/CryptoConfig.cs index d7397d28223b9..b3c4330d3b448 100644 --- a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/CryptoConfig.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/CryptoConfig.cs @@ -299,7 +299,7 @@ private static Dictionary DefaultNameHT } #endif - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public static void AddAlgorithm(Type algorithm, params string[] names) { #if BROWSER @@ -496,7 +496,7 @@ public static void AddAlgorithm(Type algorithm, params string[] names) return CreateFromName(name, null); } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public static void AddOID(string oid, params string[] names) { #if BROWSER @@ -526,7 +526,7 @@ public static void AddOID(string oid, params string[] names) #endif } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public static string? MapNameToOID(string name) { #if BROWSER @@ -550,7 +550,7 @@ public static void AddOID(string oid, params string[] names) #endif } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [Obsolete(Obsoletions.CryptoConfigEncodeOIDMessage, DiagnosticId = Obsoletions.CryptoConfigEncodeOIDDiagId, UrlFormat = Obsoletions.SharedUrlFormat)] public static byte[] EncodeOID(string str) { diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DES.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DES.cs index 48effb4c6ecf7..2afbd8ec4b543 100644 --- a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DES.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DES.cs @@ -21,7 +21,7 @@ protected DES() FeedbackSizeValue = BlockSizeValue; } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public static new DES Create() { return new DesImplementation(); diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DSA.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DSA.cs index b1331334dc8a4..cdb6a63157ad6 100644 --- a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DSA.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DSA.cs @@ -34,7 +34,7 @@ protected DSA() { } return (DSA?)CryptoConfig.CreateFromName(algName); } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] public static new DSA Create() @@ -42,7 +42,7 @@ protected DSA() { } return CreateCore(); } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] public static DSA Create(int keySizeInBits) @@ -61,7 +61,7 @@ public static DSA Create(int keySizeInBits) } } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] public static DSA Create(DSAParameters parameters) diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DSAOpenSsl.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DSAOpenSsl.cs index e1805a2f99e9e..06b5528b7b5f2 100644 --- a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DSAOpenSsl.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DSAOpenSsl.cs @@ -9,7 +9,7 @@ namespace System.Security.Cryptography public sealed partial class DSAOpenSsl : DSA { [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] [UnsupportedOSPlatform("windows")] @@ -32,7 +32,7 @@ public DSAOpenSsl(DSAParameters parameters) /// /// is not a valid enveloped DSA* [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] [UnsupportedOSPlatform("windows")] @@ -66,7 +66,7 @@ public DSAOpenSsl(SafeEvpPKeyHandle pkeyHandle) /// A pointer to an OpenSSL DSA* /// is invalid [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] [UnsupportedOSPlatform("windows")] diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDiffieHellman.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDiffieHellman.cs index 9eaf8d78c920d..83c9d36a37761 100644 --- a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDiffieHellman.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDiffieHellman.cs @@ -22,13 +22,13 @@ public override string? SignatureAlgorithm get { return null; } } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public static new partial ECDiffieHellman Create(); - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public static partial ECDiffieHellman Create(ECCurve curve); - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public static partial ECDiffieHellman Create(ECParameters parameters); [Obsolete(Obsoletions.CryptoStringFactoryMessage, DiagnosticId = Obsoletions.CryptoStringFactoryDiagId, UrlFormat = Obsoletions.SharedUrlFormat)] diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDiffieHellmanOpenSsl.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDiffieHellmanOpenSsl.cs index 95c1bdf82a39e..c884e7b843370 100644 --- a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDiffieHellmanOpenSsl.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDiffieHellmanOpenSsl.cs @@ -18,7 +18,7 @@ public sealed partial class ECDiffieHellmanOpenSsl : ECDiffieHellman /// /// is not a valid enveloped EC_KEY* [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] [UnsupportedOSPlatform("windows")] @@ -53,7 +53,7 @@ public ECDiffieHellmanOpenSsl(SafeEvpPKeyHandle pkeyHandle) /// A pointer to an OpenSSL EC_KEY* /// is invalid [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] [UnsupportedOSPlatform("windows")] diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDsa.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDsa.cs index 645c3303d0a06..f9463aeb2d5c4 100644 --- a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDsa.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDsa.cs @@ -20,13 +20,13 @@ public abstract partial class ECDsa : ECAlgorithm protected ECDsa() { } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public static new partial ECDsa Create(); - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public static partial ECDsa Create(ECCurve curve); - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public static partial ECDsa Create(ECParameters parameters); [Obsolete(Obsoletions.CryptoStringFactoryMessage, DiagnosticId = Obsoletions.CryptoStringFactoryDiagId, UrlFormat = Obsoletions.SharedUrlFormat)] diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDsaOpenSsl.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDsaOpenSsl.cs index 5e2d8f5fe271c..09b15f8014a90 100644 --- a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDsaOpenSsl.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDsaOpenSsl.cs @@ -18,7 +18,7 @@ public sealed partial class ECDsaOpenSsl : ECDsa /// /// is not a valid enveloped EC_KEY* [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] [UnsupportedOSPlatform("windows")] @@ -53,7 +53,7 @@ public ECDsaOpenSsl(SafeEvpPKeyHandle pkeyHandle) /// A pointer to an OpenSSL EC_KEY* /// is invalid [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] [UnsupportedOSPlatform("windows")] diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HMACMD5.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HMACMD5.cs index bf8a9f76e5b6a..a1a1f96e043b5 100644 --- a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HMACMD5.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HMACMD5.cs @@ -27,13 +27,13 @@ public class HMACMD5 : HMAC /// public const int HashSizeInBytes = HashSizeInBits / 8; - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public HMACMD5() : this(RandomNumberGenerator.GetBytes(BlockSize)) { } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public HMACMD5(byte[] key) { ArgumentNullException.ThrowIfNull(key); @@ -85,7 +85,7 @@ protected override bool TryHashFinal(Span destination, out int bytesWritte /// /// or is . /// - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public static byte[] HashData(byte[] key, byte[] source) { ArgumentNullException.ThrowIfNull(key); @@ -100,7 +100,7 @@ public static byte[] HashData(byte[] key, byte[] source) /// The HMAC key. /// The data to HMAC. /// The HMAC of the data. - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public static byte[] HashData(ReadOnlySpan key, ReadOnlySpan source) { byte[] buffer = new byte[HashSizeInBytes]; @@ -122,7 +122,7 @@ public static byte[] HashData(ReadOnlySpan key, ReadOnlySpan source) /// The buffer in is too small to hold the calculated hash /// size. The MD5 algorithm always produces a 128-bit HMAC, or 16 bytes. /// - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public static int HashData(ReadOnlySpan key, ReadOnlySpan source, Span destination) { if (!TryHashData(key, source, destination, out int bytesWritten)) @@ -146,7 +146,7 @@ public static int HashData(ReadOnlySpan key, ReadOnlySpan source, Sp /// if is too small to hold the /// calculated hash, otherwise. /// - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public static bool TryHashData(ReadOnlySpan key, ReadOnlySpan source, Span destination, out int bytesWritten) { if (destination.Length < HashSizeInBytes) @@ -181,7 +181,7 @@ public static bool TryHashData(ReadOnlySpan key, ReadOnlySpan source /// does not support reading. ///

/// - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public static int HashData(ReadOnlySpan key, Stream source, Span destination) { ArgumentNullException.ThrowIfNull(source); @@ -207,7 +207,7 @@ public static int HashData(ReadOnlySpan key, Stream source, Span des /// /// does not support reading. /// - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public static byte[] HashData(ReadOnlySpan key, Stream source) { ArgumentNullException.ThrowIfNull(source); @@ -230,7 +230,7 @@ public static byte[] HashData(ReadOnlySpan key, Stream source) /// /// does not support reading. /// - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public static byte[] HashData(byte[] key, Stream source) { ArgumentNullException.ThrowIfNull(key); @@ -254,7 +254,7 @@ public static byte[] HashData(byte[] key, Stream source) /// /// does not support reading. /// - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public static ValueTask HashDataAsync(ReadOnlyMemory key, Stream source, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(source); @@ -281,7 +281,7 @@ public static ValueTask HashDataAsync(ReadOnlyMemory key, Stream s /// /// does not support reading. /// - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public static ValueTask HashDataAsync(byte[] key, Stream source, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(key); @@ -313,7 +313,7 @@ public static ValueTask HashDataAsync(byte[] key, Stream source, Cancell /// does not support reading. ///

/// - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public static ValueTask HashDataAsync( ReadOnlyMemory key, Stream source, diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/MD5.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/MD5.cs index 31dad400f6c8d..49426a04268ff 100644 --- a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/MD5.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/MD5.cs @@ -34,7 +34,7 @@ protected MD5() HashSizeValue = HashSizeInBits; } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public static new MD5 Create() => new Implementation(); [Obsolete(Obsoletions.CryptoStringFactoryMessage, DiagnosticId = Obsoletions.CryptoStringFactoryDiagId, UrlFormat = Obsoletions.SharedUrlFormat)] @@ -49,7 +49,7 @@ protected MD5() /// /// is . /// - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public static byte[] HashData(byte[] source) { ArgumentNullException.ThrowIfNull(source); @@ -62,7 +62,7 @@ public static byte[] HashData(byte[] source) /// /// The data to hash. /// The hash of the data. - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public static byte[] HashData(ReadOnlySpan source) { byte[] buffer = GC.AllocateUninitializedArray(HashSizeInBytes); @@ -83,7 +83,7 @@ public static byte[] HashData(ReadOnlySpan source) /// The buffer in is too small to hold the calculated hash /// size. The MD5 algorithm always produces a 128-bit hash, or 16 bytes. /// - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public static int HashData(ReadOnlySpan source, Span destination) { if (!TryHashData(source, destination, out int bytesWritten)) @@ -104,7 +104,7 @@ public static int HashData(ReadOnlySpan source, Span destination) /// if is too small to hold the /// calculated hash, otherwise. /// - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public static bool TryHashData(ReadOnlySpan source, Span destination, out int bytesWritten) { if (destination.Length < HashSizeInBytes) @@ -138,7 +138,7 @@ public static bool TryHashData(ReadOnlySpan source, Span destination /// does not support reading. ///

/// - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public static int HashData(Stream source, Span destination) { ArgumentNullException.ThrowIfNull(source); @@ -163,7 +163,7 @@ public static int HashData(Stream source, Span destination) /// /// does not support reading. /// - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public static byte[] HashData(Stream source) { ArgumentNullException.ThrowIfNull(source); @@ -189,7 +189,7 @@ public static byte[] HashData(Stream source) /// /// does not support reading. /// - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public static ValueTask HashDataAsync(Stream source, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(source); @@ -223,7 +223,7 @@ public static ValueTask HashDataAsync(Stream source, CancellationToken c /// does not support reading. ///

/// - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public static ValueTask HashDataAsync( Stream source, Memory destination, diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/OpenSsl.NotSupported.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/OpenSsl.NotSupported.cs index b5611338e8daa..698806413c8c6 100644 --- a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/OpenSsl.NotSupported.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/OpenSsl.NotSupported.cs @@ -9,7 +9,7 @@ namespace System.Security.Cryptography public sealed class DSAOpenSsl : DSA { [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] [UnsupportedOSPlatform("windows")] @@ -19,7 +19,7 @@ public DSAOpenSsl() } [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] [UnsupportedOSPlatform("windows")] @@ -29,7 +29,7 @@ public DSAOpenSsl(int keySize) } [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] [UnsupportedOSPlatform("windows")] @@ -39,7 +39,7 @@ public DSAOpenSsl(IntPtr handle) } [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] [UnsupportedOSPlatform("windows")] @@ -49,7 +49,7 @@ public DSAOpenSsl(DSAParameters parameters) } [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] [UnsupportedOSPlatform("windows")] @@ -67,7 +67,7 @@ public override void ImportParameters(DSAParameters parameters) { } public sealed class ECDiffieHellmanOpenSsl : ECDiffieHellman { [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] [UnsupportedOSPlatform("windows")] @@ -77,7 +77,7 @@ public ECDiffieHellmanOpenSsl() } [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] [UnsupportedOSPlatform("windows")] @@ -87,7 +87,7 @@ public ECDiffieHellmanOpenSsl(int keySize) } [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] [UnsupportedOSPlatform("windows")] @@ -97,7 +97,7 @@ public ECDiffieHellmanOpenSsl(IntPtr handle) } [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] [UnsupportedOSPlatform("windows")] @@ -107,7 +107,7 @@ public ECDiffieHellmanOpenSsl(ECCurve curve) } [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] [UnsupportedOSPlatform("windows")] @@ -124,7 +124,7 @@ public override void ImportParameters(ECParameters parameters) { } public sealed class ECDsaOpenSsl : ECDsa { [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] [UnsupportedOSPlatform("windows")] @@ -134,7 +134,7 @@ public ECDsaOpenSsl() } [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] [UnsupportedOSPlatform("windows")] @@ -144,7 +144,7 @@ public ECDsaOpenSsl(int keySize) } [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] [UnsupportedOSPlatform("windows")] @@ -154,7 +154,7 @@ public ECDsaOpenSsl(IntPtr handle) } [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] [UnsupportedOSPlatform("windows")] @@ -164,7 +164,7 @@ public ECDsaOpenSsl(ECCurve curve) } [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] [UnsupportedOSPlatform("windows")] @@ -180,7 +180,7 @@ public ECDsaOpenSsl(SafeEvpPKeyHandle pkeyHandle) public sealed class RSAOpenSsl : RSA { [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] [UnsupportedOSPlatform("windows")] @@ -190,7 +190,7 @@ public RSAOpenSsl() } [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] [UnsupportedOSPlatform("windows")] @@ -200,7 +200,7 @@ public RSAOpenSsl(int keySize) } [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] [UnsupportedOSPlatform("windows")] @@ -210,7 +210,7 @@ public RSAOpenSsl(IntPtr handle) } [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] [UnsupportedOSPlatform("windows")] @@ -220,7 +220,7 @@ public RSAOpenSsl(RSAParameters parameters) } [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] [UnsupportedOSPlatform("windows")] @@ -236,7 +236,7 @@ public override void ImportParameters(RSAParameters parameters) { } public sealed class SafeEvpPKeyHandle : SafeHandle { [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] [UnsupportedOSPlatform("windows")] @@ -246,7 +246,7 @@ public SafeEvpPKeyHandle() : base(IntPtr.Zero, false) } [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] [UnsupportedOSPlatform("windows")] @@ -256,7 +256,7 @@ public SafeEvpPKeyHandle(IntPtr handle, bool ownsHandle) : base(handle, ownsHand } [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] [UnsupportedOSPlatform("windows")] diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RC2.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RC2.cs index 97020e10d5d12..bb53e1352e3c0 100644 --- a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RC2.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RC2.cs @@ -22,7 +22,7 @@ protected RC2() } [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public static new RC2 Create() { return new RC2Implementation(); diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RC2CryptoServiceProvider.NotSupported.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RC2CryptoServiceProvider.NotSupported.cs index 1c5dcb868862e..2e29331620413 100644 --- a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RC2CryptoServiceProvider.NotSupported.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RC2CryptoServiceProvider.NotSupported.cs @@ -13,7 +13,7 @@ public sealed partial class RC2CryptoServiceProvider : RC2 { [SuppressMessage("Microsoft.Security", "CA5351", Justification = "This is the implementation of RC2CryptoServiceProvider")] [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public RC2CryptoServiceProvider() { throw new PlatformNotSupportedException(); diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RC2CryptoServiceProvider.Unix.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RC2CryptoServiceProvider.Unix.cs index 4824979408459..d076a6e0958bb 100644 --- a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RC2CryptoServiceProvider.Unix.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RC2CryptoServiceProvider.Unix.cs @@ -19,7 +19,7 @@ public sealed partial class RC2CryptoServiceProvider : RC2 [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA5351", Justification = "This is the implementation of RC2CryptoServiceProvider")] [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public RC2CryptoServiceProvider() { _impl = RC2.Create(); diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RC2CryptoServiceProvider.Windows.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RC2CryptoServiceProvider.Windows.cs index c7e0cc4003d71..40fd18db04bd5 100644 --- a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RC2CryptoServiceProvider.Windows.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RC2CryptoServiceProvider.Windows.cs @@ -21,7 +21,7 @@ public sealed class RC2CryptoServiceProvider : RC2 }; [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public RC2CryptoServiceProvider() { LegalKeySizesValue = s_legalKeySizes.CloneKeySizesArray(); diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSA.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSA.cs index 375c1f2b1cf9d..07f7de5c2b759 100644 --- a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSA.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSA.cs @@ -15,7 +15,7 @@ namespace System.Security.Cryptography { public abstract partial class RSA : AsymmetricAlgorithm { - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public static new partial RSA Create(); [Obsolete(Obsoletions.CryptoStringFactoryMessage, DiagnosticId = Obsoletions.CryptoStringFactoryDiagId, UrlFormat = Obsoletions.SharedUrlFormat)] @@ -25,7 +25,7 @@ public abstract partial class RSA : AsymmetricAlgorithm return (RSA?)CryptoConfig.CreateFromName(algName); } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public static RSA Create(int keySizeInBits) { RSA rsa = Create(); @@ -42,7 +42,7 @@ public static RSA Create(int keySizeInBits) } } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public static RSA Create(RSAParameters parameters) { RSA rsa = Create(); diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSACryptoServiceProvider.NotSupported.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSACryptoServiceProvider.NotSupported.cs index 4be85c451896d..f1e5812c75741 100644 --- a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSACryptoServiceProvider.NotSupported.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSACryptoServiceProvider.NotSupported.cs @@ -8,13 +8,13 @@ namespace System.Security.Cryptography { public sealed partial class RSACryptoServiceProvider : RSA, ICspAsymmetricAlgorithm { - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public RSACryptoServiceProvider() { throw new PlatformNotSupportedException(); } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public RSACryptoServiceProvider(int dwKeySize) { throw new PlatformNotSupportedException(); diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSACryptoServiceProvider.Unix.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSACryptoServiceProvider.Unix.cs index 374faf2d85d37..fb23645272483 100644 --- a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSACryptoServiceProvider.Unix.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSACryptoServiceProvider.Unix.cs @@ -14,11 +14,11 @@ public sealed partial class RSACryptoServiceProvider : RSA, ICspAsymmetricAlgori private readonly RSA _impl; private bool _publicOnly; - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public RSACryptoServiceProvider() : this(DefaultKeySize) { } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public RSACryptoServiceProvider(int dwKeySize) { if (dwKeySize < 0) diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSACryptoServiceProvider.Windows.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSACryptoServiceProvider.Windows.cs index 5050cd0e4796a..8aba26cc6bf64 100644 --- a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSACryptoServiceProvider.Windows.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSACryptoServiceProvider.Windows.cs @@ -20,7 +20,7 @@ public sealed partial class RSACryptoServiceProvider : RSA, ICspAsymmetricAlgori private static volatile CspProviderFlags s_useMachineKeyStore; private bool _disposed; - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public RSACryptoServiceProvider() : this(0, new CspParameters(CapiHelper.DefaultRsaProviderType, null, @@ -30,7 +30,7 @@ public RSACryptoServiceProvider() { } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public RSACryptoServiceProvider(int dwKeySize) : this(dwKeySize, new CspParameters(CapiHelper.DefaultRsaProviderType, diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSAOpenSsl.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSAOpenSsl.cs index b2ad115fd34d9..8e206416034db 100644 --- a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSAOpenSsl.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSAOpenSsl.cs @@ -10,7 +10,7 @@ namespace System.Security.Cryptography public sealed partial class RSAOpenSsl : RSA { [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] [UnsupportedOSPlatform("windows")] @@ -34,7 +34,7 @@ public RSAOpenSsl(RSAParameters parameters) /// A pointer to an OpenSSL RSA* /// is invalid [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] [UnsupportedOSPlatform("windows")] @@ -61,7 +61,7 @@ public RSAOpenSsl(IntPtr handle) /// /// is not a valid enveloped RSA* [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] [UnsupportedOSPlatform("windows")] diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSAPKCS1SignatureDeformatter.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSAPKCS1SignatureDeformatter.cs index 11ce2d106648e..90fe45bf2b7aa 100644 --- a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSAPKCS1SignatureDeformatter.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSAPKCS1SignatureDeformatter.cs @@ -6,7 +6,7 @@ namespace System.Security.Cryptography { - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public class RSAPKCS1SignatureDeformatter : AsymmetricSignatureDeformatter { private RSA? _rsaKey; diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSAPKCS1SignatureFormatter.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSAPKCS1SignatureFormatter.cs index a85e5d68f6fea..a5dd7dba1dae5 100644 --- a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSAPKCS1SignatureFormatter.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSAPKCS1SignatureFormatter.cs @@ -6,7 +6,7 @@ namespace System.Security.Cryptography { - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public class RSAPKCS1SignatureFormatter : AsymmetricSignatureFormatter { private RSA? _rsaKey; diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/Rijndael.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/Rijndael.cs index 4c9de50ee6e2c..05e99249eb43f 100644 --- a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/Rijndael.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/Rijndael.cs @@ -12,7 +12,7 @@ namespace System.Security.Cryptography [EditorBrowsable(EditorBrowsableState.Never)] public abstract class Rijndael : SymmetricAlgorithm { - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public static new Rijndael Create() { return new RijndaelImplementation(); diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RijndaelImplementation.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RijndaelImplementation.cs index 698926032dfdb..f7d825c77940a 100644 --- a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RijndaelImplementation.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RijndaelImplementation.cs @@ -17,7 +17,7 @@ internal sealed class RijndaelImplementation : Rijndael { private readonly Aes _impl; - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] internal RijndaelImplementation() { LegalBlockSizesValue = new KeySizes[] { new KeySizes(minSize: 128, maxSize: 128, skipSize: 0) }; diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RijndaelManaged.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RijndaelManaged.cs index 2c866a2459f69..43881fc723b9e 100644 --- a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RijndaelManaged.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RijndaelManaged.cs @@ -9,7 +9,7 @@ namespace System.Security.Cryptography { [Obsolete(Obsoletions.RijndaelMessage, DiagnosticId = Obsoletions.RijndaelDiagId, UrlFormat = Obsoletions.SharedUrlFormat)] [EditorBrowsable(EditorBrowsableState.Never)] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public sealed class RijndaelManaged : Rijndael { private readonly Aes _impl; diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/SafeEvpPKeyHandle.OpenSsl.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/SafeEvpPKeyHandle.OpenSsl.cs index 99c0f42106db8..a25dbd1100843 100644 --- a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/SafeEvpPKeyHandle.OpenSsl.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/SafeEvpPKeyHandle.OpenSsl.cs @@ -12,7 +12,7 @@ public sealed class SafeEvpPKeyHandle : SafeHandle internal static readonly SafeEvpPKeyHandle InvalidHandle = new SafeEvpPKeyHandle(); [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] [UnsupportedOSPlatform("windows")] @@ -22,7 +22,7 @@ public SafeEvpPKeyHandle() : } [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] [UnsupportedOSPlatform("windows")] @@ -81,7 +81,7 @@ public SafeEvpPKeyHandle DuplicateHandle() /// for OpenSSL 1.0.x this is the result of SSLeay(). /// [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] [UnsupportedOSPlatform("windows")] diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/TripleDES.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/TripleDES.cs index d70e60fdc47f3..ccf23ad6d67d0 100644 --- a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/TripleDES.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/TripleDES.cs @@ -20,7 +20,7 @@ protected TripleDES() LegalKeySizesValue = s_legalKeySizes.CloneKeySizesArray(); } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public static new TripleDES Create() { return new TripleDesImplementation(); diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/CertificateRequest.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/CertificateRequest.cs index c3084c964d7dc..d5af321b7dc4d 100644 --- a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/CertificateRequest.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/CertificateRequest.cs @@ -17,7 +17,7 @@ namespace System.Security.Cryptography.X509Certificates /// allowing callers to create self-signed or chain-signed X.509 Public-Key Certificates, as well as /// create a certificate signing request blob to send to a Certificate Authority (CA). /// - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public sealed partial class CertificateRequest { private readonly AsymmetricAlgorithm? _key; diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/PublicKey.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/PublicKey.cs index e53f36d403e4b..a70a2f32e211e 100644 --- a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/PublicKey.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/PublicKey.cs @@ -148,7 +148,7 @@ public static PublicKey CreateFromSubjectPublicKeyInfo(ReadOnlySpan source /// /// The key contents are corrupt or could not be read successfully. /// - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public RSA? GetRSAPublicKey() { if (_oid.Value != Oids.Rsa) @@ -177,7 +177,7 @@ public static PublicKey CreateFromSubjectPublicKeyInfo(ReadOnlySpan source /// /// The key contents are corrupt or could not be read successfully. /// - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] public DSA? GetDSAPublicKey() @@ -208,7 +208,7 @@ public static PublicKey CreateFromSubjectPublicKeyInfo(ReadOnlySpan source /// /// The key contents are corrupt or could not be read successfully. /// - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public ECDsa? GetECDsaPublicKey() { if (_oid.Value != Oids.EcPublicKey) @@ -238,7 +238,7 @@ public static PublicKey CreateFromSubjectPublicKeyInfo(ReadOnlySpan source /// /// The key contents are corrupt or could not be read successfully. /// - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public ECDiffieHellman? GetECDiffieHellmanPublicKey() { if (_oid.Value != Oids.EcPublicKey) diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/X509Certificate.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/X509Certificate.cs index 59a82d473dc57..51be2962e33e1 100644 --- a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/X509Certificate.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/X509Certificate.cs @@ -45,13 +45,13 @@ public virtual void Reset() } [Obsolete(Obsoletions.X509CertificateImmutableMessage, DiagnosticId = Obsoletions.X509CertificateImmutableDiagId, UrlFormat = Obsoletions.SharedUrlFormat)] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public X509Certificate() { } // Null turns into the empty span here, which is correct for compat. - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public X509Certificate(byte[] data) : this(new ReadOnlySpan(data)) { @@ -69,20 +69,20 @@ private protected X509Certificate(ReadOnlySpan data) } } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public X509Certificate(byte[] rawData, string? password) : this(rawData, password, X509KeyStorageFlags.DefaultKeySet) { } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [CLSCompliantAttribute(false)] public X509Certificate(byte[] rawData, SecureString? password) : this(rawData, password, X509KeyStorageFlags.DefaultKeySet) { } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public X509Certificate(byte[] rawData, string? password, X509KeyStorageFlags keyStorageFlags) { if (rawData == null || rawData.Length == 0) @@ -96,7 +96,7 @@ public X509Certificate(byte[] rawData, string? password, X509KeyStorageFlags key } } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [CLSCompliantAttribute(false)] public X509Certificate(byte[] rawData, SecureString? password, X509KeyStorageFlags keyStorageFlags) { @@ -124,7 +124,7 @@ private protected X509Certificate(ReadOnlySpan rawData, ReadOnlySpan } } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public X509Certificate(IntPtr handle) { Pal = CertificatePal.FromHandle(handle); @@ -136,26 +136,26 @@ internal X509Certificate(ICertificatePalCore pal) Pal = pal; } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public X509Certificate(string fileName) : this(fileName, (string?)null, X509KeyStorageFlags.DefaultKeySet) { } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public X509Certificate(string fileName, string? password) : this(fileName, password, X509KeyStorageFlags.DefaultKeySet) { } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [CLSCompliantAttribute(false)] public X509Certificate(string fileName, SecureString? password) : this(fileName, password, X509KeyStorageFlags.DefaultKeySet) { } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public X509Certificate(string fileName, string? password, X509KeyStorageFlags keyStorageFlags) { ArgumentNullException.ThrowIfNull(fileName); @@ -180,7 +180,7 @@ private protected X509Certificate(string fileName, ReadOnlySpan password, } } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [CLSCompliantAttribute(false)] #pragma warning disable SYSLIB0026 public X509Certificate(string fileName, SecureString? password, X509KeyStorageFlags keyStorageFlags) : this() @@ -196,7 +196,7 @@ public X509Certificate(string fileName, SecureString? password, X509KeyStorageFl } } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public X509Certificate(X509Certificate cert) { ArgumentNullException.ThrowIfNull(cert); @@ -214,13 +214,13 @@ public X509Certificate(SerializationInfo info, StreamingContext context) : this( throw new PlatformNotSupportedException(); } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public static X509Certificate CreateFromCertFile(string filename) { return new X509Certificate(filename); } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public static X509Certificate CreateFromSignedFile(string filename) { return new X509Certificate(filename); diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/X509Certificate2.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/X509Certificate2.cs index b2855084370f4..54de8862e1a62 100644 --- a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/X509Certificate2.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/X509Certificate2.cs @@ -42,38 +42,38 @@ public override void Reset() } [Obsolete(Obsoletions.X509CertificateImmutableMessage, DiagnosticId = Obsoletions.X509CertificateImmutableDiagId, UrlFormat = Obsoletions.SharedUrlFormat)] - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public X509Certificate2() : base() { } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public X509Certificate2(byte[] rawData) : base(rawData) { } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public X509Certificate2(byte[] rawData, string? password) : base(rawData, password) { } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [CLSCompliantAttribute(false)] public X509Certificate2(byte[] rawData, SecureString? password) : base(rawData, password) { } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public X509Certificate2(byte[] rawData, string? password, X509KeyStorageFlags keyStorageFlags) : base(rawData, password, keyStorageFlags) { } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [CLSCompliantAttribute(false)] public X509Certificate2(byte[] rawData, SecureString? password, X509KeyStorageFlags keyStorageFlags) : base(rawData, password, keyStorageFlags) @@ -87,7 +87,7 @@ public X509Certificate2(byte[] rawData, SecureString? password, X509KeyStorageFl /// The certificate data to process. /// /// An error with the certificate occurs. - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public X509Certificate2(ReadOnlySpan rawData) : base(rawData) { @@ -107,13 +107,13 @@ public X509Certificate2(ReadOnlySpan rawData) /// A bitwise combination of the enumeration values that control where and how to import the certificate. /// /// An error with the certificate occurs. - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public X509Certificate2(ReadOnlySpan rawData, ReadOnlySpan password, X509KeyStorageFlags keyStorageFlags = 0) : base(rawData, password, keyStorageFlags) { } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public X509Certificate2(IntPtr handle) : base(handle) { @@ -124,45 +124,45 @@ internal X509Certificate2(ICertificatePal pal) { } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public X509Certificate2(string fileName) : base(fileName) { } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public X509Certificate2(string fileName, string? password) : base(fileName, password) { } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [CLSCompliantAttribute(false)] public X509Certificate2(string fileName, SecureString? password) : base(fileName, password) { } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public X509Certificate2(string fileName, string? password, X509KeyStorageFlags keyStorageFlags) : base(fileName, password, keyStorageFlags) { } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] [CLSCompliantAttribute(false)] public X509Certificate2(string fileName, SecureString? password, X509KeyStorageFlags keyStorageFlags) : base(fileName, password, keyStorageFlags) { } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public X509Certificate2(string fileName, ReadOnlySpan password, X509KeyStorageFlags keyStorageFlags = 0) : base(fileName, password, keyStorageFlags) { } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public X509Certificate2(X509Certificate certificate) : base(certificate) { @@ -376,7 +376,7 @@ public int Version } } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public static X509ContentType GetCertContentType(byte[] rawData) { if (rawData == null || rawData.Length == 0) @@ -394,7 +394,7 @@ public static X509ContentType GetCertContentType(byte[] rawData) /// /// One of the enumeration values that indicate the content type of the provided data. /// - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public static X509ContentType GetCertContentType(ReadOnlySpan rawData) { if (rawData.Length == 0) @@ -403,7 +403,7 @@ public static X509ContentType GetCertContentType(ReadOnlySpan rawData) return X509Pal.Instance.GetCertContentType(rawData); } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public static X509ContentType GetCertContentType(string fileName) { ArgumentNullException.ThrowIfNull(fileName); @@ -818,7 +818,7 @@ public X509Certificate2 CopyWithPrivateKey(ECDiffieHellman privateKey) /// For password protected PEM-encoded keys, use to specify a password. /// /// - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public static X509Certificate2 CreateFromPemFile(string certPemFilePath, string? keyPemFilePath = default) { ArgumentNullException.ThrowIfNull(certPemFilePath); @@ -884,7 +884,7 @@ public static X509Certificate2 CreateFromPemFile(string certPemFilePath, string? /// For PEM-encoded keys without a password, use . /// /// - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public static X509Certificate2 CreateFromEncryptedPemFile(string certPemFilePath, ReadOnlySpan password, string? keyPemFilePath = default) { ArgumentNullException.ThrowIfNull(certPemFilePath); @@ -934,7 +934,7 @@ public static X509Certificate2 CreateFromEncryptedPemFile(string certPemFilePath /// For password protected PEM-encoded keys, use to specify a password. /// /// - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public static X509Certificate2 CreateFromPem(ReadOnlySpan certPem, ReadOnlySpan keyPem) { using (X509Certificate2 certificate = CreateFromPem(certPem)) @@ -1005,7 +1005,7 @@ Oids.EcPublicKey when IsECDiffieHellman(certificate) => /// For PEM-encoded keys without a password, use . /// /// - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public static X509Certificate2 CreateFromEncryptedPem(ReadOnlySpan certPem, ReadOnlySpan keyPem, ReadOnlySpan password) { using (X509Certificate2 certificate = CreateFromPem(certPem)) @@ -1070,7 +1070,7 @@ private static bool IsECDiffieHellman(X509Certificate2 certificate) /// For PEM-encoded certificates in a file, use . /// /// - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public static X509Certificate2 CreateFromPem(ReadOnlySpan certPem) { foreach ((ReadOnlySpan contents, PemFields fields) in new PemEnumerator(certPem)) diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/X509Chain.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/X509Chain.cs index 50eaba6eb91b9..6fdb9111e8dc4 100644 --- a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/X509Chain.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/X509Chain.cs @@ -85,7 +85,7 @@ public SafeX509ChainHandle? SafeHandle } } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public bool Build(X509Certificate2 certificate) { return Build(certificate, true); 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 37e7d332f8433..0f63651fb135b 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,6 +1,6 @@ - $(NetCoreAppCurrent)-Browser;$(NetCoreAppCurrent);$(NetCoreAppMinimum)-Browser;$(NetCoreAppMinimum);netstandard2.0;$(NetFrameworkMinimum) + $(NetCoreAppCurrent)-Browser;$(NetCoreAppCurrent)-wasi;$(NetCoreAppCurrent);$(NetCoreAppMinimum)-Browser;$(NetCoreAppMinimum)-wasi;$(NetCoreAppMinimum);netstandard2.0;$(NetFrameworkMinimum) true @@ -18,6 +18,7 @@ System.Text.Encodings.Web.JavaScriptEncoder $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) $(DefineConstants);TARGET_BROWSER + $(DefineConstants);TARGET_WASI diff --git a/src/libraries/System.Text.Encodings.Web/src/System/Text/Encodings/Web/OptimizedInboxTextEncoder.Ascii.cs b/src/libraries/System.Text.Encodings.Web/src/System/Text/Encodings/Web/OptimizedInboxTextEncoder.Ascii.cs index 03c0e7fc324bf..859b5c5eef9ff 100644 --- a/src/libraries/System.Text.Encodings.Web/src/System/Text/Encodings/Web/OptimizedInboxTextEncoder.Ascii.cs +++ b/src/libraries/System.Text.Encodings.Web/src/System/Text/Encodings/Web/OptimizedInboxTextEncoder.Ascii.cs @@ -23,7 +23,7 @@ private unsafe partial struct AllowedAsciiCodePoints private fixed byte AsBytes[16]; #if NETCOREAPP -#if !TARGET_BROWSER +#if !TARGET_BROWSER && !TARGET_WASI [FieldOffset(0)] // ensure same offset with AsBytes field internal Vector128 AsVector; #else 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 a64f09a25ff31..045ed694747b4 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 @@ -238,7 +238,7 @@ public static void Invoke(ParallelOptions parallelOptions, params Action[] actio // If we've gotten this far, it's time to process the actions. // Web browsers need special treatment that is implemented in TaskReplicator - if (OperatingSystem.IsBrowser() || + if (OperatingSystem.IsBrowser() || OperatingSystem.IsOSPlatform("Wasi") || // This is more efficient for a large number of actions, or for enforcing MaxDegreeOfParallelism: (actionsCopy.Length > SMALL_ACTIONCOUNT_LIMIT) || (parallelOptions.MaxDegreeOfParallelism != -1 && parallelOptions.MaxDegreeOfParallelism < actionsCopy.Length) 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 a84113bd775aa..eeed2f8647067 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 @@ -133,7 +133,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 (OperatingSystem.IsBrowser()) { + if (OperatingSystem.IsBrowser() || OperatingSystem.IsOSPlatform("Wasi")) { // Since we are running on a single thread, we don't want the action to time out var timeout = int.MaxValue - 1; var state = default(TState)!; diff --git a/src/libraries/System.Threading.Thread/ref/System.Threading.Thread.cs b/src/libraries/System.Threading.Thread/ref/System.Threading.Thread.cs index d764627ce6365..58dc6dc68f80f 100644 --- a/src/libraries/System.Threading.Thread/ref/System.Threading.Thread.cs +++ b/src/libraries/System.Threading.Thread/ref/System.Threading.Thread.cs @@ -90,22 +90,22 @@ public static void Sleep(int millisecondsTimeout) { } public static void Sleep(System.TimeSpan timeout) { } public static void SpinWait(int iterations) { } #if !FEATURE_WASM_THREADS - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] #endif public void Start() { } #if !FEATURE_WASM_THREADS - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] #endif public void Start(object? parameter) { } [System.ObsoleteAttribute("Thread.Suspend has been deprecated. Use other classes in System.Threading, such as Monitor, Mutex, Event, and Semaphore, to synchronize Threads or protect resources.")] public void Suspend() { } public bool TrySetApartmentState(System.Threading.ApartmentState state) { throw null; } #if !FEATURE_WASM_THREADS - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] #endif public void UnsafeStart() { } #if !FEATURE_WASM_THREADS - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] #endif public void UnsafeStart(object? parameter) { } public static byte VolatileRead(ref byte address) { throw null; } diff --git a/src/libraries/System.Threading.ThreadPool/ref/System.Threading.ThreadPool.cs b/src/libraries/System.Threading.ThreadPool/ref/System.Threading.ThreadPool.cs index 20ca9318b980c..08ec181ab4f81 100644 --- a/src/libraries/System.Threading.ThreadPool/ref/System.Threading.ThreadPool.cs +++ b/src/libraries/System.Threading.ThreadPool/ref/System.Threading.ThreadPool.cs @@ -11,7 +11,7 @@ public partial interface IThreadPoolWorkItem void Execute(); } #if !FEATURE_WASM_THREADS - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] #endif public sealed partial class RegisteredWaitHandle : System.MarshalByRefObject { @@ -35,20 +35,20 @@ public static partial class ThreadPool public static bool QueueUserWorkItem(System.Threading.WaitCallback callBack, object? state) { throw null; } public static bool QueueUserWorkItem(System.Action callBack, TState state, bool preferLocal) { throw null; } #if !FEATURE_WASM_THREADS - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] #endif public static System.Threading.RegisteredWaitHandle RegisterWaitForSingleObject(System.Threading.WaitHandle waitObject, System.Threading.WaitOrTimerCallback callBack, object? state, int millisecondsTimeOutInterval, bool executeOnlyOnce) { throw null; } #if !FEATURE_WASM_THREADS - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] #endif public static System.Threading.RegisteredWaitHandle RegisterWaitForSingleObject(System.Threading.WaitHandle waitObject, System.Threading.WaitOrTimerCallback callBack, object? state, long millisecondsTimeOutInterval, bool executeOnlyOnce) { throw null; } #if !FEATURE_WASM_THREADS - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] #endif public static System.Threading.RegisteredWaitHandle RegisterWaitForSingleObject(System.Threading.WaitHandle waitObject, System.Threading.WaitOrTimerCallback callBack, object? state, System.TimeSpan timeout, bool executeOnlyOnce) { throw null; } [System.CLSCompliantAttribute(false)] #if !FEATURE_WASM_THREADS - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] #endif public static System.Threading.RegisteredWaitHandle RegisterWaitForSingleObject(System.Threading.WaitHandle waitObject, System.Threading.WaitOrTimerCallback callBack, object? state, uint millisecondsTimeOutInterval, bool executeOnlyOnce) { throw null; } public static bool SetMaxThreads(int workerThreads, int completionPortThreads) { throw null; } @@ -60,20 +60,20 @@ public static partial class ThreadPool public static bool UnsafeQueueUserWorkItem(System.Threading.WaitCallback callBack, object? state) { throw null; } public static bool UnsafeQueueUserWorkItem(System.Action callBack, TState state, bool preferLocal) { throw null; } #if !FEATURE_WASM_THREADS - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] #endif public static System.Threading.RegisteredWaitHandle UnsafeRegisterWaitForSingleObject(System.Threading.WaitHandle waitObject, System.Threading.WaitOrTimerCallback callBack, object? state, int millisecondsTimeOutInterval, bool executeOnlyOnce) { throw null; } #if !FEATURE_WASM_THREADS - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] #endif public static System.Threading.RegisteredWaitHandle UnsafeRegisterWaitForSingleObject(System.Threading.WaitHandle waitObject, System.Threading.WaitOrTimerCallback callBack, object? state, long millisecondsTimeOutInterval, bool executeOnlyOnce) { throw null; } #if !FEATURE_WASM_THREADS - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] #endif public static System.Threading.RegisteredWaitHandle UnsafeRegisterWaitForSingleObject(System.Threading.WaitHandle waitObject, System.Threading.WaitOrTimerCallback callBack, object? state, System.TimeSpan timeout, bool executeOnlyOnce) { throw null; } [System.CLSCompliantAttribute(false)] #if !FEATURE_WASM_THREADS - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] #endif public static System.Threading.RegisteredWaitHandle UnsafeRegisterWaitForSingleObject(System.Threading.WaitHandle waitObject, System.Threading.WaitOrTimerCallback callBack, object? state, uint millisecondsTimeOutInterval, bool executeOnlyOnce) { throw null; } } diff --git a/src/libraries/System.Threading/ref/System.Threading.cs b/src/libraries/System.Threading/ref/System.Threading.cs index 2963a3ad970c4..2cf38ca9da6ca 100644 --- a/src/libraries/System.Threading/ref/System.Threading.cs +++ b/src/libraries/System.Threading/ref/System.Threading.cs @@ -14,25 +14,25 @@ public Barrier(int participantCount, System.Action? po public long CurrentPhaseNumber { get { throw null; } } public int ParticipantCount { get { throw null; } } public int ParticipantsRemaining { get { throw null; } } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public long AddParticipant() { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public long AddParticipants(int participantCount) { throw null; } public void Dispose() { } protected virtual void Dispose(bool disposing) { } public void RemoveParticipant() { } public void RemoveParticipants(int participantCount) { } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public void SignalAndWait() { } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public bool SignalAndWait(int millisecondsTimeout) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public bool SignalAndWait(int millisecondsTimeout, System.Threading.CancellationToken cancellationToken) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public void SignalAndWait(System.Threading.CancellationToken cancellationToken) { } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public bool SignalAndWait(System.TimeSpan timeout) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public bool SignalAndWait(System.TimeSpan timeout, System.Threading.CancellationToken cancellationToken) { throw null; } } public partial class BarrierPostPhaseException : System.Exception @@ -60,17 +60,17 @@ public void Reset(int count) { } public bool Signal(int signalCount) { throw null; } public bool TryAddCount() { throw null; } public bool TryAddCount(int signalCount) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public void Wait() { } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public bool Wait(int millisecondsTimeout) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public bool Wait(int millisecondsTimeout, System.Threading.CancellationToken cancellationToken) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public void Wait(System.Threading.CancellationToken cancellationToken) { } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public bool Wait(System.TimeSpan timeout) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public bool Wait(System.TimeSpan timeout, System.Threading.CancellationToken cancellationToken) { throw null; } } public partial class HostExecutionContext : System.IDisposable @@ -104,9 +104,9 @@ public ReaderWriterLock() { } public bool IsReaderLockHeld { get { throw null; } } public bool IsWriterLockHeld { get { throw null; } } public int WriterSeqNum { get { throw null; } } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public void AcquireReaderLock(int millisecondsTimeout) { } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public void AcquireReaderLock(System.TimeSpan timeout) { } public void AcquireWriterLock(int millisecondsTimeout) { } public void AcquireWriterLock(System.TimeSpan timeout) { } @@ -115,11 +115,11 @@ public void DowngradeFromWriterLock(ref System.Threading.LockCookie lockCookie) public System.Threading.LockCookie ReleaseLock() { throw null; } public void ReleaseReaderLock() { } public void ReleaseWriterLock() { } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public void RestoreLock(ref System.Threading.LockCookie lockCookie) { } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public System.Threading.LockCookie UpgradeToWriterLock(int millisecondsTimeout) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public System.Threading.LockCookie UpgradeToWriterLock(System.TimeSpan timeout) { throw null; } } } @@ -305,17 +305,17 @@ public void Dispose() { } protected virtual void Dispose(bool disposing) { } public void Reset() { } public void Set() { } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public void Wait() { } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public bool Wait(int millisecondsTimeout) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public bool Wait(int millisecondsTimeout, System.Threading.CancellationToken cancellationToken) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public void Wait(System.Threading.CancellationToken cancellationToken) { } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public bool Wait(System.TimeSpan timeout) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public bool Wait(System.TimeSpan timeout, System.Threading.CancellationToken cancellationToken) { throw null; } } public static partial class Monitor @@ -333,15 +333,15 @@ public static void TryEnter(object obj, ref bool lockTaken) { } public static void TryEnter(object obj, int millisecondsTimeout, ref bool lockTaken) { } public static bool TryEnter(object obj, System.TimeSpan timeout) { throw null; } public static void TryEnter(object obj, System.TimeSpan timeout, ref bool lockTaken) { } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static bool Wait(object obj) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static bool Wait(object obj, int millisecondsTimeout) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static bool Wait(object obj, int millisecondsTimeout, bool exitContext) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static bool Wait(object obj, System.TimeSpan timeout) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public static bool Wait(object obj, System.TimeSpan timeout, bool exitContext) { throw null; } } public sealed partial class Mutex : System.Threading.WaitHandle @@ -412,17 +412,17 @@ public void Dispose() { } protected virtual void Dispose(bool disposing) { } public int Release() { throw null; } public int Release(int releaseCount) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public void Wait() { } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public bool Wait(int millisecondsTimeout) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public bool Wait(int millisecondsTimeout, System.Threading.CancellationToken cancellationToken) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public void Wait(System.Threading.CancellationToken cancellationToken) { } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public bool Wait(System.TimeSpan timeout) { throw null; } - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] public bool Wait(System.TimeSpan timeout, System.Threading.CancellationToken cancellationToken) { throw null; } public System.Threading.Tasks.Task WaitAsync() { throw null; } public System.Threading.Tasks.Task WaitAsync(int millisecondsTimeout) { throw null; } diff --git a/src/libraries/System.Threading/src/System/Threading/Barrier.cs b/src/libraries/System.Threading/src/System/Threading/Barrier.cs index 747bc2def3281..5b5584cfc4e90 100644 --- a/src/libraries/System.Threading/src/System/Threading/Barrier.cs +++ b/src/libraries/System.Threading/src/System/Threading/Barrier.cs @@ -284,7 +284,7 @@ private bool SetCurrentTotal(int currentTotal, int current, int total, bool sens /// /// The current instance has already been /// disposed. - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public long AddParticipant() { try @@ -313,7 +313,7 @@ public long AddParticipant() /// /// The current instance has already been /// disposed. - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public long AddParticipants(int participantCount) { ObjectDisposedException.ThrowIf(_disposed, this); @@ -483,7 +483,7 @@ public void RemoveParticipants(int participantCount) /// /// The current instance has already been /// disposed. - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public void SignalAndWait() { SignalAndWait(CancellationToken.None); @@ -504,7 +504,7 @@ public void SignalAndWait() /// canceled. /// The current instance has already been /// disposed. - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public void SignalAndWait(CancellationToken cancellationToken) { #if DEBUG @@ -534,7 +534,7 @@ public void SignalAndWait(CancellationToken cancellationToken) /// /// The current instance has already been /// disposed. - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public bool SignalAndWait(TimeSpan timeout) { return SignalAndWait(timeout, CancellationToken.None); @@ -562,7 +562,7 @@ public bool SignalAndWait(TimeSpan timeout) /// canceled. /// The current instance has already been /// disposed. - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public bool SignalAndWait(TimeSpan timeout, CancellationToken cancellationToken) { long totalMilliseconds = (long)timeout.TotalMilliseconds; @@ -590,7 +590,7 @@ public bool SignalAndWait(TimeSpan timeout, CancellationToken cancellationToken) /// /// The current instance has already been /// disposed. - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public bool SignalAndWait(int millisecondsTimeout) { return SignalAndWait(millisecondsTimeout, CancellationToken.None); @@ -617,7 +617,7 @@ public bool SignalAndWait(int millisecondsTimeout) /// canceled. /// The current instance has already been /// disposed. - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public bool SignalAndWait(int millisecondsTimeout, CancellationToken cancellationToken) { ObjectDisposedException.ThrowIf(_disposed, this); @@ -857,7 +857,7 @@ private void WaitCurrentPhase(ManualResetEventSlim currentPhaseEvent, long obser /// cancellation token passed to SignalAndWait /// The current phase number for this thread /// True if the event is set or the phase number changed, false if the timeout expired - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] private bool DiscontinuousWait(ManualResetEventSlim currentPhaseEvent, int totalTimeout, CancellationToken token, long observedPhase) { int maxWait = 100; // 100 ms diff --git a/src/libraries/System.Threading/src/System/Threading/CountdownEvent.cs b/src/libraries/System.Threading/src/System/Threading/CountdownEvent.cs index b7e28eba55680..a006fdf80f674 100644 --- a/src/libraries/System.Threading/src/System/Threading/CountdownEvent.cs +++ b/src/libraries/System.Threading/src/System/Threading/CountdownEvent.cs @@ -415,7 +415,7 @@ public void Reset(int count) /// /// The current instance has already been /// disposed. - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public void Wait() { Wait(Timeout.Infinite, CancellationToken.None); @@ -439,7 +439,7 @@ public void Wait() /// canceled. /// The current instance has already been /// disposed. - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public void Wait(CancellationToken cancellationToken) { Wait(Timeout.Infinite, cancellationToken); @@ -459,7 +459,7 @@ public void Wait(CancellationToken cancellationToken) /// than . /// The current instance has already been /// disposed. - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public bool Wait(TimeSpan timeout) { long totalMilliseconds = (long)timeout.TotalMilliseconds; @@ -490,7 +490,7 @@ public bool Wait(TimeSpan timeout) /// disposed. /// has /// been canceled. - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public bool Wait(TimeSpan timeout, CancellationToken cancellationToken) { long totalMilliseconds = (long)timeout.TotalMilliseconds; @@ -514,7 +514,7 @@ public bool Wait(TimeSpan timeout, CancellationToken cancellationToken) /// negative number other than -1, which represents an infinite time-out. /// The current instance has already been /// disposed. - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public bool Wait(int millisecondsTimeout) { return Wait(millisecondsTimeout, CancellationToken.None); @@ -537,7 +537,7 @@ public bool Wait(int millisecondsTimeout) /// disposed. /// has /// been canceled. - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public bool Wait(int millisecondsTimeout, CancellationToken cancellationToken) { if (millisecondsTimeout < -1) diff --git a/src/libraries/System.Threading/src/System/Threading/ReaderWriterLock.cs b/src/libraries/System.Threading/src/System/Threading/ReaderWriterLock.cs index eb14b86dd9aaa..dee919fcff48b 100644 --- a/src/libraries/System.Threading/src/System/Threading/ReaderWriterLock.cs +++ b/src/libraries/System.Threading/src/System/Threading/ReaderWriterLock.cs @@ -74,7 +74,7 @@ public bool AnyWritersSince(int seqNum) return (uint)_writerSeqNum > (uint)seqNum; } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public void AcquireReaderLock(int millisecondsTimeout) { if (millisecondsTimeout < -1) @@ -277,7 +277,7 @@ public void AcquireReaderLock(int millisecondsTimeout) ++threadLocalLockEntry._readerLevel; } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public void AcquireReaderLock(TimeSpan timeout) => AcquireReaderLock(ToTimeoutMilliseconds(timeout)); public void AcquireWriterLock(int millisecondsTimeout) @@ -668,7 +668,7 @@ public void ReleaseWriterLock() } } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public LockCookie UpgradeToWriterLock(int millisecondsTimeout) { if (millisecondsTimeout < -1) @@ -748,7 +748,7 @@ public LockCookie UpgradeToWriterLock(int millisecondsTimeout) } } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public LockCookie UpgradeToWriterLock(TimeSpan timeout) => UpgradeToWriterLock(ToTimeoutMilliseconds(timeout)); public void DowngradeFromWriterLock(ref LockCookie lockCookie) @@ -916,7 +916,7 @@ public LockCookie ReleaseLock() return lockCookie; } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public void RestoreLock(ref LockCookie lockCookie) { // Validate cookie @@ -982,7 +982,7 @@ public void RestoreLock(ref LockCookie lockCookie) /// /// Helper function that restores the lock to the original state indicated by parameters /// - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] private void RecoverLock(ref LockCookie lockCookie, LockCookieFlags flags) { // Contrary to the legacy code, this method does not use a finite timeout for recovering the previous lock state, as diff --git a/src/libraries/System.Transactions.Local/ref/System.Transactions.Local.cs b/src/libraries/System.Transactions.Local/ref/System.Transactions.Local.cs index 99e82f525ee68..efa22a86bf7b1 100644 --- a/src/libraries/System.Transactions.Local/ref/System.Transactions.Local.cs +++ b/src/libraries/System.Transactions.Local/ref/System.Transactions.Local.cs @@ -8,7 +8,7 @@ namespace System.Transactions { - [System.Runtime.Versioning.UnsupportedOSPlatform("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatform("browser"), System.Runtime.Versioning.UnsupportedOSPlatform("wasi")] public sealed partial class CommittableTransaction : System.Transactions.Transaction, System.IAsyncResult { public CommittableTransaction() { } @@ -223,7 +223,7 @@ protected TransactionPromotionException(System.Runtime.Serialization.Serializati public TransactionPromotionException(string? message) { } public TransactionPromotionException(string? message, System.Exception? innerException) { } } - [System.Runtime.Versioning.UnsupportedOSPlatform("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatform("browser"), System.Runtime.Versioning.UnsupportedOSPlatform("wasi")] public sealed partial class TransactionScope : System.IDisposable { public TransactionScope() { } diff --git a/src/libraries/System.Transactions.Local/src/System/Transactions/CommittableTransaction.cs b/src/libraries/System.Transactions.Local/src/System/Transactions/CommittableTransaction.cs index dfeace8bd4a53..ca9f0b250124f 100644 --- a/src/libraries/System.Transactions.Local/src/System/Transactions/CommittableTransaction.cs +++ b/src/libraries/System.Transactions.Local/src/System/Transactions/CommittableTransaction.cs @@ -9,7 +9,7 @@ namespace System.Transactions { - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public sealed class CommittableTransaction : Transaction, IAsyncResult { // Create a transaction with defaults diff --git a/src/libraries/System.Transactions.Local/src/System/Transactions/TransactionScope.cs b/src/libraries/System.Transactions.Local/src/System/Transactions/TransactionScope.cs index b761e13c0c2de..93e384558bd1b 100644 --- a/src/libraries/System.Transactions.Local/src/System/Transactions/TransactionScope.cs +++ b/src/libraries/System.Transactions.Local/src/System/Transactions/TransactionScope.cs @@ -33,7 +33,7 @@ public enum EnterpriseServicesInteropOption Full = 2 } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public sealed class TransactionScope : IDisposable { public TransactionScope() : this(TransactionScopeOption.Required) diff --git a/src/libraries/System.Xml.ReaderWriter/ref/System.Xml.ReaderWriter.cs b/src/libraries/System.Xml.ReaderWriter/ref/System.Xml.ReaderWriter.cs index 126e319d3d446..82754b0f09165 100644 --- a/src/libraries/System.Xml.ReaderWriter/ref/System.Xml.ReaderWriter.cs +++ b/src/libraries/System.Xml.ReaderWriter/ref/System.Xml.ReaderWriter.cs @@ -1142,9 +1142,9 @@ public partial class XmlUrlResolver : System.Xml.XmlResolver { public XmlUrlResolver() { } public System.Net.Cache.RequestCachePolicy CachePolicy { set { } } - [System.Runtime.Versioning.UnsupportedOSPlatform("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatform("browser"), System.Runtime.Versioning.UnsupportedOSPlatform("wasi")] public override System.Net.ICredentials? Credentials { set { } } - [System.Runtime.Versioning.UnsupportedOSPlatform("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatform("browser"), System.Runtime.Versioning.UnsupportedOSPlatform("wasi")] public System.Net.IWebProxy? Proxy { set { } } public override object? GetEntity(System.Uri absoluteUri, string? role, System.Type? ofObjectToReturn) { throw null; } public override System.Threading.Tasks.Task GetEntityAsync(System.Uri absoluteUri, string? role, System.Type? ofObjectToReturn) { throw null; } diff --git a/src/libraries/pretest.proj b/src/libraries/pretest.proj index 95c61b1b05073..81e67408a1018 100644 --- a/src/libraries/pretest.proj +++ b/src/libraries/pretest.proj @@ -26,12 +26,15 @@ - + + + ))] -[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.IO.Compression.ZLibException))] -[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Net.CookieVariant))] -[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Net.PathList))] +//TODOWASI [assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Collections.Generic.TreeSet<>))] +//TODOWASI [assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.IO.Compression.ZLibException))] +//TODOWASI [assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Net.CookieVariant))] +//TODOWASI [assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Net.PathList))] diff --git a/src/mono/CMakeLists.txt b/src/mono/CMakeLists.txt index cdff32677c0f5..362c402dabd5c 100644 --- a/src/mono/CMakeLists.txt +++ b/src/mono/CMakeLists.txt @@ -248,20 +248,15 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "WASI") add_definitions(-D_WASI_EMULATED_SIGNAL -D_WASI_EMULATED_MMAN -DHOST_WASI) add_definitions(-DNO_GLOBALIZATION_SHIM) add_definitions(-D_THREAD_SAFE) - add_definitions(-DGEN_PINVOKE) + add_definitions(-DDISABLE_SOCKET_TRANSPORT) + add_definitions(-DDISABLE_EGD_SOCKET) + add_definitions(-DDISABLE_EVENTPIPE) + set(ENABLE_PERFTRACING 0) + add_compile_options(-Wl,--allow-undefined) set(DISABLE_SHARED_LIBS 1) set(INTERNAL_ZLIB 1) set(DISABLE_EXECUTABLES 1) set(STATIC_COMPONENTS 1) - - set(WASI_DRIVER_SOURCES - wasi/mono-wasi-driver/driver.c - wasi/mono-wasi-driver/stubs.c - wasi/mono-wasi-driver/synthetic-pthread.c - ) - add_library(mono-wasi-driver STATIC ${WASI_DRIVER_SOURCES}) - target_compile_options(mono-wasi-driver PRIVATE -Wno-missing-prototypes -Wno-strict-prototypes) - install(TARGETS mono-wasi-driver LIBRARY) elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows") set(HOST_WIN32 1) set(EXE_SUFFIX ".exe") @@ -333,6 +328,10 @@ elseif(TARGET_SYSTEM_NAME STREQUAL "Emscripten") endif() elseif(TARGET_SYSTEM_NAME STREQUAL "WASI") set(TARGET_WASI 1) + set(DISABLE_THREADS 1) + if (CMAKE_BUILD_TYPE STREQUAL "Release") + add_compile_options(-Os) + endif() elseif(TARGET_SYSTEM_NAME STREQUAL "Windows") set(TARGET_WIN32 1) elseif(TARGET_SYSTEM_NAME STREQUAL "SunOS") @@ -679,7 +678,11 @@ elseif(HOST_OSX AND NOT HOST_MACCAT) set(OSX_ICU_LIBRARY_PATH /usr/lib/libicucore.dylib) set(ICU_FLAGS "-DTARGET_UNIX -DU_DISABLE_RENAMING -Wno-reserved-id-macro -Wno-documentation -Wno-documentation-unknown-command -Wno-switch-enum -Wno-covered-switch-default -Wno-extra-semi-stmt -Wno-unknown-warning-option -Wno-deprecated-declarations") set(HAVE_SYS_ICU 1) -elseif(HOST_WASM) +elseif(HOST_WASI) + set(HAVE_SYS_ICU 0) + set(STATIC_ICU 1) + set(ICU_LIBS "icucore") +elseif(HOST_BROWSER) set(ICU_FLAGS "-DPALEXPORT=\"\" -DU_DISABLE_RENAMING -DHAVE_UDAT_STANDALONE_SHORTER_WEEKDAYS -DHAVE_SET_MAX_VARIABLE -DTARGET_UNIX -Wno-reserved-id-macro -Wno-documentation -Wno-documentation-unknown-command -Wno-switch-enum -Wno-covered-switch-default -Wno-extra-semi-stmt -Wno-unknown-warning-option") set(HAVE_SYS_ICU 1) set(STATIC_ICU 1) @@ -736,6 +739,8 @@ elseif(GC_SUSPEND STREQUAL "default") # use preemptive elseif(TARGET_SYSTEM_NAME STREQUAL "Emscripten") # use preemptive + elseif(TARGET_SYSTEM_NAME STREQUAL "WASI") + # use preemptive else() set(ENABLE_HYBRID_SUSPEND 1) endif() @@ -903,7 +908,7 @@ endif() add_subdirectory("${CLR_SRC_NATIVE_DIR}/public" public_apis) add_subdirectory(mono) -if (ENABLE_MSCORDBI AND NOT TARGET_ARCH STREQUAL "arm64" AND NOT CMAKE_CROSSCOMPILING AND NOT TARGET_IOS AND NOT TARGET_ANDROID AND NOT TARGET_BROWSER AND NOT HOST_MACCAT) +if (ENABLE_MSCORDBI AND NOT TARGET_ARCH STREQUAL "arm64" AND NOT CMAKE_CROSSCOMPILING AND NOT TARGET_IOS AND NOT TARGET_ANDROID AND NOT TARGET_BROWSER AND NOT TARGET_WASI AND NOT HOST_MACCAT) add_subdirectory(dlls/mscordbi) add_subdirectory(dlls/dbgshim) endif() diff --git a/src/mono/Directory.Build.props b/src/mono/Directory.Build.props index b64f87e11d95c..ef74df52c446a 100644 --- a/src/mono/Directory.Build.props +++ b/src/mono/Directory.Build.props @@ -40,10 +40,17 @@ $([MSBuild]::NormalizeDirectory('$(MSBuildThisFileDirectory)', 'wasm', 'emsdk')) - true + true $(ProvisionEmscriptenDir.Replace('\', '/')) + + + $([MSBuild]::NormalizeDirectory('$(MSBuildThisFileDirectory)', 'wasi', 'wasi-sdk')) + $(ProvisionWasiSdkDir.Replace('\', '/')) + true + + $(TargetOS).$(Platform).$(Configuration) $([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'mono', '$(TargetOS).$(Platform).$(Configuration)')) @@ -52,6 +59,9 @@ true true true + true <_MonoUseLLVMPackage Condition="'$(MonoLLVMDir)' == '' and '$(MonoEnableLLVM)' == 'true'">true <_MonoUseAOTLLVMPackage Condition="'$(MonoAOTLLVMDir)' == '' and '$(MonoAOTEnableLLVM)' == 'true'">true diff --git a/src/mono/System.Private.CoreLib/System.Private.CoreLib.csproj b/src/mono/System.Private.CoreLib/System.Private.CoreLib.csproj index b23dce200a1ab..a2871abf7bb0c 100644 --- a/src/mono/System.Private.CoreLib/System.Private.CoreLib.csproj +++ b/src/mono/System.Private.CoreLib/System.Private.CoreLib.csproj @@ -121,13 +121,13 @@ $(DefineConstants);MONO_FEATURE_SRE true - true - true + true + true true true - true - true - true + true + true + true true @@ -274,16 +274,16 @@ - + - + - + - + @@ -301,6 +301,13 @@ + + + + + + false + diff --git a/src/mono/System.Private.CoreLib/src/System/Threading/Monitor.Mono.cs b/src/mono/System.Private.CoreLib/src/System/Threading/Monitor.Mono.cs index 413198df4ad48..ec98c5ef23530 100644 --- a/src/mono/System.Private.CoreLib/src/System/Threading/Monitor.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/Threading/Monitor.Mono.cs @@ -60,7 +60,7 @@ public static bool IsEntered(object obj) return IsEnteredNative(obj); } - [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("browser"), UnsupportedOSPlatform("wasi")] public static bool Wait(object obj, int millisecondsTimeout) { ArgumentNullException.ThrowIfNull(obj); diff --git a/src/mono/System.Private.CoreLib/src/System/Threading/Thread.Mono.cs b/src/mono/System.Private.CoreLib/src/System/Threading/Thread.Mono.cs index 13adc4d13f341..e40507053c681 100644 --- a/src/mono/System.Private.CoreLib/src/System/Threading/Thread.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/Threading/Thread.Mono.cs @@ -65,7 +65,7 @@ public partial class Thread private StartHelper? _startHelper; internal ExecutionContext? _executionContext; internal SynchronizationContext? _synchronizationContext; -#if TARGET_UNIX || TARGET_BROWSER +#if TARGET_UNIX || TARGET_BROWSER || TARGET_WASI internal WaitSubsystem.ThreadWaitInfo? _waitInfo; #endif @@ -138,7 +138,7 @@ internal static int OptimalMaxSpinWaitsPerSpinIteration return 7; } } -#if TARGET_UNIX || TARGET_BROWSER +#if TARGET_UNIX || TARGET_BROWSER || TARGET_WASI internal WaitSubsystem.ThreadWaitInfo WaitInfo { get @@ -196,7 +196,7 @@ public static int GetCurrentProcessorId() public void Interrupt() { -#if TARGET_UNIX || TARGET_BROWSER // TODO: https://github.com/dotnet/runtime/issues/49521 +#if TARGET_UNIX || TARGET_BROWSER || TARGET_WASI // TODO: https://github.com/dotnet/runtime/issues/49521 WaitSubsystem.Interrupt(this); #endif InterruptInternal(this); @@ -209,7 +209,7 @@ public bool Join(int millisecondsTimeout) return JoinInternal(this, millisecondsTimeout); } -#if TARGET_UNIX || TARGET_BROWSER +#if TARGET_UNIX || TARGET_BROWSER || TARGET_WASI [DynamicDependency(nameof(OnThreadExiting))] #endif private void Initialize() @@ -301,7 +301,7 @@ internal void ClearWaitSleepJoinState() private static void OnThreadExiting(Thread thread) { -#if TARGET_UNIX || TARGET_BROWSER +#if TARGET_UNIX || TARGET_BROWSER || TARGET_WASI thread.WaitInfo.OnThreadExiting(); #endif } diff --git a/src/mono/System.Private.CoreLib/src/System/Threading/ThreadPool.Browser.Mono.cs b/src/mono/System.Private.CoreLib/src/System/Threading/ThreadPool.Browser.Mono.cs index a5e54288a2920..3cebf9adf1815 100644 --- a/src/mono/System.Private.CoreLib/src/System/Threading/ThreadPool.Browser.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/Threading/ThreadPool.Browser.Mono.cs @@ -14,7 +14,7 @@ namespace System.Threading { #if !FEATURE_WASM_THREADS - [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")] #endif public sealed class RegisteredWaitHandle : MarshalByRefObject { diff --git a/src/mono/cmake/config.h.in b/src/mono/cmake/config.h.in index f53d12433aae8..13704912bea37 100644 --- a/src/mono/cmake/config.h.in +++ b/src/mono/cmake/config.h.in @@ -171,6 +171,9 @@ /* Define to 1 if you have the header file. */ #cmakedefine HAVE_PWD_H 1 +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_GRP_H 1 + /* Define to 1 if you have the header file. */ #cmakedefine HAVE_SYS_SELECT_H 1 diff --git a/src/mono/cmake/configure.cmake b/src/mono/cmake/configure.cmake index ae55fd112b321..b74204108105e 100644 --- a/src/mono/cmake/configure.cmake +++ b/src/mono/cmake/configure.cmake @@ -23,7 +23,7 @@ if(HOST_SOLARIS) endif() if(HOST_WASI) - set(CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} -D_WASI_EMULATED_SIGNAL -D_WASI_EMULATED_MMAN") + set(CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} -D_WASI_EMULATED_PROCESS_CLOCKS -D_WASI_EMULATED_SIGNAL -D_WASI_EMULATED_MMAN") endif() function(ac_check_headers) @@ -85,13 +85,18 @@ ac_check_funcs ( gethrtime read_real_time gethostbyname gethostbyname2 getnameinfo getifaddrs access inet_ntop Qp2getifaddrs getpid mktemp) -if (HOST_LINUX OR HOST_BROWSER) +if (HOST_LINUX OR HOST_BROWSER OR HOST_WASI) # sysctl is deprecated on Linux and doesn't work on Browser set(HAVE_SYS_SYSCTL_H 0) else () check_include_files("sys/types.h;sys/sysctl.h" HAVE_SYS_SYSCTL_H) endif() +if (HOST_WASI) + # sysctl is deprecated on Linux and doesn't work on Browser + set(HAVE_GETRUSAGE 0) +endif() + check_include_files("sys/types.h;sys/user.h" HAVE_SYS_USER_H) if(NOT HOST_DARWIN) @@ -99,7 +104,10 @@ if(NOT HOST_DARWIN) ac_check_funcs (getentropy) endif() -find_package(Threads) +if(NOT HOST_WASI) + # TODOWASI + find_package(Threads) +endif() # Needed to find pthread_ symbols set(CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}") diff --git a/src/mono/mono.proj b/src/mono/mono.proj index 59fea4a2f72e1..32bb8cc615ea0 100644 --- a/src/mono/mono.proj +++ b/src/mono/mono.proj @@ -28,7 +28,7 @@ $(CoreClrLibName) $(LibPrefix)$(MonoSharedLibName)$(LibSuffix) $(LibPrefix)$(MonoLibName)$(StaticLibSuffix) - $(MonoStaticLibFileName) + $(MonoStaticLibFileName) $(MonoSharedLibFileName) mono-aot-cross$(ExeSuffix) mono-aot-cross.pdb @@ -42,11 +42,14 @@ true true true + true $([MSBuild]::NormalizeDirectory('$(MonoObjDir)', 'cross')) $([MSBuild]::NormalizePath('$(MonoObjCrossDir)', 'config.h')) true - true + true $(Compiler) clang <_CompilerTargetArch Condition="'$(RealTargetArchitecture)' == ''">$(Platform) @@ -62,7 +65,7 @@ coop - preemptive + preemptive hybrid @@ -70,6 +73,7 @@ true + true true true false @@ -80,12 +84,12 @@ true - + - + <_MonoCMakeArgs Include="-DENABLE_WERROR=1"/> @@ -98,6 +102,7 @@ + @@ -139,15 +144,15 @@ - .sh + .ps1 $(ProvisionEmscriptenDir) $([MSBuild]::NormalizeDirectory('$(MSBuildThisFileDirectory)', 'wasm')) emsdk %(_VersionLines.Identity) - ./emsdk$(EmsdkExt) install $(EmscriptenVersion) - ./emsdk$(EmsdkExt) activate $(EmscriptenVersion) + $(EMSDK_PATH)/emsdk$(EmsdkExt) install $(EmscriptenVersion) + $(EMSDK_PATH)/emsdk$(EmsdkExt) activate $(EmscriptenVersion) powershell -NonInteractive -command "& $(InstallCmd); Exit $LastExitCode " powershell -NonInteractive -command "& $(ActivateCmd); Exit $LastExitCode " @@ -161,6 +166,50 @@ IgnoreStandardErrorWarningFormat="true" /> + + + + + + + + $(ProvisionWasiSdkDir) + $([MSBuild]::NormalizeDirectory('$(MSBuildThisFileDirectory)', 'wasi')) + %(_VersionLines.Identity) + https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-$(WasiSdkVersion)/wasi-sdk-$(WasiSdkVersion).0-linux.tar.gz + https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-$(WasiSdkVersion)/wasi-sdk-$(WasiSdkVersion).0-macos.tar.gz + https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-$(WasiSdkVersion)/wasi-sdk-$(WasiSdkVersion).0-mingw.tar.gz + + + + + + + + + + + + + + + + + + %(_ActualVersionLines.Identity) + %(_ExpectedVersionLines.Identity) + + + + @@ -206,7 +255,7 @@ <_MonoCMakeArgs Condition="'$(_MonoUseNinja)' == 'true'" Include="-G Ninja"/> - <_MonoCMakeArgs Include="-DCMAKE_INSTALL_PREFIX="$(MonoObjDir)out""/> + <_MonoCMakeArgs Include="-DCMAKE_INSTALL_PREFIX="$(MonoObjDir.Replace('\','/'))out""/> <_MonoCMakeArgs Include="-DCMAKE_INSTALL_LIBDIR=lib"/> <_MonoCMakeArgs Include="-DCMAKE_BUILD_TYPE=$(Configuration)"/> <_MonoCMakeArgs Condition="'$(CMakeArgs)' != ''" Include="$(CMakeArgs)"/> @@ -338,30 +387,53 @@ <_MonoBuildEnv Condition="'$(BuildArchitecture)' == 'arm64'" Include="arch -arch arm64" /> - + <_MonoMinimal Condition="'$(Configuration)' == 'Release'">,debugger_agent,log_dest <_MonoMinimal Condition="'$(Configuration)' == 'Release' and '$(MonoEnableAssertMessages)' != 'true'">$(_MonoMinimal),assert_messages <_MonoMinimal Condition="'$(MonoWasmThreads)' != 'true'">$(_MonoMinimal),threads <_MonoMinimal Condition="'$(MonoWasmThreadsNoUser)' == 'true'">$(_MonoMinimal),wasm_user_threads - + <_MonoCMakeArgs Include="-DENABLE_MINIMAL=jit,sgen_major_marksweep_conc,sgen_split_nursery,sgen_gc_bridge,sgen_toggleref,sgen_debug_helpers,sgen_binary_protocol,logging,interpreter,qcalls$(_MonoMinimal)"/> <_MonoCMakeArgs Include="-DENABLE_INTERP_LIB=1"/> <_MonoCMakeArgs Include="-DDISABLE_ICALL_TABLES=1"/> <_MonoCMakeArgs Include="-DENABLE_ICALL_EXPORT=1"/> <_MonoCMakeArgs Include="-DENABLE_LAZY_GC_THREAD_CREATION=1"/> - <_MonoCMakeArgs Include="-DENABLE_LLVM_RUNTIME=1"/> - <_MonoCMakeArgs Include="-DEMSCRIPTEN_SYSTEM_PROCESSOR=wasm"/> + <_MonoCMakeArgs Condition="'$(TargetsWasi)' != 'true'" Include="-DENABLE_LLVM_RUNTIME=1"/> <_MonoCFLAGS Include="-fexceptions"/> <_MonoCFLAGS Condition="'$(MonoWasmThreads)' == 'true'" Include="-pthread"/> <_MonoCFLAGS Condition="'$(MonoWasmThreads)' == 'true'" Include="-D_GNU_SOURCE=1" /> <_MonoCXXFLAGS Include="-fexceptions"/> <_MonoCXXFLAGS Condition="'$(MonoWasmThreads)' == 'true'" Include="-pthread"/> <_MonoCXXFLAGS Condition="'$(MonoWasmThreads)' == 'true'" Include="-D_GNU_SOURCE=1" /> - <_MonoCFLAGS Condition="'$(MonoWasmThreads)' == 'true'" Include="$(EscapedQuoteW)-I$([MSBuild]::NormalizePath('$(PkgMicrosoft_NETCore_Runtime_ICU_Transport)', 'runtimes', 'browser-wasm-threads', 'native', 'include'))$(EscapedQuoteW)"/> - - <_MonoCFLAGS Condition="'$(MonoWasmThreads)' != 'true'" Include="$(EscapedQuoteW)-I$([MSBuild]::NormalizePath('$(PkgMicrosoft_NETCore_Runtime_ICU_Transport)', 'runtimes', 'browser-wasm', 'native', 'include'))$(EscapedQuoteW)"/> + + <_MonoCFLAGS Condition="'$(MonoWasmThreads)' == 'true'" Include="$(EscapedQuoteW)-I$([MSBuild]::NormalizePath('$(PkgMicrosoft_NETCore_Runtime_ICU_Transport)', 'runtimes', 'browser-wasm-threads', 'native', 'include').Replace('\','/'))$(EscapedQuoteW)"/> + <_MonoCFLAGS Condition="'$(MonoWasmThreads)' != 'true'" Include="$(EscapedQuoteW)-I$([MSBuild]::NormalizePath('$(PkgMicrosoft_NETCore_Runtime_ICU_Transport)', 'runtimes', 'browser-wasm', 'native', 'include').Replace('\','/'))$(EscapedQuoteW)"/> + + + + + <_MonoCFLAGS Include="$(EscapedQuoteW)-I$([MSBuild]::NormalizePath('$(MonoProjectRoot)', 'wasi', 'include').Replace('\','/'))$(EscapedQuoteW)"/> + <_MonoCFLAGS Include="$(EscapedQuoteW)-I$([MSBuild]::NormalizePath('$(MonoProjectRoot)', 'wasi', 'mono-include').Replace('\','/'))$(EscapedQuoteW)"/> + <_MonoCFLAGS Include="$(EscapedQuoteW)-I$([MSBuild]::NormalizePath('$(RepoRoot)', 'src', 'native', 'public').Replace('\','/'))$(EscapedQuoteW)"/> + <_MonoCFLAGS Include="$(EscapedQuoteW)-I$([MSBuild]::NormalizePath('$(MonoProjectRoot)', 'mono', 'eglib').Replace('\','/'))$(EscapedQuoteW)"/> + <_MonoCFLAGS Include="-D_WASI_EMULATED_PROCESS_CLOCKS"/> + <_MonoCFLAGS Include="-D_WASI_EMULATED_SIGNAL"/> + <_MonoCFLAGS Include="-D_WASI_EMULATED_MMAN"/> + + <_MonoCFLAGS Condition="'$(MonoWasmThreads)' == 'true'" Include="$(EscapedQuoteW)-I$([MSBuild]::NormalizePath('$(PkgMicrosoft_NETCore_Runtime_ICU_Transport)', 'runtimes', 'browser-wasm-threads', 'native', 'include').Replace('\','/'))$(EscapedQuoteW)"/> + <_MonoCFLAGS Condition="'$(MonoWasmThreads)' != 'true'" Include="$(EscapedQuoteW)-I$([MSBuild]::NormalizePath('$(PkgMicrosoft_NETCore_Runtime_ICU_Transport)', 'runtimes', 'browser-wasm', 'native', 'include').Replace('\','/'))$(EscapedQuoteW)"/> + + + <_MonoCCOption>CC="$(XcodeDir)/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" @@ -488,6 +560,7 @@ + <_MonoCMakeArgs Include="-DFEATURE_PERFTRACING_DISABLE_PERFTRACING_LISTEN_PORTS=1"/> <_MonoCMakeArgs Include="-DFEATURE_PERFTRACING_DISABLE_DEFAULT_LISTEN_PORT=1"/> <_MonoCMakeArgs Include="-DFEATURE_PERFTRACING_DISABLE_CONNECT_PORTS=1" /> @@ -512,18 +585,21 @@ $([MSBuild]::EnsureTrailingSlash('$(EMSDK_PATH)')) + $([MSBuild]::EnsureTrailingSlash('$(WASI_SDK_PATH)')) <_MonoCMakeConfigureCommand>cmake @(_MonoCMakeArgs, ' ') $(MonoCMakeExtraArgs) "$(MonoProjectRoot.TrimEnd('\/'))" - <_MonoCMakeConfigureCommand Condition="'$(TargetsBrowser)' != 'true' and '$(_MonoRunInitCompiler)' != 'false' and '$(HostOS)' != 'windows'">bash -c 'source $(RepositoryEngineeringCommonDir)native/init-compiler.sh "$(RepositoryEngineeringCommonDir)native" "$(_CompilerTargetArch)" "$(MonoCCompiler)" && @(_MonoBuildEnv, ' ') $(_MonoCMakeConfigureCommand)' - <_MonoCMakeConfigureCommand Condition="'$(TargetsBrowser)' != 'true' and '$(_MonoRunInitCompiler)' != 'false' and '$(HostOS)' == 'windows'">call "$(RepositoryEngineeringDir)native\init-vs-env.cmd" $(_CompilerTargetArch) && cd /D "$(MonoObjDir)" && @(_MonoBuildEnv, ' ') $(_MonoCMakeConfigureCommand) - <_MonoCMakeConfigureCommand Condition="'$(TargetsBrowser)' != 'true' and '$(_MonoRunInitCompiler)' == 'false'">$(_MonoCCOption) $(_MonoCXXOption) @(_MonoBuildEnv, ' ') $(_MonoCMakeConfigureCommand) + <_MonoCMakeConfigureCommand Condition="'$(TargetsBrowser)' != 'true' and '$(TargetsWasi)' != 'true' and '$(_MonoRunInitCompiler)' != 'false' and '$(HostOS)' != 'windows'">bash -c 'source $(RepositoryEngineeringCommonDir)native/init-compiler.sh "$(RepositoryEngineeringCommonDir)native" "$(_CompilerTargetArch)" "$(MonoCCompiler)" && @(_MonoBuildEnv, ' ') $(_MonoCMakeConfigureCommand)' + <_MonoCMakeConfigureCommand Condition="'$(TargetsBrowser)' != 'true' and '$(TargetsWasi)' != 'true' and '$(_MonoRunInitCompiler)' != 'false' and '$(HostOS)' == 'windows'">call "$(RepositoryEngineeringDir)native\init-vs-env.cmd" $(_CompilerTargetArch) && cd /D "$(MonoObjDir)" && @(_MonoBuildEnv, ' ') $(_MonoCMakeConfigureCommand) + <_MonoCMakeConfigureCommand Condition="'$(TargetsBrowser)' != 'true' and '$(TargetsWasi)' != 'true' and '$(_MonoRunInitCompiler)' == 'false'">$(_MonoCCOption) $(_MonoCXXOption) @(_MonoBuildEnv, ' ') $(_MonoCMakeConfigureCommand) <_MonoCMakeConfigureCommand Condition="'$(TargetsBrowser)' == 'true' and '$(HostOS)' != 'windows'">bash -c 'source $(EMSDK_PATH)/emsdk_env.sh 2>&1 && emcmake $(_MonoCMakeConfigureCommand)' <_MonoCMakeConfigureCommand Condition="'$(TargetsBrowser)' == 'true' and '$(HostOS)' == 'windows'">call "$(RepositoryEngineeringDir)native\init-vs-env.cmd" && call "$([MSBuild]::NormalizePath('$(EMSDK_PATH)', 'emsdk_env.bat'))" && emcmake $(_MonoCMakeConfigureCommand) + <_MonoCMakeConfigureCommand Condition="'$(TargetsWasi)' == 'true'">$(_MonoCMakeConfigureCommand) -DWASI_SDK_PREFIX=$(WASI_SDK_PATH) -DCMAKE_SYSROOT=$(WASI_SDK_PATH)share/wasi-sysroot -DCMAKE_TOOLCHAIN_FILE=$(WASI_SDK_PATH)share/cmake/wasi-sdk.cmake -DCMAKE_CXX_FLAGS="--sysroot=$(WASI_SDK_PATH)share/wasi-sysroot" + <_MonoCMakeBuildCommand>cmake --build . --target install --config $(Configuration) <_MonoCMakeBuildCommand Condition="'$(MonoVerboseBuild)' == 'true'">$(_MonoCMakeBuildCommand) --verbose <_MonoCMakeBuildCommand Condition="'$(_MonoUseNinja)' != 'true'">$(_MonoCMakeBuildCommand) --parallel $([System.Environment]::ProcessorCount) - <_MonoCMakeBuildCommand Condition="'$(TargetsBrowser)' != 'true' and '$(HostOS)' != 'windows'">@(_MonoBuildEnv, ' ') $(_MonoCMakeBuildCommand) - <_MonoCMakeBuildCommand Condition="'$(TargetsBrowser)' != 'true' and '$(HostOS)' == 'windows'">call "$(RepositoryEngineeringDir)native\init-vs-env.cmd" $(_CompilerTargetArch) && cd /D "$(MonoObjDir)" && @(_MonoBuildEnv, ' ') $(_MonoCMakeBuildCommand) + <_MonoCMakeBuildCommand Condition="'$(TargetsBrowser)' != 'true' and '$(TargetsWasi)' != 'true' and '$(HostOS)' != 'windows'">@(_MonoBuildEnv, ' ') $(_MonoCMakeBuildCommand) + <_MonoCMakeBuildCommand Condition="'$(TargetsBrowser)' != 'true' and '$(TargetsWasi)' != 'true' and '$(HostOS)' == 'windows'">call "$(RepositoryEngineeringDir)native\init-vs-env.cmd" $(_CompilerTargetArch) && cd /D "$(MonoObjDir)" && @(_MonoBuildEnv, ' ') $(_MonoCMakeBuildCommand) <_MonoCMakeBuildCommand Condition="'$(TargetsBrowser)' == 'true' and '$(HostOS)' == 'windows'">call "$(RepositoryEngineeringDir)native\init-vs-env.cmd" && $(_MonoCMakeBuildCommand) @@ -716,6 +792,7 @@ + @@ -797,6 +874,7 @@ CheckEnv;GetXcodeDir;GenerateRuntimeVersionFile;BuildMonoRuntime;BuildMonoCross GenerateRuntimeVersionFile;ProvisionEmscripten;$(MonoDependsOnTargets) + GenerateRuntimeVersionFile;ProvisionWasiSdk;ValidateWasiSdk;$(MonoDependsOnTargets) @@ -805,7 +883,7 @@ <_MonoRuntimeFilePath Condition="'$(TargetsWindows)' == 'true'">$(MonoObjDir)out\bin\$(MonoFileName) <_MonoRuntimeFilePath Condition="'$(_MonoRuntimeFilePath)' == ''">$(MonoObjDir)out\lib\$(MonoFileName) <_MonoRuntimeStaticFilePath Condition="'$(TargetsMacCatalyst)' == 'true' or '$(TargetsiOS)' == 'true' or '$(TargetstvOS)' == 'true' or '$(TargetsAndroid)' == 'true' or '$(TargetsLinuxBionic)' == 'true'">$(MonoObjDir)out\lib\$(MonoStaticLibFileName) - <_MonoIncludeInterpStaticFiles Condition="'$(TargetsBrowser)' == 'true'">true + <_MonoIncludeInterpStaticFiles Condition="'$(TargetsBrowser)' == 'true' or '$(TargetsWasi)' == 'true'">true <_MonoIncludeIcuFiles Condition="'$(TargetsiOS)' == 'true' or '$(TargetstvOS)' == 'true' or '$(TargetsMacCatalyst)' == 'true'">true diff --git a/src/mono/mono/mini/CMakeLists.txt b/src/mono/mono/mini/CMakeLists.txt index 30df4bac1f779..0848baf8593e4 100644 --- a/src/mono/mono/mini/CMakeLists.txt +++ b/src/mono/mono/mini/CMakeLists.txt @@ -340,7 +340,7 @@ endif() if(HOST_WIN32) set(mini_sources "${mini_sources};${VERSION_FILE_RC_PATH}") # this is generated by GenerateNativeVersionFile in Arcade -elseif(NOT HOST_BROWSER) +elseif(NOT HOST_BROWSER AND NOT HOST_WASI) set(mini_sources "${mini_sources};${VERSION_FILE_PATH}") # this is generated by GenerateNativeVersionFile in Arcade endif() diff --git a/src/mono/mono/utils/CMakeLists.txt b/src/mono/mono/utils/CMakeLists.txt index 4d552b6e033dd..191ee54cc332f 100644 --- a/src/mono/mono/utils/CMakeLists.txt +++ b/src/mono/mono/utils/CMakeLists.txt @@ -23,6 +23,8 @@ set(utils_unix_sources if(HOST_WIN32) set(utils_platform_sources ${utils_win32_sources}) +elseif(HOST_WASI) + set(utils_platform_sources os-event-unix.c) else() set(utils_platform_sources ${utils_unix_sources}) endif() @@ -217,7 +219,7 @@ elseif(TARGET_RISCV64) set(utils_arch_sources "${utils_arch_sources};mono-hwcap-riscv.c") elseif(TARGET_S390X) set(utils_arch_sources "${utils_arch_sources};mono-hwcap-s390x.c") -elseif(TARGET_WASM) +elseif(TARGET_BROWSER OR TARGET_WASI) set(utils_arch_sources "${utils_arch_sources};mono-hwcap-wasm.c;mono-mmap-wasm.c") elseif(TARGET_POWERPC OR TARGET_POWERPC64) set(utils_arch_sources "${utils_arch_sources};mono-hwcap-ppc.c") diff --git a/src/mono/mono/utils/mono-codeman.c b/src/mono/mono/utils/mono-codeman.c index 6e6f36c32d7e0..19597dde494b1 100644 --- a/src/mono/mono/utils/mono-codeman.c +++ b/src/mono/mono/utils/mono-codeman.c @@ -362,6 +362,8 @@ mono_codeman_free (gpointer p) void* const heap = mono_code_manager_heap; g_assert (heap); HeapFree (heap, 0, p); +#elif HOST_WASI + //TODOWASI #else mono_codeman_enable_write (); dlfree (p); diff --git a/src/mono/mono/utils/mono-rand.c b/src/mono/mono/utils/mono-rand.c index cb78275d75677..0f64d3b9eacdb 100644 --- a/src/mono/mono/utils/mono-rand.c +++ b/src/mono/mono/utils/mono-rand.c @@ -121,6 +121,7 @@ mono_getentropy (guchar *buffer, gssize buffer_size, MonoError *error) } #endif /* HAVE_GETENTROPY */ +#if !defined(DISABLE_EGD_SOCKET) static void get_entropy_from_egd (const char *path, guchar *buffer, gssize buffer_size, MonoError *error) { @@ -222,6 +223,7 @@ mono_rand_open (void) return TRUE; } +#endif /* !DISABLE_EGD_SOCKET */ gpointer mono_rand_init (const guchar *seed, gssize seed_size) @@ -250,9 +252,9 @@ mono_rand_try_get_bytes (gpointer *handle, guchar *buffer, gssize buffer_size, M if (res == 1) return TRUE; +#elif !defined(DISABLE_EGD_SOCKET) /* getrandom() or getentropy() function is not available: failed with ENOSYS or EPERM. Fall back on reading from /dev/urandom. */ -#endif if (use_egd) { char *socket_path = g_getenv ("MONO_EGD_SOCKET"); @@ -263,21 +265,22 @@ mono_rand_try_get_bytes (gpointer *handle, guchar *buffer, gssize buffer_size, M } get_entropy_from_egd (socket_path, buffer, buffer_size, error); g_free (socket_path); - } else { - /* Read until the buffer is filled. This may block if using NAME_DEV_RANDOM. */ - while (buffer_size > 0) { - gssize const err = read (file, buffer, buffer_size); - if (err < 0) { - if (errno == EINTR) - continue; - g_warning("Entropy error! Error in read (%s).", strerror (errno)); - /* exception will be thrown in managed code */ - mono_error_set_execution_engine (error, "Entropy error! Error in read (%s).", strerror (errno)); - return FALSE; - } - buffer += err; - buffer_size -= err; + return TRUE; + } +#endif + /* Read until the buffer is filled. This may block if using NAME_DEV_RANDOM. */ + while (buffer_size > 0) { + gssize const err = read (file, buffer, buffer_size); + if (err < 0) { + if (errno == EINTR) + continue; + g_warning("Entropy error! Error in read (%s).", strerror (errno)); + /* exception will be thrown in managed code */ + mono_error_set_execution_engine (error, "Entropy error! Error in read (%s).", strerror (errno)); + return FALSE; } + buffer += err; + buffer_size -= err; } return TRUE; } diff --git a/src/mono/sample/wasi/CommonAssemblyInfo.cs b/src/mono/sample/wasi/CommonAssemblyInfo.cs new file mode 100644 index 0000000000000..1e407edc80422 --- /dev/null +++ b/src/mono/sample/wasi/CommonAssemblyInfo.cs @@ -0,0 +1,4 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +[assembly:System.Runtime.Versioning.SupportedOSPlatform("wasi")] diff --git a/src/mono/sample/wasi/Directory.Build.props b/src/mono/sample/wasi/Directory.Build.props new file mode 100644 index 0000000000000..f2ecb0d30b5db --- /dev/null +++ b/src/mono/sample/wasi/Directory.Build.props @@ -0,0 +1,37 @@ + + + + Exe + wasi + + + + + + + bin + + + false + + + + + false + true + false + false + false + true + + + + + + + + + diff --git a/src/mono/sample/wasi/Directory.Build.targets b/src/mono/sample/wasi/Directory.Build.targets new file mode 100644 index 0000000000000..df21a15d0a545 --- /dev/null +++ b/src/mono/sample/wasi/Directory.Build.targets @@ -0,0 +1,72 @@ + + + + + + true + + + + + + <_ScriptExt Condition="'$(OS)' == 'Windows_NT'">.cmd + <_ScriptExt Condition="'$(OS)' != 'Windows_NT'">.sh + <_Dotnet>$(RepoRoot)dotnet$(_ScriptExt) + <_AOTFlag Condition="'$(RunAOTCompilation)' != ''">/p:RunAOTCompilation=$(RunAOTCompilation) + <_WasmMainJSFileName>$([System.IO.Path]::GetFileName('$(WasmMainJSPath)')) + + + + + + + + + + + + + + + + + + %(_VersionLines.Identity) + https://github.com/bytecodealliance/wasmtime/releases/download/v$(WasmtimeVersion)/wasmtime-v$(WasmtimeVersion)-x86_64-linux.tar.xz + https://github.com/bytecodealliance/wasmtime/releases/download/v$(WasmtimeVersion)/wasmtime-v$(WasmtimeVersion)-x86_64-macos.tar.xz + https://github.com/bytecodealliance/wasmtime/releases/download/v$(WasmtimeVersion)/wasmtime-v$(WasmtimeVersion)-x86_64-windows.zip + + + + + + + + + + + + + + + + + + diff --git a/src/mono/sample/wasi/console/Program.cs b/src/mono/sample/wasi/console/Program.cs new file mode 100644 index 0000000000000..c65033a418ebb --- /dev/null +++ b/src/mono/sample/wasi/console/Program.cs @@ -0,0 +1,16 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.Threading.Tasks; + +public class Test +{ + public static int Main() + { + Console.WriteLine(""); + Console.WriteLine("Hello World!"); + Console.WriteLine(""); + return 0; + } +} diff --git a/src/mono/sample/wasi/console/Wasi.Console.Sample.csproj b/src/mono/sample/wasi/console/Wasi.Console.Sample.csproj new file mode 100644 index 0000000000000..2cbc92e85f134 --- /dev/null +++ b/src/mono/sample/wasi/console/Wasi.Console.Sample.csproj @@ -0,0 +1,12 @@ + + + $(NetCoreAppCurrent) + + + + <_SampleProject>Wasi.Console.Sample.csproj + <_SampleAssembly>Wasi.Console.Sample.dll + + + + diff --git a/src/mono/wasi/.gitignore b/src/mono/wasi/.gitignore new file mode 100644 index 0000000000000..c2313f66ee085 --- /dev/null +++ b/src/mono/wasi/.gitignore @@ -0,0 +1,2 @@ +wasi-sdk/** +wasmtime/** diff --git a/src/mono/wasi/Makefile b/src/mono/wasi/Makefile deleted file mode 100644 index 53ae87f4f76ea..0000000000000 --- a/src/mono/wasi/Makefile +++ /dev/null @@ -1,51 +0,0 @@ -include Makefile.variable - -all: build-all - -build-all: $(WASI_SDK_CLANG) - mkdir -p $(WASI_OBJ_DIR) - cd $(WASI_OBJ_DIR) && \ - PATH=$(NINJA_DIR):${PATH} cmake -G Ninja \ - -DWASI_SDK_PREFIX=$(WASI_SDK_ROOT) \ - -DCMAKE_SYSROOT=$(WASI_SDK_ROOT)/share/wasi-sysroot \ - -DCMAKE_TOOLCHAIN_FILE=$(WASI_SDK_ROOT)/share/cmake/wasi-sdk.cmake \ - -DCMAKE_C_FLAGS="--sysroot=$(WASI_SDK_ROOT)/share/wasi-sysroot \ - -I$(CURDIR)/include -I$(TOP)/src/mono -I$(TOP)/src/native/public -I$(TOP)/src/mono/mono/eglib -I$(WASI_OBJ_DIR)/mono/eglib -I$(WASI_OBJ_DIR) -I$(TOP)/artifacts/obj/wasm -I$(TOP)/src/mono/wasm/runtime" \ - -DCMAKE_CXX_FLAGS="--sysroot=$(WASI_SDK_ROOT)/share/wasi-sysroot" \ - -DENABLE_MINIMAL=jit,sgen_major_marksweep_conc,sgen_split_nursery,sgen_gc_bridge,sgen_toggleref,sgen_debug_helpers,sgen_binary_protocol,logging,interpreter,threads,qcalls,debugger_agent,sockets,eventpipe \ - -DDISABLE_SHARED_LIBS=1 \ - -Wl,--allow-undefined \ - $(TOP)/src/mono - cd $(WASI_OBJ_DIR) && PATH=$(NINJA_DIR):${PATH} ninja - - mkdir -p $(WASI_BIN_DIR) - cp $(WASI_OBJ_DIR)/mono/mini/*.a $(WASI_OBJ_DIR)/libmono-wasi-driver.a $(WASI_BIN_DIR) - rm -rf $(WASI_BIN_DIR)/libmono-component-hot_reload-static.a - rm -rf $(WASI_BIN_DIR)/libmono-component-diagnostics_tracing-static.a - mkdir -p $(WASI_BIN_DIR)/include/mono-wasi - cp mono-wasi-driver/*.h $(WASI_BIN_DIR)/include/mono-wasi - -$(WASI_SDK_CLANG): - mkdir -p $(WASI_OBJ_DIR) - cd $(WASI_OBJ_DIR) && \ - wget -q https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-$(WASI_SDK_VERSION)/wasi-sdk-$(WASI_SDK_VERSION).0-linux.tar.gz && \ - tar xf wasi-sdk-*.tar.gz - -.stamp-wasmtime-$(WASMTIME_VERSION): - @echo "** Provisioning wasmtime $(WASMTIME_VERSION) **" - rm -Rf $(WASMTIME_DIR) && \ - wget -q https://github.com/bytecodealliance/wasmtime/releases/download/$(WASMTIME_VERSION)/$(WASMTIME_DIR_NAME).tar.xz -O - | tar -C `dirname $(WASMTIME_DIR)` -Jxf - && \ - touch $@ - -.stamp-ninja-$(NINJA_VERSION): - @echo "** Provisioning ninja $(NINJA_VERSION) **" - rm -Rf $(NINJA_DIR); \ - mkdir $(NINJA_DIR) && \ - wget -q https://github.com/ninja-build/ninja/releases/download/v1.11.0/ninja-linux.zip -O $(NINJA_DIR)/ninja.zip && \ - (cd $(NINJA_DIR) && unzip -q ninja.zip && rm ninja.zip) && \ - touch $@ - -provision-deps: .stamp-wasmtime-$(WASMTIME_VERSION) .stamp-ninja-$(NINJA_VERSION) - @echo "-------------------------------------------" - @echo "** Installed wasmtime in $(WASMTIME_DIR)" - @echo "** Installed ninja in $(NINJA_DIR)" diff --git a/src/mono/wasi/Makefile.variable b/src/mono/wasi/Makefile.variable deleted file mode 100644 index ef8b91b245c24..0000000000000 --- a/src/mono/wasi/Makefile.variable +++ /dev/null @@ -1,16 +0,0 @@ -TOP=$(realpath $(CURDIR)/../../..) -CONFIG?=Release -RUNTIME_CONFIG?=Release -WASI_SDK_VERSION=12 - -WASI_OBJ_DIR=$(TOP)/artifacts/obj/mono/Wasi.$(RUNTIME_CONFIG) -WASI_BIN_DIR=$(TOP)/artifacts/bin/mono/Wasi.$(RUNTIME_CONFIG) -WASI_SDK_ROOT=$(WASI_OBJ_DIR)/wasi-sdk-$(WASI_SDK_VERSION).0 -WASI_SDK_CLANG=$(WASI_SDK_ROOT)/bin/clang - -WASMTIME_VERSION=v0.39.1 -WASMTIME_DIR_NAME=wasmtime-$(WASMTIME_VERSION)-x86_64-linux -WASMTIME_DIR=$(TOP)/artifacts/bin/$(WASMTIME_DIR_NAME) - -NINJA_VERSION=v1.11.0 -NINJA_DIR=$(TOP)/artifacts/bin/ninja diff --git a/src/mono/wasi/README.md b/src/mono/wasi/README.md index a44f8d5db9323..66e59384297bb 100644 --- a/src/mono/wasi/README.md +++ b/src/mono/wasi/README.md @@ -8,59 +8,21 @@ The mechanism for executing .NET code in a WASI runtime environment is equivalen ## How to build the runtime -### 1. Build the WASM runtime - -To build the wasi runtime we need the file `wasm_m2n_invoke.g.h` which is generated when compiling wasm runtime - -``` -make -C src/mono/wasm provision-wasm -export EMSDK_PATH=[path_printed_by_provision_wasm] -./build.sh mono+libs -os browser -``` - -### 2. Build the WASI runtime - -Currently this can only be built in Linux or WSL (tested on Windows 11). Simply run `make` in this directory. It will automatically download and use [WASI SDK](https://github.com/WebAssembly/wasi-sdk). - -The resulting libraries are placed in `(repo_root)/artifacts/bin/mono/Wasi.Release`. - -## How to build and run the sample - -### 1. Obtain a WASI runtime - -To run an application in a WASI environment, you need to have a WASI runtime available. For example, download [wasmtime](https://github.com/bytecodealliance/wasmtime/releases) and make sure it's available on `PATH`: - +on Linux: +```.sh +./build.sh -bl -os wasi -subset mono+libs -c Debug ``` -export PATH=~/wasmtime-v0.31.0-x86_64-linux -wasmtime --version +or for just native rebuild +```.sh +./build.sh -bl -os wasi -subset mono.runtime+libs.native+mono.wasiruntime -c Debug ``` -Other WASI runtimes also work. Tested: [wamr](https://github.com/bytecodealliance/wasm-micro-runtime), [wasmer](https://wasmer.io/). - -### 2. Obtain a suitable .NET build toolchain - -You also need to have a working installation of .NET 7 including the `browser-wasm` runtime pack. For example, obtain the [.NET SDK daily build](https://github.com/dotnet/installer/blob/main/README.md#installers-and-binaries) (`main` branch), and ensure the `browser-wasm` pack is installed: - -``` -dotnet workload install wasm-tools -s https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet7/nuget/v3/index.json -``` - -To make this available to the build scripts, supply environment variables. Example: - -``` -export DOTNET_ROOT=~/dotnet7 -export BROWSER_WASM_RUNTIME_PATH=$(DOTNET_ROOT)/packs/Microsoft.NETCore.App.Runtime.Mono.browser-wasm/7.0.0-alpha.1.22061.11/runtimes/browser-wasm -``` - -You'll need to update these paths to match the location where you extracted the .NET daily SDK build and the exact version of the `browser-wasm` pack you received. - ### 3. Run it Finally, you can build and run the sample: ``` -cd sample/console -make run +./dotnet.sh build /p:TargetOS=wasi /p:Configuration=Debug /t:RunSample src/mono/sample/wasi/console ``` ### 4. Debug it diff --git a/src/mono/wasi/build/WasiApp.InTree.props b/src/mono/wasi/build/WasiApp.InTree.props new file mode 100644 index 0000000000000..8c119d5413b58 --- /dev/null +++ b/src/mono/wasi/build/WasiApp.InTree.props @@ -0,0 +1,2 @@ + + diff --git a/src/mono/wasi/build/WasiApp.InTree.targets b/src/mono/wasi/build/WasiApp.InTree.targets new file mode 100644 index 0000000000000..8c119d5413b58 --- /dev/null +++ b/src/mono/wasi/build/WasiApp.InTree.targets @@ -0,0 +1,2 @@ + + diff --git a/src/mono/wasi/include/netdb.h b/src/mono/wasi/include/netdb.h new file mode 100644 index 0000000000000..f905f3bb8cd19 --- /dev/null +++ b/src/mono/wasi/include/netdb.h @@ -0,0 +1 @@ +const char *gai_strerror(int); diff --git a/src/mono/wasi/mono-wasi-driver/driver.h b/src/mono/wasi/mono-include/driver.h similarity index 95% rename from src/mono/wasi/mono-wasi-driver/driver.h rename to src/mono/wasi/mono-include/driver.h index a27f2b8480614..664680e137c23 100644 --- a/src/mono/wasi/mono-wasi-driver/driver.h +++ b/src/mono/wasi/mono-include/driver.h @@ -13,7 +13,6 @@ MonoClass* mono_wasm_assembly_find_class (MonoAssembly *assembly, const char *na MonoMethod* mono_wasm_assembly_find_method (MonoClass *klass, const char *name, int arguments); MonoObject* mono_wasm_invoke_method (MonoMethod *method, MonoObject *this_arg, void *params[], MonoObject **out_exc); int mono_unbox_int (MonoObject *obj); -void mono_wasm_setenv (const char *name, const char *value); void add_assembly(const char* base_dir, const char *name); MonoArray* mono_wasm_obj_array_new (int size); diff --git a/src/mono/wasi/mono-include/pinvoke.h b/src/mono/wasi/mono-include/pinvoke.h new file mode 100644 index 0000000000000..78c30f22693c8 --- /dev/null +++ b/src/mono/wasi/mono-include/pinvoke.h @@ -0,0 +1,52 @@ +// TODOWASI deduplicate src/mono/wasm/runtime/pinvoke.h + +#ifndef __PINVOKE_H__ +#define __PINVOKE_H__ + +#include + +typedef struct { + const char *name; + void *func; +} PinvokeImport; + +typedef struct { + void *func; + void *arg; +} InterpFtnDesc; + +void* +wasm_dl_lookup_pinvoke_table (const char *name); + +int +wasm_dl_is_pinvoke_table (void *handle); + +void* +wasm_dl_get_native_to_interp (const char *key, void *extra_arg); + +void +mono_wasm_pinvoke_vararg_stub (void); + +typedef void* (*MonoWasmNativeToInterpCallback) (char * cookie); + +void +mono_wasm_install_interp_to_native_callback (MonoWasmNativeToInterpCallback cb); + +typedef struct _MonoInterpMethodArguments MonoInterpMethodArguments; + +int +mono_wasm_interp_method_args_get_iarg (MonoInterpMethodArguments *margs, int i); + +int64_t +mono_wasm_interp_method_args_get_larg (MonoInterpMethodArguments *margs, int i); + +float +mono_wasm_interp_method_args_get_farg (MonoInterpMethodArguments *margs, int i); + +double +mono_wasm_interp_method_args_get_darg (MonoInterpMethodArguments *margs, int i); + +void* +mono_wasm_interp_method_args_get_retval (MonoInterpMethodArguments *margs); + +#endif diff --git a/src/mono/wasi/include/pthread.h b/src/mono/wasi/mono-include/pthread.h similarity index 100% rename from src/mono/wasi/include/pthread.h rename to src/mono/wasi/mono-include/pthread.h diff --git a/src/mono/wasi/include/setjmp.h b/src/mono/wasi/mono-include/setjmp.h similarity index 100% rename from src/mono/wasi/include/setjmp.h rename to src/mono/wasi/mono-include/setjmp.h diff --git a/src/mono/wasi/mono-include/wasm-config.h.in b/src/mono/wasi/mono-include/wasm-config.h.in new file mode 100644 index 0000000000000..4c33fd663663c --- /dev/null +++ b/src/mono/wasi/mono-include/wasm-config.h.in @@ -0,0 +1,15 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// +#ifndef __MONO_WASM_CONFIG_H__ +#define __MONO_WASM_CONFIG_H__ + +/* Support for threads is disabled */ +#cmakedefine DISABLE_THREADS + +/* Support for starting user threads is disabled */ +#cmakedefine DISABLE_WASM_USER_THREADS + +#endif/*__MONO_WASM_CONFIG_H__*/ + +// TODOWASI deduplicate with src/mono/wasm/runtime/wasm-config.h.in \ No newline at end of file diff --git a/src/mono/wasi/provision.ps1 b/src/mono/wasi/provision.ps1 new file mode 100644 index 0000000000000..f20fcbdb888dd --- /dev/null +++ b/src/mono/wasi/provision.ps1 @@ -0,0 +1,14 @@ +param( + [Parameter()] + [string]$WasiSdkUrl, + [Parameter()] + [string]$WasiSdkVersion +) + +Remove-Item ./wasi-sdk/ -r -fo -ErrorAction SilentlyContinue +Remove-Item ./wasi-sdk-$WasiSdkVersion.0-mingw.tar.gz -fo +Invoke-WebRequest -Uri $WasiSdkUrl -OutFile ./wasi-sdk-$WasiSdkVersion.0-mingw.tar.gz +tar -xvzf ./wasi-sdk-$WasiSdkVersion.0-mingw.tar.gz +Remove-Item ./wasi-sdk-$WasiSdkVersion.0-mingw.tar.gz -fo +Move-Item ./wasi-sdk-$WasiSdkVersion.*/ ./wasi-sdk/ +Copy-Item ./wasi-sdk-version.txt ./wasi-sdk/wasi-sdk-version.txt diff --git a/src/mono/wasi/runtime/CMakeLists.txt b/src/mono/wasi/runtime/CMakeLists.txt new file mode 100644 index 0000000000000..8e4114f0c31e4 --- /dev/null +++ b/src/mono/wasi/runtime/CMakeLists.txt @@ -0,0 +1,39 @@ +cmake_minimum_required(VERSION 3.14.5) + +project(mono-wasi-runtime C) + +option(DISABLE_THREADS "defined if the build does NOT support multithreading" ON) +option(DISABLE_WASM_USER_THREADS "defined if the build does not allow user threads to be created in a multithreaded build" OFF) + +set(CMAKE_EXECUTABLE_SUFFIX ".wasm") +add_executable(dotnet driver.c pinvoke.c stubs.c synthetic-pthread.c) + +target_include_directories(dotnet PUBLIC ${MONO_INCLUDES} ${MONO_OBJ_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR}/include/wasm) +target_compile_options(dotnet PUBLIC @${NATIVE_BIN_DIR}/src/wasi-default.rsp @${NATIVE_BIN_DIR}/src/wasi-compile.rsp -DCORE_BINDINGS -DGEN_PINVOKE=1) + +set_target_properties(dotnet PROPERTIES COMPILE_FLAGS ${CONFIGURATION_WASICC_FLAGS}) + +target_link_libraries(dotnet + #TODOWASI ${ICU_LIB_DIR}/libicuuc.a + #TODOWASI ${ICU_LIB_DIR}/libicui18n.a + ${MONO_ARTIFACTS_DIR}/libmono-component-hot_reload-static.a + ${MONO_ARTIFACTS_DIR}/libmono-component-debugger-static.a + ${MONO_ARTIFACTS_DIR}/libmono-component-diagnostics_tracing-stub-static.a + ${MONO_ARTIFACTS_DIR}/libmono-component-marshal-ilgen-static.a + ${MONO_ARTIFACTS_DIR}/libmono-ee-interp.a + ${MONO_ARTIFACTS_DIR}/libmonosgen-2.0.a + ${MONO_ARTIFACTS_DIR}/libmono-icall-table.a + ${NATIVE_BIN_DIR}/libSystem.Native.a + ${NATIVE_BIN_DIR}/libSystem.IO.Compression.Native.a +) + +set_target_properties(dotnet PROPERTIES + LINK_DEPENDS "${NATIVE_BIN_DIR}/src/wasi-default.rsp;" + LINK_FLAGS "@${NATIVE_BIN_DIR}/src/wasi-default.rsp @${NATIVE_BIN_DIR}/src/wasi-link.rsp ${CONFIGURATION_LINK_FLAGS} " + RUNTIME_OUTPUT_DIRECTORY "${NATIVE_BIN_DIR}") + +set(ignoreMeWasmOptFlags "${CONFIGURATION_WASM_OPT_FLAGS}${CMAKE_CXX_FLAGS}") + +#TODOWASI wasm-opt + +configure_file(../mono-include/wasm-config.h.in include/wasm/wasm-config.h) diff --git a/src/mono/wasi/mono-wasi-driver/driver.c b/src/mono/wasi/runtime/driver.c similarity index 50% rename from src/mono/wasi/mono-wasi-driver/driver.c rename to src/mono/wasi/runtime/driver.c index df4ef9911429b..27bfc92a1c55c 100644 --- a/src/mono/wasi/mono-wasi-driver/driver.c +++ b/src/mono/wasi/runtime/driver.c @@ -8,22 +8,19 @@ #include #include #include -#include -#include -#include #define INVARIANT_GLOBALIZATION 1 +#include #include +#include #include #include #include -#include #include +#include #include -#include -#include -#include +#include #include #include @@ -33,11 +30,21 @@ #include #include -#include "wasm/runtime/pinvoke.h" +#include "pinvoke.h" #ifdef GEN_PINVOKE #include "wasm_m2n_invoke.g.h" #endif +#include "../../wasm/runtime/gc-common.h" + + +#if !defined(ENABLE_AOT) || defined(EE_MODE_LLVMONLY_INTERP) +#define NEED_INTERP 1 +#ifndef LINK_ICALLS +// FIXME: llvm+interp mode needs this to call icalls +#define NEED_NORMAL_ICALL_TABLES 1 +#endif +#endif void mono_wasm_enable_debugging (int); @@ -72,11 +79,15 @@ static MonoDomain *root_domain; #define RUNTIMECONFIG_BIN_FILE "runtimeconfig.bin" static void -wasm_trace_logger (const char *log_domain, const char *log_level, const char *message, mono_bool fatal, void *user_data) +wasi_trace_logger (const char *log_domain, const char *log_level, const char *message, mono_bool fatal, void *user_data) { - printf("[wasm_trace_logger] %s\n", message); - if (fatal) - exit (1); + printf("[wasi_trace_logger] %s\n", message); + if (fatal) { + // make it trap so we could see the stack trace + // (*(int*)(void*)-1)++; + exit(1); + } + } typedef uint32_t target_mword; @@ -124,43 +135,10 @@ struct WasmSatelliteAssembly_ { static WasmSatelliteAssembly *satellite_assemblies; static int satellite_assembly_count; -int32_t time(int32_t x) { - // In the current prototype, libSystem.Native.a is built using Emscripten, whereas the WASI-enabled runtime is being built - // using WASI SDK. Emscripten says that time() returns int32, whereas WASI SDK says it returns int64. - // TODO: Build libSystem.Native.a using WASI SDK. - // In the meantime, as a workaround we can define an int32-returning implementation for time() here. - struct timeval time; - return (gettimeofday(&time, NULL) == 0) ? time.tv_sec : 0; -} - -typedef struct -{ - int32_t Flags; // flags for testing if some members are present (see FileStatusFlags) - int32_t Mode; // file mode (see S_I* constants above for bit values) - uint32_t Uid; // user ID of owner - uint32_t Gid; // group ID of owner - int64_t Size; // total size, in bytes - int64_t ATime; // time of last access - int64_t ATimeNsec; // nanosecond part - int64_t MTime; // time of last modification - int64_t MTimeNsec; // nanosecond part - int64_t CTime; // time of last status change - int64_t CTimeNsec; // nanosecond part - int64_t BirthTime; // time the file was created - int64_t BirthTimeNsec; // nanosecond part - int64_t Dev; // ID of the device containing the file - int64_t Ino; // inode number of the file - uint32_t UserFlags; // user defined flags -} FileStatus; - char* gai_strerror(int code) { - char result[256]; - sprintf(result, "Error code %i", code); - return result; -} - -int32_t dotnet_browser_entropy(uint8_t* buffer, int32_t bufferLength) { - return getentropy (buffer, bufferLength); + char* result = malloc(256); + sprintf(result, "Error code %i", code); + return result; } void @@ -173,183 +151,122 @@ mono_wasm_add_satellite_assembly (const char *name, const char *culture, const u ++satellite_assembly_count; } -void -mono_wasm_setenv (const char *name, const char *value) +static void *sysglobal_native_handle; + +static void* +wasm_dl_load (const char *name, int flags, char **err, void *user_data) { - monoeg_g_setenv (strdup (name), strdup (value), 1); -} + void* handle = wasm_dl_lookup_pinvoke_table (name); + if (handle) + return handle; -static void *sysglobal_native_handle; -int32_t SystemNative_LChflagsCanSetHiddenFlag(void); -char* SystemNative_GetEnv(char* name); -char* SystemNative_GetEnviron(char* name); -void SystemNative_FreeEnviron(char* name); -intptr_t SystemNative_Dup(intptr_t oldfd); -int32_t SystemNative_Write(intptr_t fd, const void* buffer, int32_t bufferSize); -int64_t SystemNative_GetSystemTimeAsTicks(); -int32_t SystemNative_Stat(const char* path, void* output); -int32_t SystemNative_LStat(const char* path, void* output); -int32_t SystemNative_ConvertErrorPlatformToPal(int32_t platformErrno); -void* SystemNative_LowLevelMonitor_Create(); -void SystemNative_LowLevelMonitor_Acquire(void* monitor); -void SystemNative_LowLevelMonitor_Release(void* monitor); -int32_t SystemNative_LowLevelMonitor_TimedWait(void *monitor, int32_t timeoutMilliseconds); -void SystemNative_LowLevelMonitor_Wait(void* monitor); -int SystemNative_GetErrNo(); -void SystemNative_SetErrNo(int value); -char* SystemNative_GetCwd(); -void SystemNative_GetNonCryptographicallySecureRandomBytes(); -void SystemNative_GetCryptographicallySecureRandomBytes(); -int32_t SystemNative_Open(const char* path, int x, int y); -void SystemNative_ConvertErrorPalToPlatform(); -void SystemNative_StrErrorR(); -void SystemNative_Close(); -void SystemNative_FStat(); -void SystemNative_LSeek(); -void SystemNative_PRead(); -void SystemNative_CanGetHiddenFlag(); -int32_t SystemNative_Access(const char* path, int32_t mode); -void SystemNative_Malloc(); -void SystemNative_Free(); -void SystemNative_SysLog(); - -#define PAL_O_RDONLY 0x0000 -#define PAL_O_WRONLY 0x0001 -#define PAL_O_RDWR 0x0002 -#define PAL_O_ACCESS_MODE_MASK 0x000F - -int32_t SystemNative_Open2(const char* path, int flags, int mode) { - //printf ("In SystemNative_Open2 for %s\n", path); - // The implementation in libSystemNative tries to use PAL_O_CLOEXEC, which isn't supported here, so override it - if ((flags & PAL_O_ACCESS_MODE_MASK) == PAL_O_RDONLY) { - flags = O_RDONLY; - } else if ((flags & PAL_O_ACCESS_MODE_MASK) == PAL_O_RDWR) { - flags = O_RDWR; - } else if ((flags & PAL_O_ACCESS_MODE_MASK) == PAL_O_WRONLY) { - flags = O_WRONLY; - } + if (!strcmp (name, "System.Globalization.Native")) + return sysglobal_native_handle; - int result; - while ((result = open(path, flags, (mode_t)mode)) < 0 && errno == EINTR); - return result; +#if WASM_SUPPORTS_DLOPEN + return dlopen(name, flags); +#endif + + return NULL; } -int32_t SystemNative_Stat2(const char* path, FileStatus* output) +static void* +wasm_dl_symbol (void *handle, const char *name, char **err, void *user_data) { - // For some reason the libSystemNative SystemNative_Stat doesn't seem to work. Maybe I did something wrong elsewhere, - // or maybe it's hardcoded to something specific to browser wasm - struct stat stat_result; - int ret; - while ((ret = stat(path, &stat_result)) < 0 && errno == EINTR); - - output->Size = stat_result.st_size; - output->ATime = stat_result.st_atime; - output->MTime = stat_result.st_mtime; - output->CTime = stat_result.st_ctime; - output->Mode = S_ISDIR (stat_result.st_mode) - ? 0x4000 // Dir - : 0x8000; // File - - // Never fail when looking for the root directory. Even if the WASI host isn't giving us filesystem access - // (which is the default), we need the root directory to appear to exist, otherwise things like ASP.NET Core - // will fail by default, whether or not it needs to read anything from the filesystem. - if (ret != 0 && path[0] == '/' && path[1] == 0) { - output->Mode = 0x4000; // Dir - return 0; - } + if (handle == sysglobal_native_handle) + assert (0); - //printf("SystemNative_Stat2 for %s has ISDIR=%i and will return mode %i; ret=%i\n", path, S_ISDIR (stat_result.st_mode), output->Mode, ret); +#if WASM_SUPPORTS_DLOPEN + if (!wasm_dl_is_pinvoke_tables (handle)) { + return dlsym (handle, name); + } +#endif - return ret; + PinvokeImport *table = (PinvokeImport*)handle; + for (int i = 0; table [i].name; ++i) { + if (!strcmp (table [i].name, name)) + return table [i].func; + } + return NULL; } -int32_t SystemNative_Write2(intptr_t fd, const void* buffer, int32_t bufferSize) { - // Not sure why, but am getting fd=-1 when trying to write to stdout (which fails), so here's a workaround - return SystemNative_Write((int)fd == -1 ? 1: fd, buffer, bufferSize); -} +#if !defined(ENABLE_AOT) || defined(EE_MODE_LLVMONLY_INTERP) +#define NEED_INTERP 1 +#ifndef LINK_ICALLS +// FIXME: llvm+interp mode needs this to call icalls +#define NEED_NORMAL_ICALL_TABLES 1 +#endif +#endif -int64_t SystemNative_GetTimestamp2() { - // libSystemNative's implementation of SystemNative_GetTimestamp causes the process to exit. It probably - // relies on calling into JS. - struct timeval time; - return (gettimeofday(&time, NULL) == 0) - ? (int64_t)(time.tv_sec) * 1000000000 + (time.tv_usec * 1000) - : 0; -} +#ifdef LINK_ICALLS -static PinvokeImport SystemNativeImports [] = { - {"SystemNative_GetEnv", SystemNative_GetEnv }, - {"SystemNative_GetEnviron", SystemNative_GetEnviron }, - {"SystemNative_FreeEnviron", SystemNative_FreeEnviron }, - {"SystemNative_LChflagsCanSetHiddenFlag", SystemNative_LChflagsCanSetHiddenFlag }, - {"SystemNative_Dup", SystemNative_Dup}, - {"SystemNative_Write", SystemNative_Write2}, - {"SystemNative_GetSystemTimeAsTicks", SystemNative_GetSystemTimeAsTicks}, - {"SystemNative_LStat", SystemNative_Stat2}, - {"SystemNative_FStat", SystemNative_FStat}, - {"SystemNative_LSeek", SystemNative_LSeek}, - {"SystemNative_ConvertErrorPlatformToPal", SystemNative_ConvertErrorPlatformToPal}, - {"SystemNative_LowLevelMonitor_Create", SystemNative_LowLevelMonitor_Create}, - {"SystemNative_LowLevelMonitor_Acquire", SystemNative_LowLevelMonitor_Acquire}, - {"SystemNative_LowLevelMonitor_Release", SystemNative_LowLevelMonitor_Release}, - {"SystemNative_LowLevelMonitor_TimedWait", SystemNative_LowLevelMonitor_TimedWait}, - {"SystemNative_LowLevelMonitor_Wait", SystemNative_LowLevelMonitor_Wait}, - {"SystemNative_GetErrNo", SystemNative_GetErrNo}, - {"SystemNative_SetErrNo", SystemNative_SetErrNo}, - {"SystemNative_GetCwd", SystemNative_GetCwd}, - {"SystemNative_GetNonCryptographicallySecureRandomBytes", SystemNative_GetNonCryptographicallySecureRandomBytes}, - {"SystemNative_GetCryptographicallySecureRandomBytes", SystemNative_GetCryptographicallySecureRandomBytes}, - {"SystemNative_Stat", SystemNative_Stat2}, - {"SystemNative_Open", SystemNative_Open2}, - {"SystemNative_Close", SystemNative_Close}, - {"SystemNative_ConvertErrorPalToPlatform", SystemNative_ConvertErrorPalToPlatform}, - {"SystemNative_StrErrorR", SystemNative_StrErrorR}, - {"SystemNative_PRead", SystemNative_PRead}, - {"SystemNative_CanGetHiddenFlag", SystemNative_CanGetHiddenFlag}, - {"SystemNative_GetTimestamp", SystemNative_GetTimestamp2}, - {"SystemNative_Access", SystemNative_Access}, - {"SystemNative_Malloc", SystemNative_Malloc}, - {"SystemNative_Free", SystemNative_Free}, - {"SystemNative_SysLog", SystemNative_SysLog}, - {NULL, NULL} -}; +#include "icall-table.h" -void GlobalizationNative_LoadICU() { - assert(0); +static int +compare_int (const void *k1, const void *k2) +{ + return *(int*)k1 - *(int*)k2; } -static PinvokeImport SystemGlobalizationNativeImports [] = { - {"GlobalizationNative_LoadICU", GlobalizationNative_LoadICU }, - {NULL, NULL} -}; - static void* -wasm_dl_load (const char *name, int flags, char **err, void *user_data) +icall_table_lookup (MonoMethod *method, char *classname, char *methodname, char *sigstart, int32_t *out_flags) { - if (!strcmp (name, "libSystem.Native")) - return SystemNativeImports; - if (!strcmp (name, "libSystem.Globalization.Native")) - return SystemGlobalizationNativeImports; + uint32_t token = mono_method_get_token (method); + assert (token); + assert ((token & MONO_TOKEN_METHOD_DEF) == MONO_TOKEN_METHOD_DEF); + uint32_t token_idx = token - MONO_TOKEN_METHOD_DEF; + + int *indexes = NULL; + int indexes_size = 0; + uint8_t *flags = NULL; + void **funcs = NULL; + + *out_flags = 0; + + const char *image_name = mono_image_get_name (mono_class_get_image (mono_method_get_class (method))); + +#if defined(ICALL_TABLE_corlib) + if (!strcmp (image_name, "System.Private.CoreLib")) { + indexes = corlib_icall_indexes; + indexes_size = sizeof (corlib_icall_indexes) / 4; + flags = corlib_icall_flags; + funcs = corlib_icall_funcs; + assert (sizeof (corlib_icall_indexes [0]) == 4); + } +#endif +#ifdef ICALL_TABLE_System + if (!strcmp (image_name, "System")) { + indexes = System_icall_indexes; + indexes_size = sizeof (System_icall_indexes) / 4; + flags = System_icall_flags; + funcs = System_icall_funcs; + } +#endif + assert (indexes); - //printf("In wasm_dl_load for name %s but treating as NOT FOUND\n", name); - return 0; + void *p = bsearch (&token_idx, indexes, indexes_size, 4, compare_int); + if (!p) { + return NULL; + printf ("wasm: Unable to lookup icall: %s\n", mono_method_get_name (method)); + exit (1); + } + + uint32_t idx = (int*)p - indexes; + *out_flags = flags [idx]; + + //printf ("ICALL: %s %x %d %d\n", methodname, token, idx, (int)(funcs [idx])); + + return funcs [idx]; } -static void* -wasm_dl_symbol (void *handle, const char *name, char **err, void *user_data) +static const char* +icall_table_lookup_symbol (void *func) { - if (handle == sysglobal_native_handle) - assert (0); - - PinvokeImport *table = (PinvokeImport*)handle; - for (int i = 0; table [i].name; ++i) { - if (!strcmp (table [i].name, name)) - return table [i].func; - } + assert (0); return NULL; } -#define NEED_INTERP 1 +#endif /* * get_native_to_interp: @@ -361,6 +278,9 @@ wasm_dl_symbol (void *handle, const char *name, char **err, void *user_data) void* get_native_to_interp (MonoMethod *method, void *extra_arg) { + void *addr; + + MONO_ENTER_GC_UNSAFE; MonoClass *klass = mono_method_get_class (method); MonoImage *image = mono_class_get_image (klass); MonoAssembly *assembly = mono_image_get_assembly (image); @@ -379,9 +299,9 @@ get_native_to_interp (MonoMethod *method, void *extra_arg) key [i] = '_'; } - assert(0); return 0; - //void *addr = wasm_dl_get_native_to_interp (key, extra_arg); - //return addr; + addr = wasm_dl_get_native_to_interp (key, extra_arg); + MONO_EXIT_GC_UNSAFE; + return addr; } void @@ -401,6 +321,8 @@ mono_wasm_register_bundled_satellite_assemblies (void) } } +void mono_wasm_link_icu_shim (void); + void cleanup_runtime_config (MonovmRuntimeConfigArguments *args, void *user_data) { @@ -409,7 +331,7 @@ cleanup_runtime_config (MonovmRuntimeConfigArguments *args, void *user_data) } void -mono_wasm_load_runtime (const char *argv, int debug_level) +mono_wasm_load_runtime (const char *unused, int debug_level) { const char *interp_opts = ""; @@ -421,12 +343,13 @@ mono_wasm_load_runtime (const char *argv, int debug_level) #ifdef DEBUG monoeg_g_setenv ("MONO_LOG_LEVEL", "debug", 0); - monoeg_g_setenv ("MONO_LOG_MASK", "gc", 0); - // Setting this env var allows Diagnostic.Debug to write to stderr. In a browser environment this - // output will be sent to the console. Right now this is the only way to emit debug logging from - // corlib assemblies. - monoeg_g_setenv ("COMPlus_DebugWriteToStdErr", "1", 0); + monoeg_g_setenv ("MONO_LOG_MASK", "all", 0); + // Setting this env var allows Diagnostic.Debug to write to stderr. In a browser environment this + // output will be sent to the console. Right now this is the only way to emit debug logging from + // corlib assemblies. + // monoeg_g_setenv ("COMPlus_DebugWriteToStdErr", "1", 0); #endif + char* debugger_fd = monoeg_g_getenv ("DEBUGGER_FD"); if (debugger_fd != 0) { @@ -447,7 +370,7 @@ mono_wasm_load_runtime (const char *argv, int debug_level) const char *appctx_values[2]; appctx_values [0] = "/"; - appctx_values [1] = "browser-wasm"; + appctx_values [1] = "wasi-wasm"; const char *file_name = RUNTIMECONFIG_BIN_FILE; int str_len = strlen (file_name) + 1; // +1 is for the "/" @@ -472,13 +395,53 @@ mono_wasm_load_runtime (const char *argv, int debug_level) mono_dl_fallback_register (wasm_dl_load, wasm_dl_symbol, NULL, NULL); mono_wasm_install_get_native_to_interp_tramp (get_native_to_interp); - + #ifdef GEN_PINVOKE mono_wasm_install_interp_to_native_callback (mono_wasm_interp_to_native_callback); #endif +#ifdef ENABLE_AOT + monoeg_g_setenv ("MONO_AOT_MODE", "aot", 1); + + // Defined in driver-gen.c + register_aot_modules (); +#ifdef EE_MODE_LLVMONLY_INTERP + mono_jit_set_aot_mode (MONO_AOT_MODE_LLVMONLY_INTERP); +#else + mono_jit_set_aot_mode (MONO_AOT_MODE_LLVMONLY); +#endif +#else mono_jit_set_aot_mode (MONO_AOT_MODE_INTERP_ONLY); + /* + * debug_level > 0 enables debugging and sets the debug log level to debug_level + * debug_level == 0 disables debugging and enables interpreter optimizations + * debug_level < 0 enabled debugging and disables debug logging. + * + * Note: when debugging is enabled interpreter optimizations are disabled. + */ + if (debug_level) { + // Disable optimizations which interfere with debugging + interp_opts = "-all"; + mono_wasm_enable_debugging (debug_level); + } + +#endif + +#ifdef LINK_ICALLS + /* Link in our own linked icall table */ + static const MonoIcallTableCallbacks mono_icall_table_callbacks = + { + MONO_ICALL_TABLE_CALLBACKS_VERSION, + icall_table_lookup, + icall_table_lookup_symbol + }; + mono_install_icall_table_callbacks (&mono_icall_table_callbacks); +#endif + +#ifdef NEED_NORMAL_ICALL_TABLES + mono_icall_table_init (); +#endif mono_ee_interp_init (interp_opts); mono_marshal_ilgen_init (); mono_method_builder_ilgen_init (); @@ -498,7 +461,7 @@ mono_wasm_load_runtime (const char *argv, int debug_level) mono_wasm_register_bundled_satellite_assemblies (); mono_trace_init (); - mono_trace_set_log_handler (wasm_trace_logger, NULL); + mono_trace_set_log_handler (wasi_trace_logger, NULL); root_domain = mono_jit_init_version ("mono", NULL); mono_thread_set_main (mono_thread_current ()); @@ -507,10 +470,9 @@ mono_wasm_load_runtime (const char *argv, int debug_level) MonoAssembly* mono_wasm_assembly_load (const char *name) { + assert (name); MonoImageOpenStatus status; MonoAssemblyName* aname = mono_assembly_name_new (name); - if (!name) - return NULL; MonoAssembly *res = mono_assembly_load (aname, NULL, &status); mono_assembly_name_free (aname); @@ -518,86 +480,65 @@ mono_wasm_assembly_load (const char *name) return res; } -MonoClass* -mono_wasm_find_corlib_class (const char *namespace, const char *name) +MonoAssembly* +mono_wasm_get_corlib (const char *namespace, const char *name) { - return mono_class_from_name (mono_get_corlib (), namespace, name); + MonoAssembly* result; + MONO_ENTER_GC_UNSAFE; + result = mono_image_get_assembly (mono_get_corlib()); + MONO_EXIT_GC_UNSAFE; + return result; } MonoClass* mono_wasm_assembly_find_class (MonoAssembly *assembly, const char *namespace, const char *name) { - return mono_class_from_name (mono_assembly_get_image (assembly), namespace, name); + assert (assembly); + MonoClass *result; + MONO_ENTER_GC_UNSAFE; + result = mono_class_from_name (mono_assembly_get_image (assembly), namespace, name); + MONO_EXIT_GC_UNSAFE; + return result; } MonoMethod* mono_wasm_assembly_find_method (MonoClass *klass, const char *name, int arguments) { - return mono_class_get_method_from_name (klass, name, arguments); -} - -MonoMethod* -mono_wasm_get_delegate_invoke (MonoObject *delegate) -{ - return mono_get_delegate_invoke(mono_object_get_class (delegate)); + assert (klass); + MonoMethod* result; + MONO_ENTER_GC_UNSAFE; + result = mono_class_get_method_from_name (klass, name, arguments); + MONO_EXIT_GC_UNSAFE; + return result; } -MonoObject* -mono_wasm_box_primitive (MonoClass *klass, void *value, int value_size) -{ - if (!klass) - return NULL; - - MonoType *type = mono_class_get_type (klass); - int alignment; - if (mono_type_size (type, &alignment) > value_size) - return NULL; - - // TODO: use mono_value_box_checked and propagate error out - return mono_value_box (root_domain, klass, value); -} void -mono_wasm_invoke_method_ref (MonoMethod *method, MonoObject **this_arg_in, void *params[], MonoObject **out_exc, MonoObject **out_result) +mono_wasm_invoke_method_ref (MonoMethod *method, MonoObject **this_arg_in, void *params[], MonoObject **_out_exc, MonoObject **out_result) { - MonoObject* temp_exc = NULL; + PPVOLATILE(MonoObject) out_exc = _out_exc; + PVOLATILE(MonoObject) temp_exc = NULL; if (out_exc) *out_exc = NULL; else out_exc = &temp_exc; + MONO_ENTER_GC_UNSAFE; if (out_result) { *out_result = NULL; - *out_result = mono_runtime_invoke (method, this_arg_in ? *this_arg_in : NULL, params, out_exc); + PVOLATILE(MonoObject) invoke_result = mono_runtime_invoke (method, this_arg_in ? *this_arg_in : NULL, params, (MonoObject **)out_exc); + store_volatile(out_result, invoke_result); } else { - mono_runtime_invoke (method, this_arg_in ? *this_arg_in : NULL, params, out_exc); + mono_runtime_invoke (method, this_arg_in ? *this_arg_in : NULL, params, (MonoObject **)out_exc); } if (*out_exc && out_result) { - MonoObject *exc2 = NULL; - *out_result = (MonoObject*)mono_object_to_string (*out_exc, &exc2); + PVOLATILE(MonoObject) exc2 = NULL; + store_volatile(out_result, (MonoObject*)mono_object_to_string (*out_exc, (MonoObject **)&exc2)); if (exc2) - *out_result = (MonoObject*) mono_string_new (root_domain, "Exception Double Fault"); - return; + store_volatile(out_result, (MonoObject*)mono_string_new (root_domain, "Exception Double Fault")); } -} - -// deprecated -MonoObject* -mono_wasm_invoke_method (MonoMethod *method, MonoObject *this_arg, void *params[], MonoObject **out_exc) -{ - MonoObject* result = NULL; - mono_wasm_invoke_method_ref (method, &this_arg, params, out_exc, &result); - - MonoMethodSignature *sig = mono_method_signature (method); - MonoType *type = mono_signature_get_return_type (sig); - // If the method return type is void return null - // This gets around a memory access crash when the result return a value when - // a void method is invoked. - if (mono_type_get_type (type) == MONO_TYPE_VOID) - return NULL; - - return result; + MONO_EXIT_GC_UNSAFE; } MonoMethod* @@ -606,10 +547,11 @@ mono_wasm_assembly_get_entry_point (MonoAssembly *assembly) MonoImage *image; MonoMethod *method; + MONO_ENTER_GC_UNSAFE; image = mono_assembly_get_image (assembly); uint32_t entry = mono_image_get_entry_point (image); if (!entry) - return NULL; + goto end; mono_domain_ensure_entry_assembly (root_domain, assembly); method = mono_get_method (image, entry, NULL); @@ -626,9 +568,10 @@ mono_wasm_assembly_get_entry_point (MonoAssembly *assembly) int name_length = strlen (name); if ((*name != '<') || (name [name_length - 1] != '>')) - return method; + goto end; MonoClass *klass = mono_method_get_class (method); + assert(klass); char *async_name = malloc (name_length + 2); snprintf (async_name, name_length + 2, "%s$", name); @@ -637,7 +580,8 @@ mono_wasm_assembly_get_entry_point (MonoAssembly *assembly) MonoMethod *async_method = mono_class_get_method_from_name (klass, async_name, mono_signature_get_param_count (sig)); if (async_method != NULL) { free (async_name); - return async_method; + method = async_method; + goto end; } // look for "Name" by trimming the first and last character of "" @@ -646,24 +590,12 @@ mono_wasm_assembly_get_entry_point (MonoAssembly *assembly) free (async_name); if (async_method != NULL) - return async_method; + method = async_method; } - return method; -} - -char * -mono_wasm_string_get_utf8 (MonoString *str) -{ - return mono_string_to_utf8 (str); //XXX JS is responsible for freeing this -} -MonoString * -mono_wasm_string_from_js (const char *str) -{ - if (str) - return mono_string_new (root_domain, str); - else - return NULL; + end: + MONO_EXIT_GC_UNSAFE; + return method; } int @@ -691,49 +623,18 @@ mono_unbox_int (MonoObject *obj) return *(unsigned int*)ptr; case MONO_TYPE_CHAR: return *(short*)ptr; - // WASM doesn't support returning longs to JS - // case MONO_TYPE_I8: - // case MONO_TYPE_U8: default: printf ("Invalid type %d to mono_unbox_int\n", mono_type_get_type (type)); return 0; } } -int -mono_wasm_array_length (MonoArray *array) -{ - return mono_array_length (array); -} - -MonoObject* -mono_wasm_array_get (MonoArray *array, int idx) -{ - return mono_array_get (array, MonoObject*, idx); -} - -MonoArray* -mono_wasm_obj_array_new (int size) -{ - return mono_array_new (root_domain, mono_get_object_class (), size); -} - -void -mono_wasm_obj_array_set (MonoArray *array, int idx, MonoObject *obj) -{ - mono_array_setref (array, idx, obj); -} - -MonoArray* -mono_wasm_string_array_new (int size) -{ - return mono_array_new (root_domain, mono_get_string_class (), size); -} void mono_wasm_string_get_data_ref ( MonoString **string, mono_unichar2 **outChars, int *outLengthBytes, int *outIsInterned ) { + MONO_ENTER_GC_UNSAFE; if (!string || !(*string)) { if (outChars) *outChars = 0; @@ -741,16 +642,15 @@ mono_wasm_string_get_data_ref ( *outLengthBytes = 0; if (outIsInterned) *outIsInterned = 1; - return; - } - + } else { if (outChars) *outChars = mono_string_chars (*string); if (outLengthBytes) *outLengthBytes = mono_string_length (*string) * 2; if (outIsInterned) *outIsInterned = mono_string_instance_is_interned (*string); - return; + } + MONO_EXIT_GC_UNSAFE; } void @@ -761,36 +661,63 @@ mono_wasm_string_get_data ( } void add_assembly(const char* base_dir, const char *name) { - FILE *fileptr; - unsigned char *buffer; - long filelen; - char filename[256]; - sprintf(filename, "%s/%s", base_dir, name); - // printf("Loading %s...\n", filename); - - fileptr = fopen(filename, "rb"); - if (fileptr == 0) { - printf("Failed to load %s\n", filename); - fflush(stdout); - } - - fseek(fileptr, 0, SEEK_END); - filelen = ftell(fileptr); - rewind(fileptr); - - buffer = (unsigned char *)malloc(filelen * sizeof(char)); - fread(buffer, filelen, 1, fileptr); - fclose(fileptr); - - assert(mono_wasm_add_assembly(name, buffer, filelen)); + FILE *fileptr; + unsigned char *buffer; + long filelen; + char filename[256]; + sprintf(filename, "%s/%s", base_dir, name); + // printf("Loading %s...\n", filename); + + fileptr = fopen(filename, "rb"); + if (fileptr == 0) { + printf("Failed to load %s\n", filename); + fflush(stdout); + } + + fseek(fileptr, 0, SEEK_END); + filelen = ftell(fileptr); + rewind(fileptr); + + buffer = (unsigned char *)malloc(filelen * sizeof(char)); + if(!fread(buffer, filelen, 1, fileptr)) { + printf("Failed to load %s\n", filename); + fflush(stdout); + } + fclose(fileptr); + + assert(mono_wasm_add_assembly(name, buffer, filelen)); } MonoMethod* lookup_dotnet_method(const char* assembly_name, const char* namespace, const char* type_name, const char* method_name, int num_params) { - MonoAssembly* assembly = mono_wasm_assembly_load (assembly_name); + MonoAssembly* assembly = mono_wasm_assembly_load (assembly_name); assert (assembly); - MonoClass* class = mono_wasm_assembly_find_class (assembly, namespace, type_name); + MonoClass* class = mono_wasm_assembly_find_class (assembly, namespace, type_name); assert (class); - MonoMethod* method = mono_wasm_assembly_find_method (class, method_name, num_params); + MonoMethod* method = mono_wasm_assembly_find_method (class, method_name, num_params); assert (method); return method; } + +int main() { + // Assume the runtime pack has been copied into the output directory as 'runtime' + // Otherwise we have to mount an unrelated part of the filesystem within the WASM environment + mono_set_assemblies_path(".:./runtime/native:./runtime/lib/net7.0"); + mono_wasm_load_runtime("", 0); + + MonoAssembly* assembly = mono_wasm_assembly_load ("Wasi.Console.Sample"); + MonoMethod* entry_method = mono_wasm_assembly_get_entry_point (assembly); + MonoObject* out_exc; + MonoObject* out_res; + mono_wasm_invoke_method_ref (entry_method, NULL, NULL, &out_exc, &out_res); + if (out_exc) + { + mono_print_unhandled_exception(out_exc); + exit(1); + } + if(out_res) + { + int r= mono_unbox_int (out_res); + return r; + } + return 0; +} \ No newline at end of file diff --git a/src/mono/wasi/runtime/pinvoke.c b/src/mono/wasi/runtime/pinvoke.c new file mode 100644 index 0000000000000..0655b256f034d --- /dev/null +++ b/src/mono/wasi/runtime/pinvoke.c @@ -0,0 +1,64 @@ +// TODOWASI deduplicate src/mono/wasm/runtime/pinvoke.c +#include "wasm-config.h" +#include "pinvoke.h" + +#include +#include + +/* + * The table header contain autogenerated function declarations, so avoid including standard headers + * to avoid incompatible declarations. + */ +#define NULL ((void*)0) +int strcmp (const char *s1, const char *s2); +void mono_wasm_printerr (const char *s); + +#ifdef GEN_PINVOKE +#include "pinvoke-table.h" +#else +#include "pinvoke-tables-default.h" +#endif + +void +mono_wasm_pinvoke_vararg_stub (void) +{ + /* This is just a stub used to mark vararg pinvokes */ +} + +void* +wasm_dl_lookup_pinvoke_table (const char *name) +{ + for (int i = 0; i < sizeof (pinvoke_tables) / sizeof (void*); ++i) { + if (!strcmp (name, pinvoke_names [i])) + return pinvoke_tables [i]; + } + return NULL; +} + +int +wasm_dl_is_pinvoke_table (void *handle) +{ + for (int i = 0; i < sizeof (pinvoke_tables) / sizeof (void*); ++i) { + if (pinvoke_tables [i] == handle) { + return 1; + } + } + return 0; +} + +void* +wasm_dl_get_native_to_interp (const char *key, void *extra_arg) +{ +#ifdef GEN_PINVOKE + for (int i = 0; i < sizeof (wasm_native_to_interp_map) / sizeof (void*); ++i) { + if (!strcmp (wasm_native_to_interp_map [i], key)) { + void *addr = wasm_native_to_interp_funcs [i]; + wasm_native_to_interp_ftndescs [i] = *(InterpFtnDesc*)extra_arg; + return addr; + } + } + return NULL; +#else + return NULL; +#endif +} diff --git a/src/mono/wasi/mono-wasi-driver/stubs.c b/src/mono/wasi/runtime/stubs.c similarity index 100% rename from src/mono/wasi/mono-wasi-driver/stubs.c rename to src/mono/wasi/runtime/stubs.c diff --git a/src/mono/wasi/mono-wasi-driver/synthetic-pthread.c b/src/mono/wasi/runtime/synthetic-pthread.c similarity index 100% rename from src/mono/wasi/mono-wasi-driver/synthetic-pthread.c rename to src/mono/wasi/runtime/synthetic-pthread.c diff --git a/src/mono/wasi/sample/.gitignore b/src/mono/wasi/sample/.gitignore deleted file mode 100644 index 19e1bced9ad8a..0000000000000 --- a/src/mono/wasi/sample/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.wasm diff --git a/src/mono/wasi/sample/Directory.Build.props b/src/mono/wasi/sample/Directory.Build.props deleted file mode 100644 index 69b70ee868b5a..0000000000000 --- a/src/mono/wasi/sample/Directory.Build.props +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - bin/$(Configuration)/net7.0 - - diff --git a/src/mono/wasi/sample/SampleMakefile.variable b/src/mono/wasi/sample/SampleMakefile.variable deleted file mode 100644 index 99f7e6916e9cd..0000000000000 --- a/src/mono/wasi/sample/SampleMakefile.variable +++ /dev/null @@ -1,20 +0,0 @@ -TOP=$(realpath $(CURDIR)/../../../../..) - -COMPILE_FLAGS=\ - $(WASI_BIN_DIR)/*.a \ - $(BROWSER_WASM_RUNTIME_PATH)/native/libSystem.Native.a \ - --sysroot=$(WASI_SDK_ROOT)/share/wasi-sysroot \ - -I$(TOP)/src/mono -I$(TOP)/src/native/public - -LINK_FLAGS=\ - -Wl,--export=malloc,--export=free,--export=__heap_base,--export=__data_end \ - -Wl,-z,stack-size=1048576,--initial-memory=5242880,--max-memory=52428800,-lwasi-emulated-mman - -ifndef DOTNET_ROOT -DOTNET_ROOT=$(TOP)/.dotnet -echo "DOTNET_ROOT is undefined. Example: export DOTNET_ROOT=~/dotnet7. Defaulting to $(DOTNET_ROOT) -endif -ifndef BROWSER_WASM_RUNTIME_PATH -BROWSER_WASM_RUNTIME_PATH=$(TOP)/artifacts/bin/microsoft.netcore.app.runtime.browser-wasm/$(CONFIG)/runtimes/browser-wasm -echo "BROWSER_WASM_RUNTIME_PATH is undefined. Example: export BROWSER_WASM_RUNTIME_PATH=$(DOTNET_ROOT)/packs/Microsoft.NETCore.App.Runtime.Mono.browser-wasm/7.0.0-alpha.1.22061.11/runtimes/browser-wasm). Defaulting to $(BROWSER_WASM_RUNTIME_PATH)" -endif diff --git a/src/mono/wasi/sample/console/Makefile b/src/mono/wasi/sample/console/Makefile deleted file mode 100644 index b4d731f9d3f37..0000000000000 --- a/src/mono/wasi/sample/console/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -include ../../Makefile.variable -include ../SampleMakefile.variable - -BIN_DIR=WasiConsoleApp/bin/Debug/net7.0 - -all: console.wasm $(BIN_DIR)/WasiConsoleApp.dll - -run: all - @(which wasmtime || PATH=$(WASMTIME_DIR):${PATH} which wasmtime); \ - test "$$?" -ne 0 \ - && echo "wasmtime not found. Either install that yourself, or use 'make provision-deps' to install one." \ - || PATH=$(WASMTIME_DIR):${PATH} wasmtime --dir=. console.wasm - -run-wasmer: all - wasmer --dir=. console.wasm - -console.wasm: main.c - $(WASI_SDK_CLANG) main.c -o console.wasm $(COMPILE_FLAGS) $(LINK_FLAGS) - -$(BIN_DIR)/WasiConsoleApp.dll: WasiConsoleApp/*.csproj WasiConsoleApp/*.cs - find $(BROWSER_WASM_RUNTIME_PATH) -type f - cd WasiConsoleApp && $(DOTNET_ROOT)/dotnet build -c Debug - touch $(BIN_DIR)/*.dll - cp -R $(BROWSER_WASM_RUNTIME_PATH) $(BIN_DIR)/runtime - -debug: all -#wasmtime has a bug when passing --tcplisten and --dir, to make it work we should use this PR https://github.com/bytecodealliance/wasmtime/pull/3995 and then the fd of the socket will be 4. - PATH=$(WASMTIME_DIR):${PATH} wasmtime --tcplisten localhost:64000 --dir=. console.wasm --env DEBUGGER_FD=4 diff --git a/src/mono/wasi/sample/console/WasiConsoleApp/Program.cs b/src/mono/wasi/sample/console/WasiConsoleApp/Program.cs deleted file mode 100644 index 83a7facbcf64d..0000000000000 --- a/src/mono/wasi/sample/console/WasiConsoleApp/Program.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System; - -namespace WasiConsoleApp -{ - public class Program - { - public static int Main() - { - Console.WriteLine($"Hello from .NET at {DateTime.Now.ToLongTimeString()}"); - return 0; - } - } -} diff --git a/src/mono/wasi/sample/console/WasiConsoleApp/WasiConsoleApp.csproj b/src/mono/wasi/sample/console/WasiConsoleApp/WasiConsoleApp.csproj deleted file mode 100644 index 2e577472d6860..0000000000000 --- a/src/mono/wasi/sample/console/WasiConsoleApp/WasiConsoleApp.csproj +++ /dev/null @@ -1,10 +0,0 @@ - - - - Exe - net7.0 - true - embedded - - - diff --git a/src/mono/wasi/sample/console/main.c b/src/mono/wasi/sample/console/main.c deleted file mode 100644 index 8647c4878f2ab..0000000000000 --- a/src/mono/wasi/sample/console/main.c +++ /dev/null @@ -1,21 +0,0 @@ -#include -#include "../../mono-wasi-driver/driver.h" - -int main() { - // Assume the runtime pack has been copied into the output directory as 'runtime' - // Otherwise we have to mount an unrelated part of the filesystem within the WASM environment - const char* app_base_dir = "./WasiConsoleApp/bin/Debug/net7.0"; - char* assemblies_path; - asprintf(&assemblies_path, "%s:%s/runtime/native:%s/runtime/lib/net7.0", app_base_dir, app_base_dir, app_base_dir); - - add_assembly(app_base_dir, "WasiConsoleApp.dll"); - mono_set_assemblies_path(assemblies_path); - - mono_wasm_load_runtime("", 0); - - MonoAssembly* assembly = mono_wasm_assembly_load ("WasiConsoleApp.dll"); - MonoMethod* entry_method = mono_wasm_assembly_get_entry_point (assembly); - MonoObject* out_exc; - MonoObject *exit_code = mono_wasm_invoke_method (entry_method, NULL, NULL, &out_exc); - return mono_unbox_int (exit_code); -} diff --git a/src/mono/wasi/wasi-sdk-version.txt b/src/mono/wasi/wasi-sdk-version.txt new file mode 100644 index 0000000000000..19c7bdba7b1e9 --- /dev/null +++ b/src/mono/wasi/wasi-sdk-version.txt @@ -0,0 +1 @@ +16 \ No newline at end of file diff --git a/src/mono/wasi/wasi.proj b/src/mono/wasi/wasi.proj index 7053b6b952e0e..5ec5c4cc121fe 100644 --- a/src/mono/wasi/wasi.proj +++ b/src/mono/wasi/wasi.proj @@ -1,2 +1,244 @@ + + + wasi-wasm + $([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'native', '$(NetCoreAppCurrent)-$(TargetOS)-$(Configuration)-$(TargetArchitecture)')) + + + + + $([MSBuild]::NormalizeDirectory('$(PkgMicrosoft_NETCore_Runtime_ICU_Transport)', 'runtimes', 'browser-wasm', 'native', 'lib')) + $([MSBuild]::NormalizeDirectory('$(PkgMicrosoft_NETCore_Runtime_ICU_Transport)', 'runtimes', 'browser-wasm-threads', 'native', 'lib')) + false + false + $(ArtifactsObjDir)wasm + <_WasiDefaultsRspPath>$(NativeBinDir)src\wasi-default.rsp + <_WasiCompileRspPath>$(NativeBinDir)src\wasi-compile.rsp + <_WasiLinkRspPath>$(NativeBinDir)src\wasi-link.rsp + false + + + + + + + + + + + + + + + + + $(NativeBinDir)dotnet.timezones.blat + + + + + + + + + $(WasmObjDir)\pinvoke-table.h + $(WasmObjDir)\wasm_m2n_invoke.g.h + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_WasiFlags Include="@(_WasiCommonFlags)" /> + + <_WasiCompileFlags Condition="'$(MonoWasmThreads)' == 'true'" Include="-I$([MSBuild]::NormalizePath('$(PkgMicrosoft_NETCore_Runtime_ICU_Transport)', 'runtimes', 'browser-wasm-threads', 'native', 'include').Replace('\','/'))"/> + <_WasiCompileFlags Condition="'$(MonoWasmThreads)' != 'true'" Include="-I$([MSBuild]::NormalizePath('$(PkgMicrosoft_NETCore_Runtime_ICU_Transport)', 'runtimes', 'browser-wasm', 'native', 'include').Replace('\','/'))"/> + <_WasiCompileFlags Include="-I$([MSBuild]::NormalizePath('$(MonoProjectRoot)', 'wasi', 'include').Replace('\','/'))"/> + <_WasiCompileFlags Include="-I$([MSBuild]::NormalizePath('$(MonoProjectRoot)', 'wasi', 'mono-include').Replace('\','/'))"/> + <_WasiCompileFlags Include="-I$([MSBuild]::NormalizePath('$(RepoRoot)', 'src', 'native', 'public').Replace('\','/'))"/> + <_WasiCompileFlags Include="-I$([MSBuild]::NormalizePath('$(MonoProjectRoot)', 'mono', 'eglib').Replace('\','/'))"/> + <_WasiCompileFlags Include="-D_WASI_EMULATED_PROCESS_CLOCKS"/> + <_WasiCompileFlags Include="-D_WASI_EMULATED_SIGNAL"/> + <_WasiCompileFlags Include="-D_WASI_EMULATED_MMAN"/> + <_WasiLinkFlags Include="-Wl,-z,stack-size=1048576,--initial-memory=5242880,--max-memory=52428800,-lwasi-emulated-process-clocks,-lwasi-emulated-signal,-lwasi-emulated-mman"/> + + + + <_WasmOptConfigurationFlags>@(WasmOptConfigurationFlags, '%3B ') + <_WasiPropsJson> + + + + + + + + + + + + + + + + + + + + + $(ArtifactsObjDir)wasm/pinvoke-table.h + $(ArtifactsObjDir)wasm/wasm_m2n_invoke.g.h + + -g -Os -DDEBUG=1 -DENABLE_AOT_PROFILER=1 + -Oz + + $(CMakeConfigurationWasiFlags) + -O2 + + cmake $(MSBuildThisFileDirectory)runtime + cmake -G Ninja $(MSBuildThisFileDirectory)runtime + + $(CMakeBuildRuntimeConfigureCmd) -DWASI_SDK_PREFIX=$(WASI_SDK_PATH) + $(CMakeBuildRuntimeConfigureCmd) -DCMAKE_SYSROOT=$(WASI_SDK_PATH)share/wasi-sysroot + $(CMakeBuildRuntimeConfigureCmd) -DCMAKE_TOOLCHAIN_FILE=$(WASI_SDK_PATH)share/cmake/wasi-sdk.cmake + $(CMakeBuildRuntimeConfigureCmd) -DCMAKE_CXX_FLAGS="--sysroot=$(WASI_SDK_PATH)share/wasi-sysroot" + + $(CMakeBuildRuntimeConfigureCmd) -DCONFIGURATION_WASICC_FLAGS="$(CMakeConfigurationWasiFlags)" + $(CMakeBuildRuntimeConfigureCmd) -DCONFIGURATION_LINK_FLAGS="$(CMakeConfigurationLinkFlags)" + $(CMakeBuildRuntimeConfigureCmd) -DCONFIGURATION_WASM_OPT_FLAGS="@(WasmOptConfigurationFlags, ';')" + $(CMakeBuildRuntimeConfigureCmd) -DMONO_INCLUDES="$(MonoArtifactsPath)include/mono-2.0" + $(CMakeBuildRuntimeConfigureCmd) -DMONO_OBJ_INCLUDES="$(MonoObjDir.TrimEnd('\/'))" + + $(CMakeBuildRuntimeConfigureCmd) -DMONO_ARTIFACTS_DIR="$(MonoArtifactsPath.TrimEnd('\/'))" + $(CMakeBuildRuntimeConfigureCmd) -DNATIVE_BIN_DIR="$(NativeBinDir.TrimEnd('\/'))" + $(CMakeBuildRuntimeConfigureCmd) -DWASM_OPT_ADDITIONAL_FLAGS="--enable-simd" + $(CMakeBuildRuntimeConfigureCmd) -DDISABLE_THREADS=0 + $(CMakeBuildRuntimeConfigureCmd) -DDISABLE_WASM_USER_THREADS=1 + call "$(RepositoryEngineeringDir)native\init-vs-env.cmd" wasm && $(CMakeBuildRuntimeConfigureCmd) + + -v + cmake --build . --config $(Configuration) $(CmakeOptions) + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mono/wasi/wasmtime-version.txt b/src/mono/wasi/wasmtime-version.txt new file mode 100644 index 0000000000000..56fea8a08d2fa --- /dev/null +++ b/src/mono/wasi/wasmtime-version.txt @@ -0,0 +1 @@ +3.0.0 \ No newline at end of file diff --git a/src/mono/wasm/runtime/gc-common.h b/src/mono/wasm/runtime/gc-common.h index 92789e641a361..4432633db7645 100644 --- a/src/mono/wasm/runtime/gc-common.h +++ b/src/mono/wasm/runtime/gc-common.h @@ -1,6 +1,10 @@ #define PVOLATILE(T) T* volatile #define PPVOLATILE(T) T* volatile * +#if !defined(TARGET_BROWSER) && !defined(EMSCRIPTEN_KEEPALIVE) +#define EMSCRIPTEN_KEEPALIVE +#endif + #define gpointer void* MONO_API MONO_RT_EXTERNAL_ONLY gpointer diff --git a/src/native/libs/CMakeLists.txt b/src/native/libs/CMakeLists.txt index 26ff71928ffb6..13c06f11493d7 100644 --- a/src/native/libs/CMakeLists.txt +++ b/src/native/libs/CMakeLists.txt @@ -35,7 +35,7 @@ else () set(STATIC_LIB_DESTINATION .) endif () -if (CLR_CMAKE_TARGET_UNIX OR CLR_CMAKE_TARGET_BROWSER) +if (CLR_CMAKE_TARGET_UNIX OR CLR_CMAKE_TARGET_BROWSER OR CLR_CMAKE_TARGET_WASI) set(CMAKE_MACOSX_RPATH ON) if (CLR_CMAKE_TARGET_MACCATALYST OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS) set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR ON) @@ -48,11 +48,23 @@ if (CLR_CMAKE_TARGET_UNIX OR CLR_CMAKE_TARGET_BROWSER) add_compile_options(-I${CMAKE_CURRENT_SOURCE_DIR}/Common) add_compile_options(-I${CMAKE_CURRENT_BINARY_DIR}/Common) - if (CLR_CMAKE_TARGET_BROWSER) + if (CLR_CMAKE_TARGET_BROWSER OR CLR_CMAKE_TARGET_WASI) set(GEN_SHARED_LIB 0) set(STATIC_LIB_DESTINATION .) endif () + if (CLR_CMAKE_TARGET_WASI) + add_compile_options(-I${CLR_REPO_ROOT_DIR}/src/mono/wasi/include/) + add_compile_options(-I${CLR_REPO_ROOT_DIR}/src/mono/wasi/libs-include/) + add_compile_options(-Wno-unused-variable) + add_compile_options(-Wno-unused-parameter) + add_compile_options(-Wno-gnu-statement-expression) + add_compile_options(-D_WASI_EMULATED_PROCESS_CLOCKS) + add_compile_options(-D_WASI_EMULATED_SIGNAL) + add_compile_options(-D_WASI_EMULATED_MMAN) + add_link_options(-Wl,-z,stack-size=1048576,--initial-memory=5242880,--max-memory=52428800,-lwasi-emulated-process-clocks,-lwasi-emulated-signal,-lwasi-emulated-mman) + endif () + if (CLR_CMAKE_TARGET_TVOS) # with -fembed-bitcode passing -headerpad_max_install_names is not allowed so remove it from the CMake flags string(REPLACE "-Wl,-headerpad_max_install_names" "" CMAKE_C_LINK_FLAGS ${CMAKE_C_LINK_FLAGS}) @@ -133,10 +145,10 @@ endif () add_subdirectory(System.IO.Compression.Native) -if (CLR_CMAKE_TARGET_UNIX OR CLR_CMAKE_TARGET_BROWSER) +if (CLR_CMAKE_TARGET_UNIX OR CLR_CMAKE_TARGET_BROWSER OR CLR_CMAKE_TARGET_WASI) include(configure.cmake) - if (NOT CLR_CMAKE_TARGET_BROWSER AND NOT CLR_CMAKE_TARGET_MACCATALYST AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS AND NOT CLR_CMAKE_TARGET_ANDROID) + if (NOT CLR_CMAKE_TARGET_BROWSER AND NOT CLR_CMAKE_TARGET_WASI AND NOT CLR_CMAKE_TARGET_MACCATALYST AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS AND NOT CLR_CMAKE_TARGET_ANDROID) add_subdirectory(System.IO.Ports.Native) endif () @@ -154,7 +166,7 @@ if (CLR_CMAKE_TARGET_UNIX OR CLR_CMAKE_TARGET_BROWSER) add_subdirectory(System.Native) - if (CLR_CMAKE_TARGET_BROWSER) + if (CLR_CMAKE_TARGET_BROWSER OR CLR_CMAKE_TARGET_WASI) # skip for now elseif (CLR_CMAKE_TARGET_MACCATALYST) add_subdirectory(System.Net.Security.Native) diff --git a/src/native/libs/Common/pal_config.h.in b/src/native/libs/Common/pal_config.h.in index acacfb33e34a3..464ae1d326607 100644 --- a/src/native/libs/Common/pal_config.h.in +++ b/src/native/libs/Common/pal_config.h.in @@ -8,6 +8,7 @@ #cmakedefine01 HAVE_STATFS_MOUNT #cmakedefine01 HAVE_FLOCK64 #cmakedefine01 HAVE_F_DUPFD_CLOEXEC +#cmakedefine01 HAVE_F_DUPFD #cmakedefine01 HAVE_F_FULLFSYNC #cmakedefine01 HAVE_O_CLOEXEC #cmakedefine01 HAVE_GETIFADDRS @@ -15,6 +16,9 @@ #cmakedefine01 HAVE_STAT64 #cmakedefine01 HAVE_FORK #cmakedefine01 HAVE_VFORK +#cmakedefine01 HAVE_CHMOD +#cmakedefine01 HAVE_FCHMOD +#cmakedefine01 HAVE_PIPE #cmakedefine01 HAVE_PIPE2 #cmakedefine01 HAVE_STAT_BIRTHTIME #cmakedefine01 HAVE_STAT_TIMESPEC @@ -51,6 +55,9 @@ #cmakedefine01 HAVE_FDS_BITS #cmakedefine01 HAVE_PRIVATE_FDS_BITS #cmakedefine01 HAVE_STATFS +#cmakedefine01 HAVE_MNTENT_H +#cmakedefine01 HAVE_SIGNAL_KILL +#cmakedefine01 HAVE_SYS_RESOURCE_H #cmakedefine01 HAVE_SYS_SOCKIO_H #cmakedefine01 HAVE_ETHTOOL_H #cmakedefine01 HAVE_SYS_POLL_H @@ -126,6 +133,15 @@ #cmakedefine01 HAVE_CFSETSPEED #cmakedefine01 HAVE_CFMAKERAW #cmakedefine01 HAVE_GETGROUPLIST +#cmakedefine01 HAVE_SYSLOG_H +#cmakedefine01 HAVE_PWD_H +#cmakedefine01 HAVE_GRP_H +#cmakedefine01 HAVE_TERMIOS_H +#cmakedefine01 HAVE_DLFCN_H +#cmakedefine01 HAVE_PTHREAD_H +#cmakedefine01 HAVE_SYS_WAIT_H +#cmakedefine01 HAVE_SYS_STATVFS_H +#cmakedefine01 HAVE_NET_IF_H #cmakedefine01 HAVE_SYS_PROCINFO_H #cmakedefine01 HAVE_IOSS_H #cmakedefine01 HAVE_ALIGNED_ALLOC diff --git a/src/native/libs/Common/pal_error_common.h b/src/native/libs/Common/pal_error_common.h index cf1bb7bcf4b5a..e9de2b793e408 100644 --- a/src/native/libs/Common/pal_error_common.h +++ b/src/native/libs/Common/pal_error_common.h @@ -309,12 +309,18 @@ inline static int32_t ConvertErrorPlatformToPal(int32_t platformErrno) case ESOCKTNOSUPPORT: return Error_ESOCKTNOSUPPORT; #endif +#ifdef EPFNOSUPPORT // not available in WASI case EPFNOSUPPORT: return Error_EPFNOSUPPORT; +#endif +#ifdef ESHUTDOWN // not available in WASI case ESHUTDOWN: return Error_ESHUTDOWN; +#endif +#ifdef EHOSTDOWN // not available in WASI case EHOSTDOWN: return Error_EHOSTDOWN; +#endif #ifdef ENODATA // not available in FreeBSD case ENODATA: return Error_ENODATA; @@ -495,16 +501,22 @@ inline static int32_t ConvertErrorPalToPlatform(int32_t error) return ETXTBSY; case Error_EXDEV: return EXDEV; +#ifdef EPFNOSUPPORT // not available in WASI case Error_EPFNOSUPPORT: return EPFNOSUPPORT; +#endif #ifdef ESOCKTNOSUPPORT case Error_ESOCKTNOSUPPORT: return ESOCKTNOSUPPORT; #endif +#ifdef ESHUTDOWN // not available in WASI case Error_ESHUTDOWN: return ESHUTDOWN; +#endif +#ifdef EHOSTDOWN // not available in WASI case Error_EHOSTDOWN: return EHOSTDOWN; +#endif #ifdef ENODATA // not available in FreeBSD case Error_ENODATA: return ENODATA; @@ -537,9 +549,11 @@ static bool TryConvertErrorToGai(int32_t error, int32_t* gaiError) switch (error) { +#ifdef EAI_NONAME // not available in WASI case EHOSTNOTFOUND: *gaiError = EAI_NONAME; return true; +#endif default: *gaiError = error; return false; diff --git a/src/native/libs/Common/pal_io_common.h b/src/native/libs/Common/pal_io_common.h index 82a8289744473..75c73b6ef6813 100644 --- a/src/native/libs/Common/pal_io_common.h +++ b/src/native/libs/Common/pal_io_common.h @@ -109,9 +109,11 @@ inline static int32_t Common_Poll(PollEvent* pollEvents, uint32_t eventCount, in case PAL_POLLIN: pollfds[i].events = POLLIN; break; +#ifdef POLLPRI // not available in WASI case PAL_POLLPRI: pollfds[i].events = POLLPRI; break; +#endif case PAL_POLLOUT: pollfds[i].events = POLLOUT; break; @@ -157,9 +159,11 @@ inline static int32_t Common_Poll(PollEvent* pollEvents, uint32_t eventCount, in case POLLIN: pollEvents[i].TriggeredEvents = PAL_POLLIN; break; +#ifdef POLLPRI // not available in WASI case POLLPRI: pollEvents[i].TriggeredEvents = PAL_POLLPRI; break; +#endif case POLLOUT: pollEvents[i].TriggeredEvents = PAL_POLLOUT; break; diff --git a/src/native/libs/Common/pal_utilities.h b/src/native/libs/Common/pal_utilities.h index d517974c9fcf3..babb42bc4cecc 100644 --- a/src/native/libs/Common/pal_utilities.h +++ b/src/native/libs/Common/pal_utilities.h @@ -83,7 +83,9 @@ inline static int ToFileDescriptorUnchecked(intptr_t fd) */ inline static int ToFileDescriptor(intptr_t fd) { +#ifndef TARGET_WASI assert(0 <= fd && fd < sysconf(_SC_OPEN_MAX)); +#endif return ToFileDescriptorUnchecked(fd); } diff --git a/src/native/libs/System.Globalization.Native/CMakeLists.txt b/src/native/libs/System.Globalization.Native/CMakeLists.txt index 5e2fb2948cc43..0ee4e400c5f4c 100644 --- a/src/native/libs/System.Globalization.Native/CMakeLists.txt +++ b/src/native/libs/System.Globalization.Native/CMakeLists.txt @@ -77,11 +77,11 @@ if (CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_MACCATALYST OR CLR_CMAKE_TARGET_IOS endif() # time zone names are filtered out of icu data for the browser and associated functionality is disabled -if (NOT CLR_CMAKE_TARGET_BROWSER) +if (NOT CLR_CMAKE_TARGET_BROWSER AND NOT CLR_CMAKE_TARGET_WASI) set(NATIVEGLOBALIZATION_SOURCES ${NATIVEGLOBALIZATION_SOURCES} pal_timeZoneInfo.c) endif() -if (NOT GEN_SHARED_LIB AND NOT CLR_CMAKE_TARGET_MACCATALYST AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS AND NOT CLR_CMAKE_TARGET_ANDROID AND NOT CLR_CMAKE_TARGET_BROWSER) +if (NOT GEN_SHARED_LIB AND NOT CLR_CMAKE_TARGET_MACCATALYST AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS AND NOT CLR_CMAKE_TARGET_ANDROID AND NOT CLR_CMAKE_TARGET_BROWSER AND NOT CLR_CMAKE_TARGET_WASI) set(NATIVEGLOBALIZATION_SOURCES ${NATIVEGLOBALIZATION_SOURCES} entrypoints.c) endif() diff --git a/src/native/libs/System.Globalization.Native/pal_icushim_static.c b/src/native/libs/System.Globalization.Native/pal_icushim_static.c index cd57172b52329..0011460460668 100644 --- a/src/native/libs/System.Globalization.Native/pal_icushim_static.c +++ b/src/native/libs/System.Globalization.Native/pal_icushim_static.c @@ -45,8 +45,12 @@ static void U_CALLCONV icu_trace_data(const void* context, int32_t fnNumber, int printf("[ICUDT] %s: %s\n", utrace_functionName(fnNumber), buf); } +#if defined(TARGET_BROWSER) || defined(TARGET_WASI) #ifdef __EMSCRIPTEN__ #include +#elif !defined(EMSCRIPTEN_KEEPALIVE) +#define EMSCRIPTEN_KEEPALIVE +#endif static int32_t load_icu_data(const void* pData); @@ -76,7 +80,7 @@ void mono_wasm_link_icu_shim(void) { } -#endif +#endif /* TARGET_BROWSER || TARGET_WASI */ static int32_t load_icu_data(const void* pData) { diff --git a/src/native/libs/System.IO.Compression.Native/CMakeLists.txt b/src/native/libs/System.IO.Compression.Native/CMakeLists.txt index a44f847dfca43..5208182988c2a 100644 --- a/src/native/libs/System.IO.Compression.Native/CMakeLists.txt +++ b/src/native/libs/System.IO.Compression.Native/CMakeLists.txt @@ -6,7 +6,7 @@ set(NATIVECOMPRESSION_SOURCES pal_zlib.c ) -if (NOT CLR_CMAKE_TARGET_BROWSER) +if (NOT CLR_CMAKE_TARGET_BROWSER AND NOT CLR_CMAKE_TARGET_WASI) if (CLR_CMAKE_USE_SYSTEM_BROTLI) add_definitions(-DFEATURE_USE_SYSTEM_BROTLI) @@ -25,11 +25,11 @@ if (NOT CLR_CMAKE_TARGET_BROWSER) ) endif () -if (CLR_CMAKE_TARGET_UNIX OR CLR_CMAKE_TARGET_BROWSER) +if (CLR_CMAKE_TARGET_UNIX OR CLR_CMAKE_TARGET_BROWSER OR CLR_CMAKE_TARGET_WASI) set(NATIVE_LIBS_EXTRA) append_extra_compression_libs(NATIVE_LIBS_EXTRA) - if (CLR_CMAKE_TARGET_BROWSER) + if (CLR_CMAKE_TARGET_BROWSER OR CLR_CMAKE_TARGET_WASI) include(${CLR_SRC_NATIVE_DIR}/external/zlib.cmake) add_definitions(-DINTERNAL_ZLIB) set(NATIVECOMPRESSION_SOURCES ${ZLIB_SOURCES} ${NATIVECOMPRESSION_SOURCES}) @@ -44,7 +44,10 @@ if (CLR_CMAKE_TARGET_UNIX OR CLR_CMAKE_TARGET_BROWSER) # Delete this suppression once brotli is upgraded to vNext (current latest v1.0.9 # does not contain upstream fix: https://github.com/google/brotli/commit/0a3944c) - set(FLAGS "${FLAGS} -Wno-vla-parameter") + if (NOT CLR_CMAKE_TARGET_WASI) + # TODOWASI + set(FLAGS "${FLAGS} -Wno-vla-parameter") + endif () set_source_files_properties(${NATIVECOMPRESSION_SOURCES} PROPERTIES COMPILE_FLAGS ${FLAGS}) @@ -118,7 +121,7 @@ else () ) endif () - if (NOT GEN_SHARED_LIB AND NOT CLR_CMAKE_TARGET_MACCATALYST AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS AND NOT CLR_CMAKE_TARGET_ANDROID AND NOT CLR_CMAKE_TARGET_BROWSER) + if (NOT GEN_SHARED_LIB AND NOT CLR_CMAKE_TARGET_MACCATALYST AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS AND NOT CLR_CMAKE_TARGET_ANDROID AND NOT CLR_CMAKE_TARGET_BROWSER AND NOT CLR_CMAKE_TARGET_WASI) set(NATIVECOMPRESSION_SOURCES ${NATIVECOMPRESSION_SOURCES} entrypoints.c) endif () diff --git a/src/native/libs/System.IO.Compression.Native/extra_libs.cmake b/src/native/libs/System.IO.Compression.Native/extra_libs.cmake index b10776372f6cf..78530ae98e8ff 100644 --- a/src/native/libs/System.IO.Compression.Native/extra_libs.cmake +++ b/src/native/libs/System.IO.Compression.Native/extra_libs.cmake @@ -1,7 +1,7 @@ macro(append_extra_compression_libs NativeLibsExtra) # TODO: remove the mono-style HOST_ variable checks once Mono is using eng/native/configureplatform.cmake to define the CLR_CMAKE_TARGET_ defines - if (CLR_CMAKE_TARGET_BROWSER OR HOST_BROWSER) + if (CLR_CMAKE_TARGET_BROWSER OR HOST_BROWSER OR CLR_CMAKE_TARGET_WASI OR HOST_WASI) # nothing special to link elseif (CLR_CMAKE_TARGET_ANDROID OR HOST_ANDROID) # need special case here since we want to link against libz.so but find_package() would resolve libz.a diff --git a/src/native/libs/System.Native/CMakeLists.txt b/src/native/libs/System.Native/CMakeLists.txt index 61cd36da93b79..d5037d5557d55 100644 --- a/src/native/libs/System.Native/CMakeLists.txt +++ b/src/native/libs/System.Native/CMakeLists.txt @@ -1,6 +1,6 @@ project(System.Native C) -if (NOT CLR_CMAKE_TARGET_MACCATALYST AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS) +if (NOT CLR_CMAKE_TARGET_MACCATALYST AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS AND NOT CLR_CMAKE_TARGET_WASI) add_definitions(-DHAS_CONSOLE_SIGNALS) endif () @@ -79,7 +79,7 @@ else () pal_iossupportversion.c) endif () -if (NOT CLR_CMAKE_TARGET_BROWSER) +if (NOT CLR_CMAKE_TARGET_BROWSER AND NOT CLR_CMAKE_TARGET_WASI) list (APPEND NATIVE_SOURCES pal_networkchange.c) endif () @@ -107,7 +107,7 @@ if (GEN_SHARED_LIB) ${NATIVE_LIBS_EXTRA} ) - if (NOT CLR_CMAKE_TARGET_MACCATALYST AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS AND NOT CLR_CMAKE_TARGET_ANDROID AND NOT CLR_CMAKE_TARGET_BROWSER) + if (NOT CLR_CMAKE_TARGET_MACCATALYST AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS AND NOT CLR_CMAKE_TARGET_ANDROID AND NOT CLR_CMAKE_TARGET_BROWSER AND NOT CLR_CMAKE_TARGET_WASI) add_custom_command(TARGET System.Native POST_BUILD COMMENT "Verifying System.Native entry points against entrypoints.c " COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/../verify-entrypoints.sh @@ -121,7 +121,7 @@ if (GEN_SHARED_LIB) install_with_stripped_symbols (System.Native PROGRAMS .) endif () -if (NOT GEN_SHARED_LIB AND NOT CLR_CMAKE_TARGET_MACCATALYST AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS AND NOT CLR_CMAKE_TARGET_ANDROID AND NOT CLR_CMAKE_TARGET_BROWSER) +if (NOT GEN_SHARED_LIB AND NOT CLR_CMAKE_TARGET_MACCATALYST AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS AND NOT CLR_CMAKE_TARGET_ANDROID AND NOT CLR_CMAKE_TARGET_BROWSER AND NOT CLR_CMAKE_TARGET_WASI) set(NATIVE_SOURCES ${NATIVE_SOURCES} entrypoints.c) endif() diff --git a/src/native/libs/System.Native/pal_console.c b/src/native/libs/System.Native/pal_console.c index d217075e5a276..e7ce2a7e13a7c 100644 --- a/src/native/libs/System.Native/pal_console.c +++ b/src/native/libs/System.Native/pal_console.c @@ -13,10 +13,14 @@ #include #include #include +#if HAVE_TERMIOS_H #include +#endif #include #include +#if HAVE_PTHREAD_H #include +#endif #include int32_t SystemNative_GetWindowSize(WinSize* windowSize) @@ -87,6 +91,7 @@ void SystemNative_SetKeypadXmit(const char* terminfoString) WriteKeypadXmit(); } +#if !defined(TARGET_WASI) static pthread_mutex_t g_lock = PTHREAD_MUTEX_INITIALIZER; // prevents races when initializing and changing the terminal. static bool g_signalForBreak = true; // tracks whether the terminal should send signals for breaks, such that attributes have been changed @@ -225,9 +230,11 @@ void UninitializeTerminal(void) pthread_mutex_unlock(&g_lock); } } +#endif /* TARGET_WASI */ void SystemNative_InitializeConsoleBeforeRead(uint8_t minChars, uint8_t decisecondsTimeout) { +#if !defined(TARGET_WASI) if (pthread_mutex_lock(&g_lock) == 0) { g_reading = true; @@ -236,20 +243,24 @@ void SystemNative_InitializeConsoleBeforeRead(uint8_t minChars, uint8_t deciseco pthread_mutex_unlock(&g_lock); } +#endif /* TARGET_WASI */ } void SystemNative_UninitializeConsoleAfterRead(void) { +#if !defined(TARGET_WASI) if (pthread_mutex_lock(&g_lock) == 0) { g_reading = false; pthread_mutex_unlock(&g_lock); } +#endif /* TARGET_WASI */ } void SystemNative_ConfigureTerminalForChildProcess(int32_t childUsesTerminal) { +#if !defined(TARGET_WASI) assert(childUsesTerminal == 0 || childUsesTerminal == 1); if (pthread_mutex_lock(&g_lock) == 0) @@ -281,8 +292,10 @@ void SystemNative_ConfigureTerminalForChildProcess(int32_t childUsesTerminal) pthread_mutex_unlock(&g_lock); } +#endif /* TARGET_WASI */ } +#if !defined(TARGET_WASI) static int TranslatePalControlCharacterName(int name) { switch (name) @@ -341,6 +354,7 @@ static int TranslatePalControlCharacterName(int name) default: return -1; } } +#endif /* TARGET_WASI */ void SystemNative_GetControlCharacters( int32_t* controlCharacterNames, uint8_t* controlCharacterValues, int32_t controlCharacterLength, @@ -359,6 +373,7 @@ void SystemNative_GetControlCharacters( memset(controlCharacterValues, *posixDisableValue, sizeof(uint8_t) * Int32ToSizeT(controlCharacterLength)); +#if HAVE_TERMIOS_H if (controlCharacterLength > 0) { struct termios newTermios; @@ -376,6 +391,7 @@ void SystemNative_GetControlCharacters( } } } +#endif } int32_t SystemNative_StdinReady(void) @@ -405,13 +421,18 @@ int32_t SystemNative_ReadStdin(void* buffer, int32_t bufferSize) int32_t SystemNative_GetSignalForBreak(void) { +#if !defined(TARGET_WASI) return g_signalForBreak; +#else /* TARGET_WASI */ + return false; +#endif /* TARGET_WASI */ } int32_t SystemNative_SetSignalForBreak(int32_t signalForBreak) { assert(signalForBreak == 0 || signalForBreak == 1); +#if !defined(TARGET_WASI) int rv = 0; if (pthread_mutex_lock(&g_lock) == 0) @@ -426,6 +447,9 @@ int32_t SystemNative_SetSignalForBreak(int32_t signalForBreak) } return rv; +#else /* TARGET_WASI */ + return 0; +#endif /* TARGET_WASI */ } void ReinitializeTerminal(void) @@ -433,6 +457,7 @@ void ReinitializeTerminal(void) // Restores the state of the terminal after being suspended. // pal_signal.cpp calls this on SIGCONT from the signal handling thread. +#if !defined(TARGET_WASI) if (pthread_mutex_lock(&g_lock) == 0) { if (!g_childUsesTerminal) @@ -447,8 +472,10 @@ void ReinitializeTerminal(void) pthread_mutex_unlock(&g_lock); } +#endif /* TARGET_WASI */ } +#if !defined(TARGET_WASI) static void InitializeTerminalCore(void) { bool haveInitTermios = tcgetattr(STDIN_FILENO, &g_initTermios) >= 0; @@ -467,9 +494,11 @@ static void InitializeTerminalCore(void) g_signalForBreak = true; } } +#endif /* TARGET_WASI */ int32_t SystemNative_InitializeTerminalAndSignalHandling(void) { +#if !defined(TARGET_WASI) static int32_t initialized = 0; // The Process, Console and PosixSignalRegistration classes call this method for initialization. @@ -484,4 +513,7 @@ int32_t SystemNative_InitializeTerminalAndSignalHandling(void) } return initialized; +#else /* TARGET_WASI */ + return true; +#endif /* TARGET_WASI */ } diff --git a/src/native/libs/System.Native/pal_dynamicload.c b/src/native/libs/System.Native/pal_dynamicload.c index 76f9c56678af5..9025b10f43f16 100644 --- a/src/native/libs/System.Native/pal_dynamicload.c +++ b/src/native/libs/System.Native/pal_dynamicload.c @@ -4,8 +4,11 @@ #include "pal_config.h" #include "pal_dynamicload.h" +#if HAVE_DLFCN_H #include +#endif #include +#include #if HAVE_GNU_LIBNAMES_H #include @@ -13,6 +16,7 @@ void* SystemNative_LoadLibrary(const char* filename) { +#if !defined(TARGET_WASI) // Check whether we have been requested to load 'libc'. If that's the case, then: // * For Linux, use the full name of the library that is defined in by the // LIBC_SO constant. The problem is that calling dlopen("libc.so") will fail for libc even @@ -36,26 +40,45 @@ void* SystemNative_LoadLibrary(const char* filename) } return dlopen(filename, RTLD_LAZY); +#else /* TARGET_WASI */ + return NULL; +#endif /* TARGET_WASI */ } void* SystemNative_GetLoadLibraryError(void) { +#if !defined(TARGET_WASI) return dlerror(); +#else /* TARGET_WASI */ + return NULL; +#endif /* TARGET_WASI */ } void* SystemNative_GetProcAddress(void* handle, const char* symbol) { +#if !defined(TARGET_WASI) // We're not trying to disambiguate between "symbol was not found" and "symbol found, but // the value is null". .NET does not define a behavior for DllImports of null entrypoints, // so we might as well take the "not found" path on the managed side. return dlsym(handle, symbol); +#else /* TARGET_WASI */ + return NULL; +#endif /* TARGET_WASI */ } void SystemNative_FreeLibrary(void* handle) { +#if !defined(TARGET_WASI) dlclose(handle); +#endif /* TARGET_WASI */ } +#if defined TARGET_WASI +void* SystemNative_GetDefaultSearchOrderPseudoHandle(void) +{ + return NULL; +} +#else static void* volatile g_defaultSearchOrderPseudoHandle = NULL; void* SystemNative_GetDefaultSearchOrderPseudoHandle(void) { @@ -76,3 +99,4 @@ void* SystemNative_GetDefaultSearchOrderPseudoHandle(void) } return defaultSearchOrderPseudoHandle; } +#endif diff --git a/src/native/libs/System.Native/pal_interfaceaddresses.c b/src/native/libs/System.Native/pal_interfaceaddresses.c index 4af5d59ae96db..8fee3e0e3e964 100644 --- a/src/native/libs/System.Native/pal_interfaceaddresses.c +++ b/src/native/libs/System.Native/pal_interfaceaddresses.c @@ -15,11 +15,17 @@ #include #endif #ifdef ANDROID_GETIFADDRS_WORKAROUND +#if HAVE_DLFCN_H #include +#endif +#if HAVE_PTHREAD_H #include +#endif #include "pal_ifaddrs.h" // fallback for Android API 21-23 #endif +#if HAVE_NET_IF_H #include +#endif #include #include #include @@ -50,6 +56,7 @@ #elif defined(AF_LINK) #include #include +#elif defined(TARGET_WASI) #else #error System must have AF_PACKET or AF_LINK. #endif @@ -66,6 +73,7 @@ // mask parameter is pointer to buffer where address starts and length is // buffer length e.g. 4 for IPv4 and 16 for IPv6. // Code bellow counts consecutive number of 1 bits. +#if !defined(TARGET_WASI) static inline uint8_t mask2prefix(uint8_t* mask, int length) { uint8_t len = 0; @@ -101,6 +109,7 @@ static inline uint8_t mask2prefix(uint8_t* mask, int length) return len; } +#endif /* TARGET_WASI */ #ifdef ANDROID_GETIFADDRS_WORKAROUND // This workaround is necessary as long as we support Android API 21-23 and it can be removed once diff --git a/src/native/libs/System.Native/pal_io.c b/src/native/libs/System.Native/pal_io.c index 0929a0b49ecf4..f696e3cba0ab6 100644 --- a/src/native/libs/System.Native/pal_io.c +++ b/src/native/libs/System.Native/pal_io.c @@ -26,8 +26,12 @@ #include #endif #include +#if HAVE_SYSLOG_H #include +#endif +#if HAVE_TERMIOS_H #include +#endif #include #include #if HAVE_FCOPYFILE @@ -42,7 +46,7 @@ #include #elif HAVE_STATFS_MOUNT // BSD #include -#elif !HAVE_NON_LEGACY_STATFS // SunOS +#elif HAVE_SYS_STATVFS_H && !HAVE_NON_LEGACY_STATFS // SunOS #include #include #include @@ -70,7 +74,7 @@ extern int getpeereid(int, uid_t *__restrict__, gid_t *__restrict__); // Ensure FICLONE is defined for all Linux builds. #ifndef FICLONE #define FICLONE _IOW(0x94, 9, int) -#endif +#endif /* __linux__ */ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wreserved-id-macro" @@ -97,12 +101,13 @@ extern int getpeereid(int, uid_t *__restrict__, gid_t *__restrict__); #define stat_ stat64 #define fstat_ fstat64 #define lstat_ lstat64 -#else +#else /* HAVE_STAT64 */ #define stat_ stat #define fstat_ fstat #define lstat_ lstat -#endif +#endif /* HAVE_STAT64 */ +#if !defined(TARGET_WASI) // These numeric values are specified by POSIX. // Validate that our definitions match. c_static_assert(PAL_S_IRWXU == S_IRWXU); @@ -132,6 +137,7 @@ c_static_assert(PAL_S_IFDIR == S_IFDIR); c_static_assert(PAL_S_IFREG == S_IFREG); c_static_assert(PAL_S_IFLNK == S_IFLNK); c_static_assert(PAL_S_IFSOCK == S_IFSOCK); +#endif /* TARGET_WASI */ // Validate that our enum for inode types is the same as what is // declared by the dirent.h header on the local system. @@ -139,7 +145,7 @@ c_static_assert(PAL_S_IFSOCK == S_IFSOCK); // WebAssembly (BROWSER) has dirent d_type but is not correct // by returning UNKNOWN the managed code properly stats the file // to detect if entry is directory or not. -#if defined(DT_UNKNOWN) || defined(TARGET_WASM) +#if (defined(DT_UNKNOWN) || defined(TARGET_WASM)) && !defined(TARGET_WASI) c_static_assert((int)PAL_DT_UNKNOWN == (int)DT_UNKNOWN); c_static_assert((int)PAL_DT_FIFO == (int)DT_FIFO); c_static_assert((int)PAL_DT_CHR == (int)DT_CHR); @@ -341,10 +347,13 @@ intptr_t SystemNative_Dup(intptr_t oldfd) int result; #if HAVE_F_DUPFD_CLOEXEC while ((result = fcntl(ToFileDescriptor(oldfd), F_DUPFD_CLOEXEC, 0)) < 0 && errno == EINTR); -#else +#elif HAVE_F_DUPFD while ((result = fcntl(ToFileDescriptor(oldfd), F_DUPFD, 0)) < 0 && errno == EINTR); // do CLOEXEC here too fcntl(result, F_SETFD, FD_CLOEXEC); +#else + // https://github.com/bytecodealliance/wasmtime/blob/main/docs/WASI-rationale.md#why-no-dup + result = oldfd; #endif return result; } @@ -570,7 +579,7 @@ int32_t SystemNative_Pipe(int32_t pipeFds[2], int32_t flags) #if HAVE_PIPE2 // If pipe2 is available, use it. This will handle O_CLOEXEC if it was set. while ((result = pipe2(pipeFds, flags)) < 0 && errno == EINTR); -#else +#elif HAVE_PIPE // Otherwise, use pipe. while ((result = pipe(pipeFds)) < 0 && errno == EINTR); @@ -595,7 +604,9 @@ int32_t SystemNative_Pipe(int32_t pipeFds[2], int32_t flags) errno = tmpErrno; } } -#endif +#else /* HAVE_PIPE */ + result = -1; +#endif /* HAVE_PIPE */ return result; } @@ -695,16 +706,24 @@ int32_t SystemNative_MkDir(const char* path, int32_t mode) int32_t SystemNative_ChMod(const char* path, int32_t mode) { +#if HAVE_CHMOD int32_t result; while ((result = chmod(path, (mode_t)mode)) < 0 && errno == EINTR); return result; +#else /* HAVE_CHMOD */ + return EINTR; +#endif /* HAVE_CHMOD */ } int32_t SystemNative_FChMod(intptr_t fd, int32_t mode) { +#if HAVE_FCHMOD int32_t result; while ((result = fchmod(ToFileDescriptor(fd), (mode_t)mode)) < 0 && errno == EINTR); return result; +#else /* HAVE_FCHMOD */ + return EINTR; +#endif /* HAVE_FCHMOD */ } int32_t SystemNative_FSync(intptr_t fd) @@ -725,7 +744,11 @@ int32_t SystemNative_FSync(intptr_t fd) int32_t SystemNative_FLock(intptr_t fd, int32_t operation) { int32_t result; +#if !defined(TARGET_WASI) while ((result = flock(ToFileDescriptor(fd), operation)) < 0 && errno == EINTR); +#else /* TARGET_WASI */ + result = EINTR; +#endif /* TARGET_WASI */ return result; } @@ -748,12 +771,15 @@ int64_t SystemNative_LSeek(intptr_t fd, int64_t offset, int32_t whence) result = #if HAVE_LSEEK64 lseek64( + ToFileDescriptor(fd), + (off_t)offset, + whence)) < 0 && errno == EINTR); #else lseek( -#endif ToFileDescriptor(fd), (off_t)offset, whence)) < 0 && errno == EINTR); +#endif return result; } @@ -773,32 +799,50 @@ int32_t SystemNative_SymLink(const char* target, const char* linkPath) void SystemNative_GetDeviceIdentifiers(uint64_t dev, uint32_t* majorNumber, uint32_t* minorNumber) { +#if !defined(TARGET_WASI) dev_t castedDev = (dev_t)dev; *majorNumber = (uint32_t)major(castedDev); *minorNumber = (uint32_t)minor(castedDev); +#else /* TARGET_WASI */ + dev_t castedDev = (dev_t)dev; + *majorNumber = 0; + *minorNumber = 0; +#endif /* TARGET_WASI */ } int32_t SystemNative_MkNod(const char* pathName, uint32_t mode, uint32_t major, uint32_t minor) { +#if !defined(TARGET_WASI) dev_t dev = (dev_t)makedev(major, minor); int32_t result; while ((result = mknod(pathName, (mode_t)mode, dev)) < 0 && errno == EINTR); return result; +#else /* TARGET_WASI */ + return EINTR; +#endif /* TARGET_WASI */ } int32_t SystemNative_MkFifo(const char* pathName, uint32_t mode) { +#if !defined(TARGET_WASI) int32_t result; while ((result = mkfifo(pathName, (mode_t)mode)) < 0 && errno == EINTR); return result; +#else /* TARGET_WASI */ + return EINTR; +#endif /* TARGET_WASI */ } char* SystemNative_MkdTemp(char* pathTemplate) { +#if !defined(TARGET_WASI) char* result = NULL; while ((result = mkdtemp(pathTemplate)) == NULL && errno == EINTR); return result; +#else /* TARGET_WASI */ + return NULL; +#endif /* TARGET_WASI */ } intptr_t SystemNative_MksTemps(char* pathTemplate, int32_t suffixLength) @@ -840,6 +884,8 @@ intptr_t SystemNative_MksTemps(char* pathTemplate, int32_t suffixLength) { pathTemplate[firstSuffixIndex] = firstSuffixChar; } +#elif TARGET_WASI + result = -1; #else #error "Cannot find mkstemps nor mkstemp on this platform" #endif @@ -976,7 +1022,7 @@ int32_t SystemNative_MAdvise(void* address, uint64_t length, int32_t advice) switch (advice) { case PAL_MADV_DONTFORK: -#ifdef MADV_DONTFORK +#if defined(MADV_DONTFORK) && !defined(TARGET_WASI) return madvise(address, (size_t)length, MADV_DONTFORK); #else (void)address, (void)length, (void)advice; @@ -1005,7 +1051,11 @@ int32_t SystemNative_MSync(void* address, uint64_t length, int32_t flags) return -1; } +#if !defined(TARGET_WASI) return msync(address, (size_t)length, flags); +#else + return -1; +#endif } int64_t SystemNative_SysConf(int32_t name) @@ -1145,7 +1195,9 @@ int32_t SystemNative_RmDir(const char* path) void SystemNative_Sync(void) { +#if !defined(TARGET_WASI) sync(); +#endif /* TARGET_WASI */ } int32_t SystemNative_Write(intptr_t fd, const void* buffer, int32_t bufferSize) @@ -1369,6 +1421,7 @@ int32_t SystemNative_CopyFile(intptr_t sourceFd, intptr_t destinationFd, int64_t return -1; } +#if HAVE_FCHMOD // Copy permissions. // Even though managed code created the file with permissions matching those of the source file, // we need to copy permissions because the open permissions may be filtered by 'umask'. @@ -1377,6 +1430,7 @@ int32_t SystemNative_CopyFile(intptr_t sourceFd, intptr_t destinationFd, int64_t { return -1; } +#endif /* HAVE_FCHMOD */ return 0; #endif // HAVE_FCOPYFILE @@ -1458,9 +1512,14 @@ int32_t SystemNative_GetPeerID(intptr_t socket, uid_t* euid) char* SystemNative_RealPath(const char* path) { assert(path != NULL); +#if !defined(TARGET_WASI) return realpath(path, NULL); +#else /* TARGET_WASI */ + return NULL; +#endif /* TARGET_WASI */ } +#if !defined(TARGET_WASI) static int16_t ConvertLockType(int16_t managedLockType) { // the managed enum Interop.Sys.LockType has no 1:1 mapping with corresponding Unix values @@ -1614,6 +1673,7 @@ static uint32_t MapFileSystemNameToEnum(const char* fileSystemName) return result; } #endif +#endif /* TARGET_WASI */ uint32_t SystemNative_GetFileSystemType(intptr_t fd) { @@ -1634,6 +1694,8 @@ uint32_t SystemNative_GetFileSystemType(intptr_t fd) uint32_t result = (uint32_t)statfsArgs.f_type; return result; #endif +#elif defined(TARGET_WASI) + return EINTR; #elif !HAVE_NON_LEGACY_STATFS int statfsRes; struct statvfs statfsArgs; @@ -1648,6 +1710,7 @@ uint32_t SystemNative_GetFileSystemType(intptr_t fd) int32_t SystemNative_LockFileRegion(intptr_t fd, int64_t offset, int64_t length, int16_t lockType) { +#if !defined(TARGET_WASI) int16_t unixLockType = ConvertLockType(lockType); if (offset < 0 || length < 0) { @@ -1677,6 +1740,9 @@ int32_t SystemNative_LockFileRegion(intptr_t fd, int64_t offset, int64_t length, int32_t ret; while ((ret = fcntl (ToFileDescriptor(fd), command, &lockArgs)) < 0 && errno == EINTR); return ret; +#else /* TARGET_WASI */ + return EINTR; +#endif /* TARGET_WASI */ } int32_t SystemNative_LChflags(const char* path, uint32_t flags) @@ -1856,3 +1922,4 @@ int64_t SystemNative_PWriteV(intptr_t fd, IOVector* vectors, int32_t vectorCount assert(count >= -1); return count; } + diff --git a/src/native/libs/System.Native/pal_maphardwaretype.c b/src/native/libs/System.Native/pal_maphardwaretype.c index 064d802e6d6a8..2a37864b1eaaf 100644 --- a/src/native/libs/System.Native/pal_maphardwaretype.c +++ b/src/native/libs/System.Native/pal_maphardwaretype.c @@ -21,6 +21,7 @@ #elif defined(AF_LINK) #include #include +#elif defined(TARGET_WASI) #else #error System must have AF_PACKET or AF_LINK. #endif @@ -112,5 +113,8 @@ uint16_t MapHardwareType(uint16_t nativeType) default: return NetworkInterfaceType_Unknown; } +#elif defined(TARGET_WASI) + // TODOWASI + return NetworkInterfaceType_Unknown; #endif } diff --git a/src/native/libs/System.Native/pal_mount.c b/src/native/libs/System.Native/pal_mount.c index 2453bdfe9ede3..efae24f776847 100644 --- a/src/native/libs/System.Native/pal_mount.c +++ b/src/native/libs/System.Native/pal_mount.c @@ -12,22 +12,27 @@ // Check if we should use getmntinfo or /proc/mounts #if HAVE_MNTINFO #include -#else +#else /* HAVE_MNTINFO */ +#if HAVE_STATFS #include +#endif /* HAVE_STATFS */ #if HAVE_SYS_MNTENT_H #include #include +#if HAVE_SYS_STATVFS_H #include -#else +#endif /* HAVE_SYS_STATVFS_H */ +#else /* HAVE_SYS_MNTENT_H */ +#if HAVE_MNTENT_H #include -#endif #define STRING_BUFFER_SIZE 8192 - // Android does not define MNTOPT_RO #ifndef MNTOPT_RO #define MNTOPT_RO "r" -#endif -#endif +#endif /* MNTOPT_RO */ +#endif /* HAVE_MNTENT_H */ +#endif /* HAVE_SYS_MNTENT_H */ +#endif /* HAVE_MNTINFO */ int32_t SystemNative_GetAllMountPoints(MountPointFound onFound, void* context) { @@ -68,7 +73,7 @@ int32_t SystemNative_GetAllMountPoints(MountPointFound onFound, void* context) return result; } -#else +#elif HAVE_MNTENT_H int result = -1; FILE* fp = setmntent("/proc/mounts", MNTOPT_RO); if (fp != NULL) @@ -89,6 +94,8 @@ int32_t SystemNative_GetAllMountPoints(MountPointFound onFound, void* context) } return result; +#else + return -1; } #endif @@ -103,12 +110,15 @@ int32_t SystemNative_GetSpaceInfoForMountPoint(const char* name, MountPointInfor memset(&stats, 0, sizeof(struct statfs)); int result = statfs(name, &stats); -#else +#elif HAVE_MNTENT_H struct statvfs stats; memset(&stats, 0, sizeof(struct statvfs)); int result = statvfs(name, &stats); +#else + return -1; #endif +#if HAVE_NON_LEGACY_STATFS || HAVE_MNTENT_H if (result == 0) { // Note that these have signed integer types on some platforms but mustn't be negative. @@ -129,6 +139,7 @@ int32_t SystemNative_GetSpaceInfoForMountPoint(const char* name, MountPointInfor } return result; +#endif } int32_t @@ -140,9 +151,11 @@ SystemNative_GetFormatInfoForMountPoint(const char* name, char* formatNameBuffer #if HAVE_NON_LEGACY_STATFS struct statfs stats; int result = statfs(name, &stats); -#else +#elif HAVE_MNTENT_H struct statvfs stats; int result = statvfs(name, &stats); +#else + int result = -1; #endif if (result == 0) { diff --git a/src/native/libs/System.Native/pal_networkchange.c b/src/native/libs/System.Native/pal_networkchange.c index b4386a762f3f0..56391820123dd 100644 --- a/src/native/libs/System.Native/pal_networkchange.c +++ b/src/native/libs/System.Native/pal_networkchange.c @@ -9,7 +9,9 @@ #include "pal_utilities.h" #include +#if HAVE_NET_IF_H #include +#endif #include #include #include diff --git a/src/native/libs/System.Native/pal_networking.c b/src/native/libs/System.Native/pal_networking.c index e6413d276e4b5..79b6dd9ca96f3 100644 --- a/src/native/libs/System.Native/pal_networking.c +++ b/src/native/libs/System.Native/pal_networking.c @@ -10,7 +10,9 @@ #include #include +#if HAVE_PTHREAD_H #include +#endif #include #include #include @@ -30,7 +32,9 @@ #include #include #include +#if HAVE_NET_IF_H #include +#endif #include #include #include @@ -47,7 +51,9 @@ #include #endif #include +#if HAVE_PWD_H #include +#endif #if HAVE_SENDFILE_4 #include #elif HAVE_SENDFILE_6 @@ -112,7 +118,7 @@ static uint16_t GetKeventFlags(uint32_t flags) #endif #endif -#if !HAVE_IN_PKTINFO +#if !HAVE_IN_PKTINFO && !IP_PKTINFO // On platforms, such as FreeBSD, where in_pktinfo // is not available, fallback to custom definition // with required members. @@ -131,6 +137,7 @@ struct in_pktinfo #define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP #endif +#if !defined(TARGET_WASI) enum { #if defined(__APPLE__) && __APPLE__ @@ -139,18 +146,21 @@ enum LINGER_OPTION_NAME = SO_LINGER, #endif }; +#endif /* TARGET_WASI */ enum { INET6_ADDRSTRLEN_MANAGED = 65 // Managed code has a longer max IPv6 string length }; +#if !defined(TARGET_WASI) c_static_assert(GetHostErrorCodes_HOST_NOT_FOUND == HOST_NOT_FOUND); c_static_assert(GetHostErrorCodes_TRY_AGAIN == TRY_AGAIN); c_static_assert(GetHostErrorCodes_NO_RECOVERY == NO_RECOVERY); c_static_assert(GetHostErrorCodes_NO_DATA == NO_DATA); c_static_assert(GetHostErrorCodes_NO_ADDRESS == NO_ADDRESS); c_static_assert(sizeof(uint8_t) == sizeof(char)); // We make casts from uint8_t to char so make sure it's legal +#endif /* TARGET_WASI */ // sizeof_member(struct foo, bar) is not valid C++. // The fix is to remove struct. That is not valid C. @@ -262,6 +272,7 @@ static void ConvertByteArrayToSockAddrIn6(struct sockaddr_in6* addr, const uint8 // Mark that this is INET6 addr->sin6_family = AF_INET6; } +#if !defined(TARGET_WASI) static void ConvertByteArrayToInAddr(struct in_addr* addr, const uint8_t* buffer, int32_t bufferLength) { @@ -288,19 +299,29 @@ static int32_t ConvertGetAddrInfoAndGetNameInfoErrorsToPal(int32_t error) { case 0: return 0; +#ifdef EAI_AGAIN case EAI_AGAIN: return GetAddrInfoErrorFlags_EAI_AGAIN; +#endif +#ifdef EAI_BADFLAGS case EAI_BADFLAGS: return GetAddrInfoErrorFlags_EAI_BADFLAGS; +#endif #ifdef EAI_FAIL case EAI_FAIL: return GetAddrInfoErrorFlags_EAI_FAIL; #endif +#ifdef EAI_FAMILY case EAI_FAMILY: return GetAddrInfoErrorFlags_EAI_FAMILY; +#endif +#ifdef EAI_MEMORY case EAI_MEMORY: return GetAddrInfoErrorFlags_EAI_MEMORY; +#endif +#ifdef EAI_NONAME case EAI_NONAME: +#endif #ifdef EAI_NODATA case EAI_NODATA: #endif @@ -333,6 +354,7 @@ static int32_t CopySockAddrToIPAddress(sockaddr* addr, sa_family_t family, IPAdd return -1; } +#endif /* TARGET_WASI */ int32_t SystemNative_GetHostEntryForName(const uint8_t* address, int32_t addressFamily, HostEntry* entry) { @@ -340,6 +362,7 @@ int32_t SystemNative_GetHostEntryForName(const uint8_t* address, int32_t address { return GetAddrInfoErrorFlags_EAI_BADARG; } +#if !defined(TARGET_WASI) int32_t ret = GetAddrInfoErrorFlags_EAI_SUCCESS; @@ -516,6 +539,9 @@ int32_t SystemNative_GetHostEntryForName(const uint8_t* address, int32_t address } return ret; +#else /* TARGET_WASI */ + return -1; +#endif /* TARGET_WASI */ } void SystemNative_FreeHostEntry(HostEntry* entry) @@ -538,6 +564,7 @@ typedef int32_t NativeFlagsType; typedef uint32_t NativeFlagsType; #endif +#if !defined(TARGET_WASI) static inline NativeFlagsType ConvertGetNameInfoFlagsToNative(int32_t flags) { NativeFlagsType outFlags = 0; @@ -552,6 +579,7 @@ static inline NativeFlagsType ConvertGetNameInfoFlagsToNative(int32_t flags) return outFlags; } +#endif int32_t SystemNative_GetNameInfo(const uint8_t* address, int32_t addressLength, @@ -567,6 +595,7 @@ int32_t SystemNative_GetNameInfo(const uint8_t* address, assert((host != NULL) || (service != NULL)); assert((hostLength > 0) || (serviceLength > 0)); +#if !defined(TARGET_WASI) NativeFlagsType nativeFlags = ConvertGetNameInfoFlagsToNative(flags); int32_t result; @@ -598,6 +627,9 @@ int32_t SystemNative_GetNameInfo(const uint8_t* address, } return ConvertGetAddrInfoAndGetNameInfoErrorsToPal(result); +#else /* TARGET_WASI */ + return Error_EINVAL; +#endif /* TARGET_WASI */ } int32_t SystemNative_GetDomainName(uint8_t* name, int32_t nameLength) @@ -897,6 +929,7 @@ SystemNative_SetIPv6Address(uint8_t* socketAddress, int32_t socketAddressLen, ui return Error_SUCCESS; } +#if !defined(TARGET_WASI) static int8_t IsStreamSocket(int socket) { int type; @@ -923,15 +956,21 @@ static void ConvertMessageHeaderToMsghdr(struct msghdr* header, const MessageHea header->msg_controllen = (uint32_t)messageHeader->ControlBufferLen; header->msg_flags = 0; } +#endif /* TARGET_WASI */ int32_t SystemNative_GetControlMessageBufferSize(int32_t isIPv4, int32_t isIPv6) { +#if defined(CMSG_SPACE) // Note: it is possible that the address family of the socket is neither // AF_INET nor AF_INET6. In this case both inputs will be 0 and // the control message buffer size should be zero. return (isIPv4 != 0 ? CMSG_SPACE(sizeof(struct in_pktinfo)) : 0) + (isIPv6 != 0 ? CMSG_SPACE(sizeof(struct in6_pktinfo)) : 0); +#else /* CMSG_SPACE */ + return Error_EINVAL; +#endif /* CMSG_SPACE */ } +#if !defined(TARGET_WASI) static int32_t GetIPv4PacketInformation(struct cmsghdr* controlMessage, IPPacketInformation* packetInfo) { assert(controlMessage != NULL); @@ -1010,6 +1049,7 @@ static struct cmsghdr* GET_CMSG_NXTHDR(struct msghdr* mhdr, struct cmsghdr* cmsg #pragma clang diagnostic pop #endif } +#endif /* TARGET_WASI */ int32_t SystemNative_TryGetIPPacketInformation(MessageHeader* messageHeader, int32_t isIPv4, IPPacketInformation* packetInfo) @@ -1019,6 +1059,7 @@ SystemNative_TryGetIPPacketInformation(MessageHeader* messageHeader, int32_t isI return 0; } +#if !defined(TARGET_WASI) struct msghdr header; ConvertMessageHeaderToMsghdr(&header, messageHeader, -1); @@ -1047,6 +1088,9 @@ SystemNative_TryGetIPPacketInformation(MessageHeader* messageHeader, int32_t isI } return 0; +#else /* TARGET_WASI */ + return Error_EINVAL; +#endif /* TARGET_WASI */ } static int8_t GetMulticastOptionName(int32_t multicastOption, int8_t isIPv6, int* optionName) @@ -1116,6 +1160,7 @@ int32_t SystemNative_SetIPv4MulticastOption(intptr_t socket, int32_t multicastOp return Error_EFAULT; } +#if !defined(TARGET_WASI) int fd = ToFileDescriptor(socket); int optionName; @@ -1142,6 +1187,9 @@ int32_t SystemNative_SetIPv4MulticastOption(intptr_t socket, int32_t multicastOp #endif int err = setsockopt(fd, IPPROTO_IP, optionName, &opt, sizeof(opt)); return err == 0 ? Error_SUCCESS : SystemNative_ConvertErrorPlatformToPal(errno); +#else /* TARGET_WASI */ + return Error_EINVAL; +#endif /* TARGET_WASI */ } int32_t SystemNative_GetIPv6MulticastOption(intptr_t socket, int32_t multicastOption, IPv6MulticastOption* option) @@ -1178,6 +1226,7 @@ int32_t SystemNative_SetIPv6MulticastOption(intptr_t socket, int32_t multicastOp { return Error_EFAULT; } +#if !defined(TARGET_WASI) int fd = ToFileDescriptor(socket); @@ -1201,8 +1250,12 @@ int32_t SystemNative_SetIPv6MulticastOption(intptr_t socket, int32_t multicastOp int err = setsockopt(fd, IPPROTO_IPV6, optionName, &opt, sizeof(opt)); return err == 0 ? Error_SUCCESS : SystemNative_ConvertErrorPlatformToPal(errno); +#else /* TARGET_WASI */ + return Error_EINVAL; +#endif /* TARGET_WASI */ } +#if !defined(TARGET_WASI) #if defined(__APPLE__) && __APPLE__ static int32_t GetMaxLingerTime(void) { @@ -1239,6 +1292,7 @@ static int32_t GetMaxLingerTime(void) return Min(65535U, (1U << (sizeof_member(linger, l_linger) * 8 - 1)) - 1); } #endif +#endif /* TARGET_WASI */ int32_t SystemNative_GetLingerOption(intptr_t socket, LingerOption* option) { @@ -1247,6 +1301,7 @@ int32_t SystemNative_GetLingerOption(intptr_t socket, LingerOption* option) return Error_EFAULT; } +#if !defined(TARGET_WASI) int fd = ToFileDescriptor(socket); struct linger opt; @@ -1261,6 +1316,10 @@ int32_t SystemNative_GetLingerOption(intptr_t socket, LingerOption* option) option->OnOff = opt.l_onoff; option->Seconds = opt.l_linger; return Error_SUCCESS; +#else /* TARGET_WASI */ + memset(option, 0, sizeof(LingerOption)); + return Error_EINVAL; +#endif /* TARGET_WASI */ } int32_t SystemNative_SetLingerOption(intptr_t socket, LingerOption* option) @@ -1270,6 +1329,7 @@ int32_t SystemNative_SetLingerOption(intptr_t socket, LingerOption* option) return Error_EFAULT; } +#if !defined(TARGET_WASI) if (option->OnOff != 0 && (option->Seconds < 0 || option->Seconds > GetMaxLingerTime())) { return Error_EINVAL; @@ -1294,8 +1354,12 @@ int32_t SystemNative_SetLingerOption(intptr_t socket, LingerOption* option) #endif return err == 0 ? Error_SUCCESS : SystemNative_ConvertErrorPlatformToPal(errno); +#else /* TARGET_WASI */ + return Error_EINVAL; +#endif /* TARGET_WASI */ } +#if !defined(TARGET_WASI) static int32_t SetTimeoutOption(int32_t socket, int32_t millisecondsTimeout, int optionName) { if (millisecondsTimeout < 0) @@ -1310,15 +1374,24 @@ static int32_t SetTimeoutOption(int32_t socket, int32_t millisecondsTimeout, int int err = setsockopt(socket, SOL_SOCKET, optionName, &timeout, sizeof(timeout)); return err == 0 ? Error_SUCCESS : SystemNative_ConvertErrorPlatformToPal(errno); } +#endif /* TARGET_WASI */ int32_t SystemNative_SetReceiveTimeout(intptr_t socket, int32_t millisecondsTimeout) { +#if !defined(TARGET_WASI) return SetTimeoutOption(ToFileDescriptor(socket), millisecondsTimeout, SO_RCVTIMEO); +#else /* TARGET_WASI */ + return Error_EINVAL; +#endif /* TARGET_WASI */ } int32_t SystemNative_SetSendTimeout(intptr_t socket, int32_t millisecondsTimeout) { +#if !defined(TARGET_WASI) return SetTimeoutOption(ToFileDescriptor(socket), millisecondsTimeout, SO_SNDTIMEO); +#else /* TARGET_WASI */ + return Error_EINVAL; +#endif /* TARGET_WASI */ } static int8_t ConvertSocketFlagsPalToPlatform(int32_t palFlags, int* platformFlags) @@ -1330,26 +1403,44 @@ static int8_t ConvertSocketFlagsPalToPlatform(int32_t palFlags, int* platformFla return false; } - *platformFlags = ((palFlags & SocketFlags_MSG_OOB) == 0 ? 0 : MSG_OOB) | + *platformFlags = +#ifdef MSG_OOB + ((palFlags & SocketFlags_MSG_OOB) == 0 ? 0 : MSG_OOB) | +#endif /* MSG_OOB */ ((palFlags & SocketFlags_MSG_PEEK) == 0 ? 0 : MSG_PEEK) | +#ifdef MSG_DONTROUTE ((palFlags & SocketFlags_MSG_DONTROUTE) == 0 ? 0 : MSG_DONTROUTE) | +#endif /* MSG_DONTROUTE */ +#if defined(MSG_TRUNC) && !defined(TARGET_WASI) // https://github.com/WebAssembly/wasi-libc/issues/305 ((palFlags & SocketFlags_MSG_TRUNC) == 0 ? 0 : MSG_TRUNC) | - ((palFlags & SocketFlags_MSG_CTRUNC) == 0 ? 0 : MSG_CTRUNC); +#endif /* MSG_TRUNC */ +#ifdef MSG_CTRUNC + ((palFlags & SocketFlags_MSG_CTRUNC) == 0 ? 0 : MSG_CTRUNC) | +#endif /* MSG_CTRUNC */ + (0); return true; } +#if !defined(TARGET_WASI) static int32_t ConvertSocketFlagsPlatformToPal(int platformFlags) { - const int SupportedFlagsMask = MSG_OOB | MSG_DONTROUTE | MSG_TRUNC | MSG_CTRUNC; - - platformFlags &= SupportedFlagsMask; - - return ((platformFlags & MSG_OOB) == 0 ? 0 : SocketFlags_MSG_OOB) | + return +#ifdef MSG_OOB + ((platformFlags & MSG_OOB) == 0 ? 0 : SocketFlags_MSG_OOB) | +#endif /* MSG_OOB */ +#ifdef MSG_DONTROUTE ((platformFlags & MSG_DONTROUTE) == 0 ? 0 : SocketFlags_MSG_DONTROUTE) | +#endif /* MSG_DONTROUTE */ +#if defined(MSG_TRUNC) && !defined(TARGET_WASI) // https://github.com/WebAssembly/wasi-libc/issues/305 ((platformFlags & MSG_TRUNC) == 0 ? 0 : SocketFlags_MSG_TRUNC) | - ((platformFlags & MSG_CTRUNC) == 0 ? 0 : SocketFlags_MSG_CTRUNC); +#endif /* MSG_TRUNC */ +#ifdef MSG_CTRUNC + ((platformFlags & MSG_CTRUNC) == 0 ? 0 : SocketFlags_MSG_CTRUNC) | +#endif /* MSG_CTRUNC */ + (0); } +#endif /* TARGET_WASI */ int32_t SystemNative_Receive(intptr_t socket, void* buffer, int32_t bufferLen, int32_t flags, int32_t* received) { @@ -1387,6 +1478,7 @@ int32_t SystemNative_ReceiveMessage(intptr_t socket, MessageHeader* messageHeade return Error_EFAULT; } +#if !defined(TARGET_WASI) int fd = ToFileDescriptor(socket); int socketFlags; @@ -1420,6 +1512,9 @@ int32_t SystemNative_ReceiveMessage(intptr_t socket, MessageHeader* messageHeade *received = 0; return SystemNative_ConvertErrorPlatformToPal(errno); +#else /* TARGET_WASI */ + return Error_EINVAL; +#endif /* TARGET_WASI */ } int32_t SystemNative_Send(intptr_t socket, void* buffer, int32_t bufferLen, int32_t flags, int32_t* sent) @@ -1429,6 +1524,7 @@ int32_t SystemNative_Send(intptr_t socket, void* buffer, int32_t bufferLen, int3 return Error_EFAULT; } +#if !defined(TARGET_WASI) int fd = ToFileDescriptor(socket); int socketFlags; @@ -1455,6 +1551,9 @@ int32_t SystemNative_Send(intptr_t socket, void* buffer, int32_t bufferLen, int3 *sent = 0; return SystemNative_ConvertErrorPlatformToPal(errno); +#else /* TARGET_WASI */ + return Error_EINVAL; +#endif /* TARGET_WASI */ } int32_t SystemNative_SendMessage(intptr_t socket, MessageHeader* messageHeader, int32_t flags, int64_t* sent) @@ -1465,6 +1564,7 @@ int32_t SystemNative_SendMessage(intptr_t socket, MessageHeader* messageHeader, return Error_EFAULT; } +#if !defined(TARGET_WASI) int fd = ToFileDescriptor(socket); int socketFlags; @@ -1494,6 +1594,9 @@ int32_t SystemNative_SendMessage(intptr_t socket, MessageHeader* messageHeader, *sent = 0; return SystemNative_ConvertErrorPlatformToPal(errno); +#else /* TARGET_WASI */ + return Error_EINVAL; +#endif /* TARGET_WASI */ } int32_t SystemNative_Accept(intptr_t socket, uint8_t* socketAddress, int32_t* socketAddressLen, intptr_t* acceptedSocket) @@ -1554,6 +1657,7 @@ int32_t SystemNative_Bind(intptr_t socket, int32_t protocolType, uint8_t* socket return Error_EFAULT; } +#if !defined(TARGET_WASI) int fd = ToFileDescriptor(socket); // On Windows, Bind during TCP_WAIT is allowed. @@ -1570,6 +1674,9 @@ int32_t SystemNative_Bind(intptr_t socket, int32_t protocolType, uint8_t* socket (socklen_t)socketAddressLen); return err == 0 ? Error_SUCCESS : SystemNative_ConvertErrorPlatformToPal(errno); +#else /* TARGET_WASI */ + return Error_EINVAL; +#endif /* TARGET_WASI */ } int32_t SystemNative_Connect(intptr_t socket, uint8_t* socketAddress, int32_t socketAddressLen) @@ -1579,11 +1686,15 @@ int32_t SystemNative_Connect(intptr_t socket, uint8_t* socketAddress, int32_t so return Error_EFAULT; } +#if !defined(TARGET_WASI) int fd = ToFileDescriptor(socket); int err; while ((err = connect(fd, (struct sockaddr*)socketAddress, (socklen_t)socketAddressLen)) < 0 && errno == EINTR); return err == 0 ? Error_SUCCESS : SystemNative_ConvertErrorPlatformToPal(errno); +#else /* TARGET_WASI */ + return Error_EINVAL; +#endif /* TARGET_WASI */ } int32_t SystemNative_GetPeerName(intptr_t socket, uint8_t* socketAddress, int32_t* socketAddressLen) @@ -1593,6 +1704,7 @@ int32_t SystemNative_GetPeerName(intptr_t socket, uint8_t* socketAddress, int32_ return Error_EFAULT; } +#if !defined(TARGET_WASI) int fd = ToFileDescriptor(socket); socklen_t addrLen = (socklen_t)*socketAddressLen; @@ -1604,6 +1716,9 @@ int32_t SystemNative_GetPeerName(intptr_t socket, uint8_t* socketAddress, int32_ *socketAddressLen = (int32_t)addrLen; return Error_SUCCESS; +#else /* TARGET_WASI */ + return Error_EINVAL; +#endif /* TARGET_WASI */ } int32_t SystemNative_GetSockName(intptr_t socket, uint8_t* socketAddress, int32_t* socketAddressLen) @@ -1613,6 +1728,7 @@ int32_t SystemNative_GetSockName(intptr_t socket, uint8_t* socketAddress, int32_ return Error_EFAULT; } +#if !defined(TARGET_WASI) int fd = ToFileDescriptor(socket); socklen_t addrLen = (socklen_t)*socketAddressLen; @@ -1625,13 +1741,20 @@ int32_t SystemNative_GetSockName(intptr_t socket, uint8_t* socketAddress, int32_ assert(addrLen <= (socklen_t)*socketAddressLen); *socketAddressLen = (int32_t)addrLen; return Error_SUCCESS; +#else /* TARGET_WASI */ + return Error_EINVAL; +#endif /* TARGET_WASI */ } int32_t SystemNative_Listen(intptr_t socket, int32_t backlog) { +#if !defined(TARGET_WASI) int fd = ToFileDescriptor(socket); int err = listen(fd, backlog); return err == 0 ? Error_SUCCESS : SystemNative_ConvertErrorPlatformToPal(errno); +#else /* TARGET_WASI */ + return Error_EINVAL; +#endif /* TARGET_WASI */ } int32_t SystemNative_Shutdown(intptr_t socket, int32_t socketShutdown) @@ -1646,6 +1769,7 @@ int32_t SystemNative_GetSocketErrorOption(intptr_t socket, int32_t* error) return Error_EFAULT; } +#if !defined(TARGET_WASI) int fd = ToFileDescriptor(socket); int socketErrno; @@ -1659,6 +1783,9 @@ int32_t SystemNative_GetSocketErrorOption(intptr_t socket, int32_t* error) assert(optLen == sizeof(socketErrno)); *error = SystemNative_ConvertErrorPlatformToPal(socketErrno); return Error_SUCCESS; +#else /* TARGET_WASI */ + return Error_EINVAL; +#endif /* TARGET_WASI */ } static bool TryGetPlatformSocketOption(int32_t socketOptionLevel, int32_t socketOptionName, int* optLevel, int* optName) @@ -1670,75 +1797,107 @@ static bool TryGetPlatformSocketOption(int32_t socketOptionLevel, int32_t socket switch (socketOptionName) { +#ifdef SO_DEBUG case SocketOptionName_SO_DEBUG: *optName = SO_DEBUG; return true; +#endif +#ifdef SO_ACCEPTCONN case SocketOptionName_SO_ACCEPTCONN: *optName = SO_ACCEPTCONN; return true; +#endif +#ifdef SO_REUSEADDR case SocketOptionName_SO_REUSEADDR: *optName = SO_REUSEADDR; return true; +#endif +#ifdef SO_KEEPALIVE case SocketOptionName_SO_KEEPALIVE: *optName = SO_KEEPALIVE; return true; +#endif +#ifdef SO_DONTROUTE case SocketOptionName_SO_DONTROUTE: *optName = SO_DONTROUTE; return true; +#endif +#ifdef SO_BROADCAST case SocketOptionName_SO_BROADCAST: *optName = SO_BROADCAST; return true; +#endif // case SocketOptionName_SO_USELOOPBACK: +#ifdef SO_LINGER case SocketOptionName_SO_LINGER: *optName = SO_LINGER; return true; +#endif +#ifdef SO_OOBINLINE case SocketOptionName_SO_OOBINLINE: *optName = SO_OOBINLINE; return true; +#endif // case SocketOptionName_SO_DONTLINGER: // case SocketOptionName_SO_EXCLUSIVEADDRUSE: +#ifdef SO_SNDBUF case SocketOptionName_SO_SNDBUF: *optName = SO_SNDBUF; return true; +#endif +#ifdef SO_RCVBUF case SocketOptionName_SO_RCVBUF: *optName = SO_RCVBUF; return true; +#endif +#ifdef SO_SNDLOWAT case SocketOptionName_SO_SNDLOWAT: *optName = SO_SNDLOWAT; return true; +#endif +#ifdef SO_RCVLOWAT case SocketOptionName_SO_RCVLOWAT: *optName = SO_RCVLOWAT; return true; +#endif +#ifdef SO_SNDTIMEO case SocketOptionName_SO_SNDTIMEO: *optName = SO_SNDTIMEO; return true; +#endif +#ifdef SO_RCVTIMEO case SocketOptionName_SO_RCVTIMEO: *optName = SO_RCVTIMEO; return true; +#endif +#ifdef SO_ERROR case SocketOptionName_SO_ERROR: *optName = SO_ERROR; return true; +#endif +#ifdef SO_TYPE case SocketOptionName_SO_TYPE: *optName = SO_TYPE; return true; +#endif // case SocketOptionName_SO_MAXCONN: @@ -1930,10 +2089,11 @@ static bool TryConvertSocketTypePlatformToPal(int platformSocketType, int32_t* p case SOCK_DGRAM: *palSocketType = SocketType_SOCK_DGRAM; return true; - +#ifdef SOCK_RAW case SOCK_RAW: *palSocketType = SocketType_SOCK_RAW; return true; +#endif #ifdef SOCK_RDM case SOCK_RDM: @@ -1941,9 +2101,11 @@ static bool TryConvertSocketTypePlatformToPal(int platformSocketType, int32_t* p return true; #endif +#ifdef SOCK_SEQPACKET case SOCK_SEQPACKET: *palSocketType = SocketType_SOCK_SEQPACKET; return true; +#endif default: *palSocketType = (int32_t)platformSocketType; @@ -2099,6 +2261,7 @@ SystemNative_SetSockOpt(intptr_t socket, int32_t socketOptionLevel, int32_t sock return Error_EFAULT; } +#if !defined(TARGET_WASI) int fd = ToFileDescriptor(socket); // @@ -2175,6 +2338,9 @@ SystemNative_SetSockOpt(intptr_t socket, int32_t socketOptionLevel, int32_t sock int err = setsockopt(fd, optLevel, optName, optionValue, (socklen_t)optionLen); return err == 0 ? Error_SUCCESS : SystemNative_ConvertErrorPlatformToPal(errno); +#else /* TARGET_WASI */ + return Error_EINVAL; +#endif /* TARGET_WASI */ } int32_t SystemNative_SetRawSockOpt( @@ -2185,10 +2351,15 @@ int32_t SystemNative_SetRawSockOpt( return Error_EFAULT; } +#if !defined(TARGET_WASI) int err = setsockopt(ToFileDescriptor(socket), socketOptionLevel, socketOptionName, optionValue, (socklen_t)optionLen); return err == 0 ? Error_SUCCESS : SystemNative_ConvertErrorPlatformToPal(errno); +#else /* TARGET_WASI */ + return Error_EINVAL; +#endif /* TARGET_WASI */ } +#if !defined(TARGET_WASI) static bool TryConvertSocketTypePalToPlatform(int32_t palSocketType, int* platformSocketType) { assert(platformSocketType != NULL); @@ -2203,9 +2374,11 @@ static bool TryConvertSocketTypePalToPlatform(int32_t palSocketType, int* platfo *platformSocketType = SOCK_DGRAM; return true; +#ifdef SOCK_RAW case SocketType_SOCK_RAW: *platformSocketType = SOCK_RAW; return true; +#endif #ifdef SOCK_RDM case SocketType_SOCK_RDM: @@ -2213,9 +2386,11 @@ static bool TryConvertSocketTypePalToPlatform(int32_t palSocketType, int* platfo return true; #endif +#ifdef SOCK_SEQPACKET case SocketType_SOCK_SEQPACKET: *platformSocketType = SOCK_SEQPACKET; return true; +#endif default: *platformSocketType = (int)palSocketType; @@ -2270,10 +2445,11 @@ static bool TryConvertProtocolTypePalToPlatform(int32_t palAddressFamily, int32_ case ProtocolType_PT_UDP: *platformProtocolType = IPPROTO_UDP; return true; - +#ifdef IPPROTO_IGMP case ProtocolType_PT_IGMP: *platformProtocolType = IPPROTO_IGMP; return true; +#endif case ProtocolType_PT_RAW: *platformProtocolType = IPPROTO_RAW; @@ -2291,10 +2467,12 @@ static bool TryConvertProtocolTypePalToPlatform(int32_t palAddressFamily, int32_ *platformProtocolType = 0; return true; +#ifdef IPPROTO_ICMPV6 case ProtocolType_PT_ICMPV6: case ProtocolType_PT_ICMP: *platformProtocolType = IPPROTO_ICMPV6; return true; +#endif case ProtocolType_PT_TCP: *platformProtocolType = IPPROTO_TCP; @@ -2304,29 +2482,39 @@ static bool TryConvertProtocolTypePalToPlatform(int32_t palAddressFamily, int32_ *platformProtocolType = IPPROTO_UDP; return true; +#ifdef IPPROTO_IGMP case ProtocolType_PT_IGMP: *platformProtocolType = IPPROTO_IGMP; return true; +#endif case ProtocolType_PT_RAW: *platformProtocolType = IPPROTO_RAW; return true; +#ifdef IPPROTO_DSTOPTS case ProtocolType_PT_DSTOPTS: *platformProtocolType = IPPROTO_DSTOPTS; return true; +#endif +#ifdef IPPROTO_NONE case ProtocolType_PT_NONE: *platformProtocolType = IPPROTO_NONE; return true; +#endif +#ifdef IPPROTO_ROUTING case ProtocolType_PT_ROUTING: *platformProtocolType = IPPROTO_ROUTING; return true; +#endif +#ifdef IPPROTO_FRAGMENT case ProtocolType_PT_FRAGMENT: *platformProtocolType = IPPROTO_FRAGMENT; return true; +#endif default: *platformProtocolType = (int)palProtocolType; @@ -2394,9 +2582,11 @@ static bool TryConvertProtocolTypePlatformToPal(int32_t palAddressFamily, int pl *palProtocolType = ProtocolType_PT_UDP; return true; +#ifdef IPPROTO_IGMP case IPPROTO_IGMP: *palProtocolType = ProtocolType_PT_IGMP; return true; +#endif case IPPROTO_RAW: *palProtocolType = ProtocolType_PT_RAW; @@ -2414,9 +2604,11 @@ static bool TryConvertProtocolTypePlatformToPal(int32_t palAddressFamily, int pl *palProtocolType = ProtocolType_PT_UNSPECIFIED; return true; +#ifdef IPPROTO_ICMPV6 case IPPROTO_ICMPV6: *palProtocolType = ProtocolType_PT_ICMPV6; return true; +#endif case IPPROTO_TCP: *palProtocolType = ProtocolType_PT_TCP; @@ -2426,29 +2618,39 @@ static bool TryConvertProtocolTypePlatformToPal(int32_t palAddressFamily, int pl *palProtocolType = ProtocolType_PT_UDP; return true; +#ifdef IPPROTO_IGMP case IPPROTO_IGMP: *palProtocolType = ProtocolType_PT_IGMP; return true; +#endif case IPPROTO_RAW: *palProtocolType = ProtocolType_PT_RAW; return true; +#ifdef IPPROTO_DSTOPTS case IPPROTO_DSTOPTS: *palProtocolType = ProtocolType_PT_DSTOPTS; return true; +#endif +#ifdef IPPROTO_NONE case IPPROTO_NONE: *palProtocolType = ProtocolType_PT_NONE; return true; +#endif +#ifdef IPPROTO_ROUTING case IPPROTO_ROUTING: *palProtocolType = ProtocolType_PT_ROUTING; return true; +#endif +#ifdef IPPROTO_FRAGMENT case IPPROTO_FRAGMENT: *palProtocolType = ProtocolType_PT_FRAGMENT; return true; +#endif default: *palProtocolType = (int)platformProtocolType; @@ -2467,6 +2669,7 @@ static bool TryConvertProtocolTypePlatformToPal(int32_t palAddressFamily, int pl } } } +#endif /* TARGET_WASI */ int32_t SystemNative_Socket(int32_t addressFamily, int32_t socketType, int32_t protocolType, intptr_t* createdSocket) { @@ -2475,6 +2678,7 @@ int32_t SystemNative_Socket(int32_t addressFamily, int32_t socketType, int32_t p return Error_EFAULT; } +#if !defined(TARGET_WASI) sa_family_t platformAddressFamily; int platformSocketType, platformProtocolType; @@ -2509,6 +2713,9 @@ int32_t SystemNative_Socket(int32_t addressFamily, int32_t socketType, int32_t p fcntl(ToFileDescriptor(*createdSocket), F_SETFD, FD_CLOEXEC); // ignore any failures; this is best effort #endif return Error_SUCCESS; +#else /* TARGET_WASI */ + return Error_EINVAL; +#endif /* TARGET_WASI */ } int32_t SystemNative_GetSocketType(intptr_t socket, int32_t* addressFamily, int32_t* socketType, int32_t* protocolType, int32_t* isListening) @@ -2576,6 +2783,7 @@ int32_t SystemNative_GetSocketType(intptr_t socket, int32_t* addressFamily, int3 int listeningValue; socklen_t listeningLength = sizeof(int); +#ifdef SO_ACCEPTCONN if (getsockopt(fd, SOL_SOCKET, SO_ACCEPTCONN, &listeningValue, &listeningLength) == 0) { *isListening = (listeningValue != 0); @@ -2584,6 +2792,9 @@ int32_t SystemNative_GetSocketType(intptr_t socket, int32_t* addressFamily, int3 { *isListening = 0; } +#else + *isListening = 0; +#endif #endif return Error_SUCCESS; } @@ -2595,6 +2806,7 @@ int32_t SystemNative_GetAtOutOfBandMark(intptr_t socket, int32_t* atMark) return Error_EFAULT; } +#if !defined(TARGET_WASI) int fd = ToFileDescriptor(socket); int result; @@ -2608,6 +2820,9 @@ int32_t SystemNative_GetAtOutOfBandMark(intptr_t socket, int32_t* atMark) *atMark = (int32_t)result; return Error_SUCCESS; +#else /* TARGET_WASI */ + return Error_EINVAL; +#endif /* TARGET_WASI */ } int32_t SystemNative_GetBytesAvailable(intptr_t socket, int32_t* available) @@ -2927,10 +3142,13 @@ static int32_t WaitForSocketEventsInner(int32_t port, SocketEvent* buffer, int32 #else static const size_t SocketEventBufferElementSize = 0; +#if !defined(TARGET_WASI) static SocketEvents GetSocketEvents(int16_t filter, uint16_t flags) { return SocketEvents_SA_NONE; } +#endif /* TARGET_WASI */ + static int32_t CloseSocketEventPortInner(int32_t port) { return Error_ENOSYS; @@ -3036,6 +3254,7 @@ int32_t SystemNative_PlatformSupportsDualModeIPv4PacketInfo(void) #endif } +#if !defined(TARGET_WASI) static char* GetNameFromUid(uid_t uid) { size_t bufferLength = 512; @@ -3072,17 +3291,23 @@ static char* GetNameFromUid(uid_t uid) bufferLength = tmpBufferLength; } } +#endif /* TARGET_WASI */ char* SystemNative_GetPeerUserName(intptr_t socket) { +#if !defined(TARGET_WASI) uid_t euid; return SystemNative_GetPeerID(socket, &euid) == 0 ? GetNameFromUid(euid) : NULL; +#else /* TARGET_WASI */ + return NULL; +#endif /* TARGET_WASI */ } void SystemNative_GetDomainSocketSizes(int32_t* pathOffset, int32_t* pathSize, int32_t* addressSize) { +#if !defined(TARGET_WASI) assert(pathOffset != NULL); assert(pathSize != NULL); assert(addressSize != NULL); @@ -3092,6 +3317,11 @@ void SystemNative_GetDomainSocketSizes(int32_t* pathOffset, int32_t* pathSize, i *pathOffset = offsetof(struct sockaddr_un, sun_path); *pathSize = sizeof(domainSocket.sun_path); *addressSize = sizeof(domainSocket); +#else /* TARGET_WASI */ + *pathOffset = -1; + *pathSize = -1; + *addressSize = -1; +#endif /* TARGET_WASI */ } int32_t SystemNative_GetMaximumAddressSize(void) @@ -3266,7 +3496,12 @@ int32_t SystemNative_SendFile(intptr_t out_fd, intptr_t in_fd, int64_t offset, i uint32_t SystemNative_InterfaceNameToIndex(char* interfaceName) { assert(interfaceName != NULL); +#if !defined(TARGET_WASI) if (interfaceName[0] == '%') interfaceName++; return if_nametoindex(interfaceName); +#else /* TARGET_WASI */ + return Error_EINVAL; +#endif /* TARGET_WASI */ } + diff --git a/src/native/libs/System.Native/pal_networkstatistics.c b/src/native/libs/System.Native/pal_networkstatistics.c index 987a0a80d8159..eeeb8ac802942 100644 --- a/src/native/libs/System.Native/pal_networkstatistics.c +++ b/src/native/libs/System.Native/pal_networkstatistics.c @@ -32,7 +32,9 @@ #else #include #endif +#if HAVE_NET_IF_H #include +#endif #include #include diff --git a/src/native/libs/System.Native/pal_process.c b/src/native/libs/System.Native/pal_process.c index 509049b2fdcd7..0ac81db47cc75 100644 --- a/src/native/libs/System.Native/pal_process.c +++ b/src/native/libs/System.Native/pal_process.c @@ -8,14 +8,20 @@ #include #include +#if HAVE_GRP_H #include +#endif #include #include #include #include #include +#if HAVE_SYS_WAIT_H #include +#endif +#if HAVE_SYSLOG_H #include +#endif #include #if HAVE_CRT_EXTERNS_H #include @@ -23,7 +29,9 @@ #if HAVE_PIPE2 #include #endif +#if HAVE_PTHREAD_H #include +#endif #if HAVE_SCHED_SETAFFINITY || HAVE_SCHED_GETAFFINITY #include @@ -41,6 +49,7 @@ #include +#if !defined(TARGET_WASI) // Validate that our SysLogPriority values are correct for the platform c_static_assert(PAL_LOG_EMERG == LOG_EMERG); c_static_assert(PAL_LOG_ALERT == LOG_ALERT); @@ -208,6 +217,7 @@ handler_from_sigaction (struct sigaction *sa) return sa->sa_handler; } } +#endif /* TARGET_WASI */ int32_t SystemNative_ForkAndExecProcess(const char* filename, char* const argv[], @@ -511,6 +521,7 @@ done:; #endif } +#if !defined(TARGET_WASI) // Each platform type has it's own RLIMIT values but the same name, so we need // to convert our standard types into the platform specific ones. static int32_t ConvertRLimitResourcesPalToPlatform(RLimitResources value) @@ -519,10 +530,14 @@ static int32_t ConvertRLimitResourcesPalToPlatform(RLimitResources value) { case PAL_RLIMIT_CPU: return RLIMIT_CPU; +#ifdef RLIMIT_FSIZE case PAL_RLIMIT_FSIZE: return RLIMIT_FSIZE; +#endif +#ifdef RLIMIT_DATA case PAL_RLIMIT_DATA: return RLIMIT_DATA; +#endif case PAL_RLIMIT_STACK: return RLIMIT_STACK; case PAL_RLIMIT_CORE: @@ -605,11 +620,12 @@ typedef __priority_which_t priorityWhich; typedef int rlimitResource; typedef int priorityWhich; #endif +#endif /* TARGET_WASI */ int32_t SystemNative_GetRLimit(RLimitResources resourceType, RLimit* limits) { assert(limits != NULL); - +#if HAVE_SYS_RESOURCE_H int32_t platformLimit = ConvertRLimitResourcesPalToPlatform(resourceType); struct rlimit internalLimit; int result = getrlimit((rlimitResource)platformLimit, &internalLimit); @@ -621,6 +637,10 @@ int32_t SystemNative_GetRLimit(RLimitResources resourceType, RLimit* limits) { memset(limits, 0, sizeof(RLimit)); } +#else /* HAVE_SYS_RESOURCE_H */ + int result = -1; + memset(limits, 0, sizeof(RLimit)); +#endif return result; } @@ -629,14 +649,19 @@ int32_t SystemNative_SetRLimit(RLimitResources resourceType, const RLimit* limit { assert(limits != NULL); +#if HAVE_SYS_RESOURCE_H int32_t platformLimit = ConvertRLimitResourcesPalToPlatform(resourceType); struct rlimit internalLimit; ConvertFromRLimitManagedToPal(limits, &internalLimit); return setrlimit((rlimitResource)platformLimit, &internalLimit); +#else /* HAVE_SYS_RESOURCE_H */ + return -1; +#endif } int32_t SystemNative_Kill(int32_t pid, int32_t signal) { +#if HAVE_SIGNAL_KILL switch (signal) { case PAL_NONE: @@ -658,25 +683,39 @@ int32_t SystemNative_Kill(int32_t pid, int32_t signal) } return kill(pid, signal); +#else /* HAVE_SIGNAL_KILL */ + return -1; +#endif /* HAVE_SIGNAL_KILL */ } int32_t SystemNative_GetPid(void) { +#if !defined(TARGET_WASI) return getpid(); +#else /* TARGET_WASI */ + return -1; +#endif /* TARGET_WASI */ } int32_t SystemNative_GetSid(int32_t pid) { +#if !defined(TARGET_WASI) return getsid(pid); +#else /* TARGET_WASI */ + return -1; +#endif /* TARGET_WASI */ } void SystemNative_SysLog(SysLogPriority priority, const char* message, const char* arg1) { +#if !defined(TARGET_WASI) syslog((int)(LOG_USER | priority), message, arg1); +#endif /* TARGET_WASI */ } int32_t SystemNative_WaitIdAnyExitedNoHangNoWait(void) { +#if !defined(TARGET_WASI) siginfo_t siginfo; memset(&siginfo, 0, sizeof(siginfo)); int32_t result; @@ -696,10 +735,14 @@ int32_t SystemNative_WaitIdAnyExitedNoHangNoWait(void) result = 0; } return result; +#else /* TARGET_WASI */ + return -1; +#endif /* TARGET_WASI */ } int32_t SystemNative_WaitPidExitedNoHang(int32_t pid, int32_t* exitCode) { +#if !defined(TARGET_WASI) assert(exitCode != NULL); int32_t result; @@ -723,6 +766,9 @@ int32_t SystemNative_WaitPidExitedNoHang(int32_t pid, int32_t* exitCode) } } return result; +#else /* TARGET_WASI */ + return -1; +#endif /* TARGET_WASI */ } int64_t SystemNative_PathConf(const char* path, PathConfName name) @@ -771,6 +817,7 @@ int64_t SystemNative_PathConf(const char* path, PathConfName name) int32_t SystemNative_GetPriority(PriorityWhich which, int32_t who) { +#if !defined(TARGET_WASI) // GetPriority uses errno 0 to show success to make sure we don't have a stale value errno = 0; #if PRIORITY_REQUIRES_INT_WHO @@ -778,15 +825,22 @@ int32_t SystemNative_GetPriority(PriorityWhich which, int32_t who) #else return getpriority((priorityWhich)which, (id_t)who); #endif +#else /* TARGET_WASI */ + return -1; +#endif /* TARGET_WASI */ } int32_t SystemNative_SetPriority(PriorityWhich which, int32_t who, int32_t nice) { +#if !defined(TARGET_WASI) #if PRIORITY_REQUIRES_INT_WHO return setpriority((priorityWhich)which, who, nice); #else return setpriority((priorityWhich)which, (id_t)who, nice); #endif +#else /* TARGET_WASI */ + return -1; +#endif /* TARGET_WASI */ } char* SystemNative_GetCwd(char* buffer, int32_t bufferSize) diff --git a/src/native/libs/System.Native/pal_signal.c b/src/native/libs/System.Native/pal_signal.c index 257969dc67a94..f09b45ff33f0b 100644 --- a/src/native/libs/System.Native/pal_signal.c +++ b/src/native/libs/System.Native/pal_signal.c @@ -9,13 +9,19 @@ #include #include +#if HAVE_PTHREAD_H #include +#endif #include #include #include +#if HAVE_SYS_WAIT_H #include +#endif #include +#if !defined(TARGET_WASI) + static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; // Saved signal handlers @@ -180,14 +186,6 @@ int32_t SystemNative_GetPlatformSignalNumber(PosixSignal signal) return 0; } -void SystemNative_SetPosixSignalHandler(PosixSignalHandler signalHandler) -{ - assert(signalHandler); - assert(g_posixSignalHandler == NULL || g_posixSignalHandler == signalHandler); - - g_posixSignalHandler = signalHandler; -} - static struct sigaction* OrigActionFor(int sig) { return &g_origSigHandler[sig - 1]; @@ -244,8 +242,21 @@ static void SignalHandler(int sig, siginfo_t* siginfo, void* context) } } +#endif /* TARGET_WASI */ + +void SystemNative_SetPosixSignalHandler(PosixSignalHandler signalHandler) +{ + assert(signalHandler); +#if !defined(TARGET_WASI) + assert(g_posixSignalHandler == NULL || g_posixSignalHandler == signalHandler); + + g_posixSignalHandler = signalHandler; +#endif /* TARGET_WASI */ +} + void SystemNative_HandleNonCanceledPosixSignal(int32_t signalCode) { +#if !defined(TARGET_WASI) switch (signalCode) { case SIGCONT: @@ -299,8 +310,10 @@ void SystemNative_HandleNonCanceledPosixSignal(int32_t signalCode) kill(g_pid, signalCode); break; } +#endif /* TARGET_WASI */ } +#if !defined(TARGET_WASI) // Entrypoint for the thread that handles signals where our handling // isn't signal-safe. Those signal handlers write the signal to a pipe, // which this loop reads and processes. @@ -471,10 +484,12 @@ static bool InstallSignalHandler(int sig, int flags) *isInstalled = true; return true; } +#endif /* TARGET_WASI */ void SystemNative_SetTerminalInvalidationHandler(TerminalInvalidationCallback callback) { assert(callback != NULL); +#if !defined(TARGET_WASI) assert(g_terminalInvalidationCallback == NULL); bool installed = false; (void)installed; // only used for assert @@ -491,11 +506,13 @@ void SystemNative_SetTerminalInvalidationHandler(TerminalInvalidationCallback ca assert(installed); } pthread_mutex_unlock(&lock); +#endif /* TARGET_WASI */ } void SystemNative_RegisterForSigChld(SigChldCallback callback) { assert(callback != NULL); +#if !defined(TARGET_WASI) assert(g_sigChldCallback == NULL); bool installed = false; (void)installed; // only used for assert @@ -508,15 +525,19 @@ void SystemNative_RegisterForSigChld(SigChldCallback callback) assert(installed); } pthread_mutex_unlock(&lock); +#endif /* TARGET_WASI */ } void SystemNative_SetDelayedSigChildConsoleConfigurationHandler(void (*callback)(void)) { +#if !defined(TARGET_WASI) assert(g_sigChldConsoleConfigurationCallback == NULL); g_sigChldConsoleConfigurationCallback = callback; +#endif /* TARGET_WASI */ } +#if !defined(TARGET_WASI) static bool CreateSignalHandlerThread(int* readFdPtr) { pthread_attr_t attr; @@ -614,9 +635,11 @@ int32_t InitializeSignalHandlingCore(void) return 1; } +#endif /* TARGET_WASI */ int32_t SystemNative_EnablePosixSignalHandling(int signalCode) { +#if !defined(TARGET_WASI) assert(g_posixSignalHandler != NULL); assert(signalCode > 0 && signalCode <= GetSignalMax()); @@ -630,10 +653,14 @@ int32_t SystemNative_EnablePosixSignalHandling(int signalCode) pthread_mutex_unlock(&lock); return installed ? 1 : 0; +#else /* TARGET_WASI */ + return false; +#endif /* TARGET_WASI */ } void SystemNative_DisablePosixSignalHandling(int signalCode) { +#if !defined(TARGET_WASI) assert(signalCode > 0 && signalCode <= GetSignalMax()); pthread_mutex_lock(&lock); @@ -655,8 +682,10 @@ void SystemNative_DisablePosixSignalHandling(int signalCode) } } pthread_mutex_unlock(&lock); +#endif /* TARGET_WASI */ } +#if !defined(TARGET_WASI) void InstallTTOUHandlerForConsole(ConsoleSigTtouHandler handler) { bool installed; @@ -717,4 +746,5 @@ int32_t SystemNative_InitializeTerminalAndSignalHandling(void) return initialized; } -#endif +#endif /* !HAS_CONSOLE_SIGNALS */ +#endif /* !TARGET_WASI */ diff --git a/src/native/libs/System.Native/pal_threading.c b/src/native/libs/System.Native/pal_threading.c index b524327ef820b..09d49be20fb07 100644 --- a/src/native/libs/System.Native/pal_threading.c +++ b/src/native/libs/System.Native/pal_threading.c @@ -4,6 +4,7 @@ #include "pal_config.h" #include "pal_threading.h" +#include #include #include #include @@ -20,7 +21,9 @@ // So we can use the declaration of pthread_cond_timedwait_relative_np #undef _XOPEN_SOURCE #endif +#if HAVE_PTHREAD_H #include +#endif #if defined(TARGET_OSX) #define _XOPEN_SOURCE #endif @@ -30,8 +33,12 @@ struct LowLevelMonitor { +#if !defined(TARGET_WASI) pthread_mutex_t Mutex; pthread_cond_t Condition; +#else /* !TARGET_WASI */ + bool Dummy; +#endif /* !TARGET_WASI */ #ifdef DEBUG bool IsLocked; #endif @@ -55,6 +62,7 @@ LowLevelMonitor* SystemNative_LowLevelMonitor_Create(void) { return NULL; } +#if !defined(TARGET_WASI) int error; @@ -105,12 +113,16 @@ LowLevelMonitor* SystemNative_LowLevelMonitor_Create(void) assert(error == 0); free(monitor); return NULL; +#else /* !TARGET_WASI */ + return monitor; +#endif /* !TARGET_WASI */ } void SystemNative_LowLevelMonitor_Destroy(LowLevelMonitor* monitor) { assert(monitor != NULL); +#if !defined(TARGET_WASI) int error; error = pthread_cond_destroy(&monitor->Condition); @@ -121,6 +133,7 @@ void SystemNative_LowLevelMonitor_Destroy(LowLevelMonitor* monitor) (void)error; // unused in release build +#endif /* !TARGET_WASI */ free(monitor); } @@ -128,9 +141,11 @@ void SystemNative_LowLevelMonitor_Acquire(LowLevelMonitor* monitor) { assert(monitor != NULL); +#if !defined(TARGET_WASI) int error = pthread_mutex_lock(&monitor->Mutex); assert(error == 0); (void)error; // unused in release build +#endif /* !TARGET_WASI */ SetIsLocked(monitor, true); } @@ -141,9 +156,11 @@ void SystemNative_LowLevelMonitor_Release(LowLevelMonitor* monitor) SetIsLocked(monitor, false); +#if !defined(TARGET_WASI) int error = pthread_mutex_unlock(&monitor->Mutex); assert(error == 0); (void)error; // unused in release build +#endif /* !TARGET_WASI */ } void SystemNative_LowLevelMonitor_Wait(LowLevelMonitor* monitor) @@ -152,9 +169,11 @@ void SystemNative_LowLevelMonitor_Wait(LowLevelMonitor* monitor) SetIsLocked(monitor, false); +#if !defined(TARGET_WASI) int error = pthread_cond_wait(&monitor->Condition, &monitor->Mutex); assert(error == 0); (void)error; // unused in release build +#endif /* !TARGET_WASI */ SetIsLocked(monitor, true); } @@ -165,6 +184,7 @@ int32_t SystemNative_LowLevelMonitor_TimedWait(LowLevelMonitor *monitor, int32_t SetIsLocked(monitor, false); +#if !defined(TARGET_WASI) int error; // Calculate the time at which a timeout should occur, and wait. Older versions of OSX don't support clock_gettime with @@ -199,12 +219,16 @@ int32_t SystemNative_LowLevelMonitor_TimedWait(LowLevelMonitor *monitor, int32_t SetIsLocked(monitor, true); return error == 0; +#else /* !TARGET_WASI */ + return true; +#endif /* !TARGET_WASI */ } void SystemNative_LowLevelMonitor_Signal_Release(LowLevelMonitor* monitor) { assert(monitor != NULL); +#if !defined(TARGET_WASI) int error; error = pthread_cond_signal(&monitor->Condition); @@ -216,11 +240,13 @@ void SystemNative_LowLevelMonitor_Signal_Release(LowLevelMonitor* monitor) assert(error == 0); (void)error; // unused in release build +#endif /* !TARGET_WASI */ } int32_t SystemNative_CreateThread(uintptr_t stackSize, void *(*startAddress)(void*), void *parameter) { bool result = false; +#if !defined(TARGET_WASI) pthread_attr_t attrs; int error = pthread_attr_init(&attrs); @@ -261,6 +287,7 @@ int32_t SystemNative_CreateThread(uintptr_t stackSize, void *(*startAddress)(voi CreateThreadExit: error = pthread_attr_destroy(&attrs); assert(error == 0); +#endif /* !TARGET_WASI */ return result; } diff --git a/src/native/libs/System.Native/pal_time.c b/src/native/libs/System.Native/pal_time.c index 04ffd55865d30..76786b9ca8ee8 100644 --- a/src/native/libs/System.Native/pal_time.c +++ b/src/native/libs/System.Native/pal_time.c @@ -121,6 +121,7 @@ int64_t SystemNative_GetBootTimeTicks(void) double SystemNative_GetCpuUtilization(ProcessCpuInformation* previousCpuInfo) { +#ifdef HAVE_GETRUSAGE uint64_t kernelTime = 0; uint64_t userTime = 0; @@ -169,4 +170,8 @@ double SystemNative_GetCpuUtilization(ProcessCpuInformation* previousCpuInfo) previousCpuInfo->lastRecordedKernelTime = kernelTime; return cpuUtilization; +#else + assert(false); + return 0; +#endif } diff --git a/src/native/libs/System.Native/pal_uid.c b/src/native/libs/System.Native/pal_uid.c index 0f94484cafec4..e2cf3a24fb321 100644 --- a/src/native/libs/System.Native/pal_uid.c +++ b/src/native/libs/System.Native/pal_uid.c @@ -11,20 +11,27 @@ #include #include #include +#if HAVE_GRP_H #include +#endif +#if HAVE_PWD_H #include +#endif // Linux c-libraries (glibc, musl) provide a thread-safe getgrouplist. // OSX man page mentions explicitly the implementation is not thread safe, // due to using getgrent. -#ifndef __linux__ +#if !defined(__linux__) && !defined(TARGET_WASI) #define USE_GROUPLIST_LOCK #endif #if defined(USE_GROUPLIST_LOCK) || !HAVE_GETGRGID_R +#if HAVE_PTHREAD_H #include #endif +#endif +#if !defined(TARGET_WASI) static int32_t ConvertNativePasswdToPalPasswd(int error, struct passwd* nativePwd, struct passwd* result, Passwd* pwd) { // positive error number returned -> failure other than entry-not-found @@ -53,6 +60,7 @@ static int32_t ConvertNativePasswdToPalPasswd(int error, struct passwd* nativePw pwd->Shell = nativePwd->pw_shell; return 0; } +#endif /* !TARGET_WASI */ int32_t SystemNative_GetPwUidR(uint32_t uid, Passwd* pwd, char* buf, int32_t buflen) { @@ -63,12 +71,16 @@ int32_t SystemNative_GetPwUidR(uint32_t uid, Passwd* pwd, char* buf, int32_t buf if (buflen < 0) return EINVAL; +#if !defined(TARGET_WASI) struct passwd nativePwd; struct passwd* result; int error; while ((error = getpwuid_r(uid, &nativePwd, buf, Int32ToSizeT(buflen), &result)) == EINTR); return ConvertNativePasswdToPalPasswd(error, &nativePwd, result, pwd); +#else /* !TARGET_WASI */ + return EINVAL; +#endif /* !TARGET_WASI */ } int32_t SystemNative_GetPwNamR(const char* name, Passwd* pwd, char* buf, int32_t buflen) @@ -80,34 +92,50 @@ int32_t SystemNative_GetPwNamR(const char* name, Passwd* pwd, char* buf, int32_t if (buflen < 0) return EINVAL; +#if !defined(TARGET_WASI) struct passwd nativePwd; struct passwd* result; int error; while ((error = getpwnam_r(name, &nativePwd, buf, Int32ToSizeT(buflen), &result)) == EINTR); return ConvertNativePasswdToPalPasswd(error, &nativePwd, result, pwd); +#else /* !TARGET_WASI */ + return EINVAL; +#endif /* !TARGET_WASI */ } uint32_t SystemNative_GetEUid(void) { +#if !defined(TARGET_WASI) return geteuid(); +#else /* !TARGET_WASI */ + return EINVAL; +#endif /* !TARGET_WASI */ } uint32_t SystemNative_GetEGid(void) { +#if !defined(TARGET_WASI) return getegid(); +#else /* !TARGET_WASI */ + return EINVAL; +#endif /* !TARGET_WASI */ } int32_t SystemNative_SetEUid(uint32_t euid) { +#if !defined(TARGET_WASI) return seteuid(euid); +#else /* !TARGET_WASI */ + return EINVAL; +#endif /* !TARGET_WASI */ } #ifdef USE_GROUPLIST_LOCK static pthread_mutex_t s_groupLock = PTHREAD_MUTEX_INITIALIZER; #endif -#if !HAVE_GETGROUPLIST +#if !HAVE_GETGROUPLIST && !defined(TARGET_WASI) int getgrouplist(const char *uname, gid_t agroup, gid_t *groups, int *groupCount) { int ngroups = 1; @@ -204,8 +232,10 @@ int32_t SystemNative_GetGroupList(const char* name, uint32_t group, uint32_t* gr #ifdef __APPLE__ // On OSX groups are passed as a signed int. rv = getgrouplist(name, (int)group, (int*)groups, &groupsAvailable); -#else +#elif HAVE_GETGROUPLIST rv = getgrouplist(name, group, groups, &groupsAvailable); +#else + rv = 0; #endif #ifdef USE_GROUPLIST_LOCK @@ -236,10 +266,14 @@ int32_t SystemNative_GetGroups(int32_t ngroups, uint32_t* groups) assert(ngroups >= 0); assert(groups != NULL); +#if !defined(TARGET_WASI) return getgroups(ngroups, groups); +#else /* TARGET_WASI */ + return -1; +#endif /* TARGET_WASI */ } -#if !HAVE_GETGRGID_R +#if !HAVE_GETGRGID_R && !defined(TARGET_WASI) // Need to call getgrgid which is not thread-safe, and protect it with a mutex static pthread_mutex_t s_getgrgid_lock = PTHREAD_MUTEX_INITIALIZER; #endif @@ -282,7 +316,7 @@ char* SystemNative_GetGroupName(uint32_t gid) } bufferLength = tmpBufferLength; } -#else +#elif !defined(TARGET_WASI) // Platforms like Android API level < 24 do not have getgrgid_r available int rv = pthread_mutex_lock(&s_getgrgid_lock); if (rv != 0) @@ -300,5 +334,7 @@ char* SystemNative_GetGroupName(uint32_t gid) char* name = strdup(result->gr_name); pthread_mutex_unlock(&s_getgrgid_lock); return name; +#else + return NULL; #endif } diff --git a/src/native/libs/System.Net.Security.Native/CMakeLists.txt b/src/native/libs/System.Net.Security.Native/CMakeLists.txt index 6fbe18f76872e..50c9228fe3dd3 100644 --- a/src/native/libs/System.Net.Security.Native/CMakeLists.txt +++ b/src/native/libs/System.Net.Security.Native/CMakeLists.txt @@ -19,7 +19,7 @@ if (GEN_SHARED_LIB) ) endif() -if (NOT GEN_SHARED_LIB AND NOT CLR_CMAKE_TARGET_MACCATALYST AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS AND NOT CLR_CMAKE_TARGET_ANDROID AND NOT CLR_CMAKE_TARGET_BROWSER) +if (NOT GEN_SHARED_LIB AND NOT CLR_CMAKE_TARGET_MACCATALYST AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS AND NOT CLR_CMAKE_TARGET_ANDROID AND NOT CLR_CMAKE_TARGET_BROWSER AND NOT CLR_CMAKE_TARGET_WASI) set(NATIVEGSS_SOURCES ${NATIVEGSS_SOURCES} entrypoints.c) endif() @@ -35,7 +35,7 @@ if (GEN_SHARED_LIB) ${NATIVE_LIBS_EXTRA} ) - if (NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_MACCATALYST AND NOT CLR_CMAKE_TARGET_TVOS AND NOT CLR_CMAKE_TARGET_ANDROID AND NOT CLR_CMAKE_TARGET_BROWSER) + if (NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_MACCATALYST AND NOT CLR_CMAKE_TARGET_TVOS AND NOT CLR_CMAKE_TARGET_ANDROID AND NOT CLR_CMAKE_TARGET_BROWSER AND NOT CLR_CMAKE_TARGET_WASI) add_custom_command(TARGET System.Net.Security.Native POST_BUILD COMMENT "Verifying System.Net.Security.Native entry points against entrypoints.c " COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/../verify-entrypoints.sh diff --git a/src/native/libs/build-native.sh b/src/native/libs/build-native.sh index d93bffefbdd9f..dc42d0d265a65 100755 --- a/src/native/libs/build-native.sh +++ b/src/native/libs/build-native.sh @@ -52,11 +52,20 @@ if [[ "$__TargetOS" == Browser ]]; then fi fi source "$EMSDK_PATH"/emsdk_env.sh - export CLR_CC=$(which emcc) elif [[ "$__TargetOS" == wasi ]]; then - # nothing to do here - true + if [[ -z "$WASI_SDK_PATH" ]]; then + if [[ -d "$__RepoRootDir"/src/mono/wasi/wasi-sdk/ ]]; then + export WASI_SDK_PATH="$__RepoRootDir"/src/mono/wasi/wasi-sdk/ + else + echo "Error: You need to set the WASI_SDK_PATH environment variable pointing to the WASI SDK root." + exit 1 + fi + fi + + export CLR_CC="$WASI_SDK_PATH"bin/clang + export TARGET_BUILD_ARCH=wasm + __CMakeArgs="-DCLR_CMAKE_TARGET_OS=WASI -DCLR_CMAKE_TARGET_ARCH=wasm -DWASI_SDK_PREFIX=$WASI_SDK_PATH -DCMAKE_TOOLCHAIN_FILE=$WASI_SDK_PATH/share/cmake/wasi-sdk.cmake" elif [[ "$__TargetOS" == iOS || "$__TargetOS" == iOSSimulator ]]; then # nothing to do here true diff --git a/src/native/libs/configure.cmake b/src/native/libs/configure.cmake index 7c5b88e96d5d0..a5a939295c9e3 100644 --- a/src/native/libs/configure.cmake +++ b/src/native/libs/configure.cmake @@ -131,6 +131,11 @@ check_symbol_exists( fcntl.h HAVE_F_DUPFD_CLOEXEC) +check_symbol_exists( + F_DUPFD + fcntl.h + HAVE_F_DUPFD) + check_symbol_exists( F_FULLFSYNC fcntl.h @@ -367,6 +372,19 @@ check_symbol_exists( ${STATFS_INCLUDES} HAVE_STATFS) +check_symbol_exists( + "kill" + "signal.h" + HAVE_SIGNAL_KILL) + +check_include_files( + "mntent.h" + HAVE_MNTENT_H) + +check_include_files( + "sys/resource.h" + HAVE_SYS_RESOURCE_H) + check_type_size( "struct statfs" STATFS_SIZE @@ -577,7 +595,7 @@ elseif(CLR_CMAKE_TARGET_ANDROID) unset(HAVE_ALIGNED_ALLOC) # only exists on newer Android set(HAVE_CLOCK_MONOTONIC 1) set(HAVE_CLOCK_REALTIME 1) -elseif(CLR_CMAKE_TARGET_BROWSER) +elseif(CLR_CMAKE_TARGET_BROWSER OR CLR_CMAKE_TARGET_WASI) set(HAVE_FORK 0) else() if(CLR_CMAKE_TARGET_OSX) @@ -661,7 +679,10 @@ elseif (HAVE_PTHREAD_IN_LIBC) set(PTHREAD_LIBRARY c) endif() -check_library_exists(${PTHREAD_LIBRARY} pthread_condattr_setclock "" HAVE_PTHREAD_CONDATTR_SETCLOCK) +if (NOT CLR_CMAKE_TARGET_WASI) + # TODOWASI + check_library_exists(${PTHREAD_LIBRARY} pthread_condattr_setclock "" HAVE_PTHREAD_CONDATTR_SETCLOCK) +endif() check_symbol_exists( futimes @@ -784,7 +805,7 @@ check_c_source_compiles( " HAVE_MKSTEMP) -if (NOT HAVE_MKSTEMPS AND NOT HAVE_MKSTEMP) +if (NOT HAVE_MKSTEMPS AND NOT HAVE_MKSTEMP AND NOT CLR_CMAKE_TARGET_WASI) message(FATAL_ERROR "Cannot find mkstemps nor mkstemp on this platform.") endif() @@ -872,6 +893,42 @@ check_symbol_exists( "unistd.h;grp.h" HAVE_GETGROUPLIST) +check_include_files( + "grp.h" + HAVE_GRP_H) + +check_include_files( + "syslog.h" + HAVE_SYSLOG_H) + +check_include_files( + "pwd.h" + HAVE_PWD_H) + +check_include_files( + "termios.h" + HAVE_TERMIOS_H) + +check_include_files( + "dlfcn.h" + HAVE_DLFCN_H) + +check_include_files( + "sys/wait.h" + HAVE_SYS_WAIT_H) + +check_include_files( + "sys/statvfs.h" + HAVE_SYS_STATVFS_H) + +check_include_files( + "net/if.h" + HAVE_NET_IF_H) + +check_include_files( + "pthread.h" + HAVE_PTHREAD_H) + if(CLR_CMAKE_TARGET_MACCATALYST OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS) set(HAVE_IOS_NET_ROUTE_H 1) set(HAVE_IOS_NET_IFMEDIA_H 1) @@ -1007,7 +1064,7 @@ set (CMAKE_REQUIRED_LIBRARIES ${PREVIOUS_CMAKE_REQUIRED_LIBRARIES}) set (HAVE_INOTIFY 0) if (HAVE_INOTIFY_INIT AND HAVE_INOTIFY_ADD_WATCH AND HAVE_INOTIFY_RM_WATCH) set (HAVE_INOTIFY 1) -elseif (CLR_CMAKE_TARGET_LINUX AND NOT CLR_CMAKE_TARGET_BROWSER) +elseif (CLR_CMAKE_TARGET_LINUX AND NOT CLR_CMAKE_TARGET_BROWSER AND NOT CLR_CMAKE_TARGET_WASI) message(FATAL_ERROR "Cannot find inotify functions on a Linux platform.") endif() @@ -1092,14 +1149,16 @@ check_symbol_exists( sys/sysmacros.h HAVE_MAKEDEV_SYSMACROSH) -if (NOT HAVE_MAKEDEV_FILEH AND NOT HAVE_MAKEDEV_SYSMACROSH) +if (NOT HAVE_MAKEDEV_FILEH AND NOT HAVE_MAKEDEV_SYSMACROSH AND NOT CLR_CMAKE_TARGET_WASI) message(FATAL_ERROR "Cannot find the makedev function on this platform.") endif() -check_symbol_exists( - getgrgid_r - grp.h - HAVE_GETGRGID_R) +if (NOT CLR_CMAKE_TARGET_WASI) + check_symbol_exists( + getgrgid_r + grp.h + HAVE_GETGRGID_R) +endif() configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/Common/pal_config.h.in diff --git a/src/tests/Common/CoreCLRTestLibrary/OutOfProcessTest.cs b/src/tests/Common/CoreCLRTestLibrary/OutOfProcessTest.cs index ad68f35537b92..d805f4c21a1cf 100644 --- a/src/tests/Common/CoreCLRTestLibrary/OutOfProcessTest.cs +++ b/src/tests/Common/CoreCLRTestLibrary/OutOfProcessTest.cs @@ -46,7 +46,8 @@ static OutOfProcessTest() !OperatingSystem.IsIOS() && !OperatingSystem.IsTvOS() && !OperatingSystem.IsAndroid() - && !OperatingSystem.IsBrowser(); + && !OperatingSystem.IsBrowser() + && !OperatingSystem.IsOSPlatform("Wasi"); public static void RunOutOfProcessTest(string basePath, string assemblyPath) { diff --git a/src/tests/Common/XHarnessRunnerLibrary/RunnerEntryPoint.cs b/src/tests/Common/XHarnessRunnerLibrary/RunnerEntryPoint.cs index daf22773002ef..43dd5d38db87e 100644 --- a/src/tests/Common/XHarnessRunnerLibrary/RunnerEntryPoint.cs +++ b/src/tests/Common/XHarnessRunnerLibrary/RunnerEntryPoint.cs @@ -30,7 +30,7 @@ public static async Task RunTests( { entryPoint = new AppleEntryPoint(new SimpleDevice(assemblyName), runTestsCallback, assemblyName, filter, testExclusionList); } - if (OperatingSystem.IsBrowser()) + if (OperatingSystem.IsBrowser() || OperatingSystem.IsOSPlatform("Wasi")) { entryPoint = new WasmEntryPoint(runTestsCallback, assemblyName, filter, testExclusionList); } @@ -42,7 +42,7 @@ public static async Task RunTests( entryPoint.TestsCompleted += (o, e) => anyFailedTests = e.FailedTests > 0; await entryPoint.RunAsync(); - if (OperatingSystem.IsBrowser()) + if (OperatingSystem.IsBrowser() || OperatingSystem.IsOSPlatform("Wasi")) { // 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 213fc3d36d1bb..6ec3f4e5765c2 100644 --- a/src/tests/Common/XUnitWrapperGenerator/ITestInfo.cs +++ b/src/tests/Common/XUnitWrapperGenerator/ITestInfo.cs @@ -182,6 +182,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.IsOSPlatform("Wasi")"); + } if (platform.HasFlag(Xunit.TestPlatforms.FreeBSD)) { platformCheckConditions.Add(@"global::System.OperatingSystem.IsFreeBSD()");