From ffc4fd3164de3aa49d45587d9f6ab41a84bbaeb2 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Sat, 4 Feb 2023 23:08:51 +0000 Subject: [PATCH 01/41] [wasi] support builds with no relinking --- eng/testing/tests.wasi.targets | 2 +- src/mono/sample/wasi/wasi.mk | 5 +- src/mono/wasi/build/WasiApp.targets | 91 +++++++---------------------- 3 files changed, 24 insertions(+), 74 deletions(-) diff --git a/eng/testing/tests.wasi.targets b/eng/testing/tests.wasi.targets index 8f9a08b5768992..cbb15f6dc78bc5 100644 --- a/eng/testing/tests.wasi.targets +++ b/eng/testing/tests.wasi.targets @@ -19,7 +19,7 @@ --> false true - true + false WasmTestRunner.dll diff --git a/src/mono/sample/wasi/wasi.mk b/src/mono/sample/wasi/wasi.mk index a9a937612f8e32..edde876b5af816 100644 --- a/src/mono/sample/wasi/wasi.mk +++ b/src/mono/sample/wasi/wasi.mk @@ -9,7 +9,8 @@ endif CONFIG?=Release WASM_DEFAULT_BUILD_ARGS?=/p:TargetArchitecture=wasm /p:TargetOS=wasi /p:Configuration=$(CONFIG) -WASMTIME_PROV_PATH=$(realpath $(TOP)/artifacts/obj/wasmtime/wasmtime) +WASMTIME_PROV_DIR=$(realpath $(TOP)/artifacts/obj/wasmtime) +WASMTIME_PROV_PATH=${WASMTIME_PROV_DIR}/wasmtime all: publish @@ -23,4 +24,4 @@ clean: rm -rf bin $(TOP)/artifacts/obj/mono/$(PROJECT_NAME:%.csproj=%) run-console: - cd bin/wasi-wasm/AppBundle && $(WASMTIME_PROV_PATH) run $(PROJECT_NAME:.csproj=.wasm) $(ARGS) + cd bin/wasi-wasm/AppBundle && PATH=${WASMTIME_PROV_DIR}:${PATH} ./run-wasmtime.sh $(ARGS) diff --git a/src/mono/wasi/build/WasiApp.targets b/src/mono/wasi/build/WasiApp.targets index b6f5d563120cfa..11bba4b8d6dd20 100644 --- a/src/mono/wasi/build/WasiApp.targets +++ b/src/mono/wasi/build/WasiApp.targets @@ -117,7 +117,7 @@ -1 - true + false true true @@ -317,29 +317,18 @@ - - - + - icudt.dat + <_HasDotnetWasm Condition="'%(WasmNativeAsset.FileName)%(WasmNativeAsset.Extension)' == 'dotnet.wasm'">true - <_HasDotnetJsWorker Condition="'%(WasmNativeAsset.FileName)%(WasmNativeAsset.Extension)' == 'dotnet.worker.js'">true - <_HasDotnetJsSymbols Condition="'%(WasmNativeAsset.FileName)%(WasmNativeAsset.Extension)' == 'dotnet.js.symbols'">true - <_HasDotnetJs Condition="'%(WasmNativeAsset.FileName)%(WasmNativeAsset.Extension)' == 'dotnet.js'">true - - - - - + + @@ -350,72 +339,32 @@ Inputs="@(_WasmAssembliesInternal);$(WasmIcuDataFileName);@(WasmNativeAsset)" Outputs="$(WasmAppDir)\.stamp" Condition="'$(WasmGenerateAppBundle)' == 'true'" - DependsOnTargets="_WasmGenerateRuntimeConfig;_GetWasmGenerateAppBundleDependencies" /> - - - + DependsOnTargets="_WasmGenerateRuntimeConfig;_GetWasiGenerateAppBundleDependencies;_WasiDefaultGenerateAppBundle;_GenerateRunWasmtimeScript" /> - - <_WasmAppIncludeThreadsWorker Condition="'$(WasmEnableThreads)' == 'true' or '$(WasmEnablePerfTracing)' == 'true'">true - - <_WasmPThreadPoolSize Condition="'$(_WasmPThreadPoolSize)' == '' and ('$(WasmEnableThreads)' == 'true' or '$(WasmEnablePerfTracing)' == 'true')">-1 - - - - - - - - - - - - - + + + + - + - $(WasmAppDir)run-v8.sh - <_WasmMainJSFileName>$([System.IO.Path]::GetFileName('$(WasmMainJSPath)')) + $(WasmAppDir)run-wasmtime.sh + <_ScriptContent Condition="'$(WasmSingleFileBundle)' == 'true'">wasmtime run $([System.IO.Path]::GetFileNameWithoutExtension($(WasmMainAssemblyFileName))).wasm $* + <_ScriptContent Condition="'$(WasmSingleFileBundle)' != 'true'">wasmtime run --dir . dotnet.wasm $([System.IO.Path]::GetFileNameWithoutExtension($(WasmMainAssemblyFileName))) $* - + - + File="$(WasmRunWasmtimeScriptPath)" + Lines="$(_ScriptContent)" + Overwrite="true" /> - + - + From e4c50c0919c1200e77de59f591cf5e1e916b5e48 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Sat, 4 Feb 2023 23:09:22 +0000 Subject: [PATCH 02/41] wasi: update main() to work for no relinking --- src/mono/wasi/runtime/driver.c | 26 +++++++++++++++++--------- src/mono/wasi/runtime/main.c | 6 +----- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/mono/wasi/runtime/driver.c b/src/mono/wasi/runtime/driver.c index 2971e0499476a3..1689d36ab244ae 100644 --- a/src/mono/wasi/runtime/driver.c +++ b/src/mono/wasi/runtime/driver.c @@ -676,21 +676,28 @@ mono_wasm_string_array_new (int size) } #ifdef _WASI_DEFAULT_MAIN +/* + * with wasmtime, this is run as: + * $ wasmtime run--dir . dotnet.wasm MainAssembly [args] + * + * + * arg0: dotnet.wasm + * arg1: MainAssembly + * arg2-..: args + */ int main(int argc, char * argv[]) { - printf("TODOWASI: default main for non-relinked, non-aot apps, TODO\n"); if (argc < 2) { printf("Error: First argument must be the name of the main assembly\n"); return 1; } - // 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 - // AJ: not needed right now as we are bundling all the assemblies in the .wasm - mono_set_assemblies_path(".:./runtime/native:./runtime/lib/net7.0"); + + mono_set_assemblies_path("managed"); mono_wasm_load_runtime("", 0); - MonoAssembly* assembly = mono_wasm_assembly_load (argv[1]); + const char *assembly_name = argv[1]; + MonoAssembly* assembly = mono_wasm_assembly_load (assembly_name); if (!assembly) { - printf("wasi: mono_wasm_assembly_load returned NULL!\n"); + printf("Could not load assembly %s\n", assembly_name); return 1; } MonoMethod* entry_method = mono_wasi_assembly_get_entry_point (assembly); @@ -701,11 +708,12 @@ int main(int argc, char * argv[]) { MonoObject* out_exc; MonoObject* out_res; - int ret = mono_runtime_run_main(entry_method, argc, argv, &out_exc); + // Managed app will see: arg0: MainAssembly, arg1-.. [args] + int ret = mono_runtime_run_main(entry_method, argc - 1, &argv[1], &out_exc); if (out_exc) { mono_print_unhandled_exception(out_exc); exit(1); } - return ret; + return ret < 0 ? -ret : ret; } #endif diff --git a/src/mono/wasi/runtime/main.c b/src/mono/wasi/runtime/main.c index 2cf4c861867288..3b0e5a322864dc 100644 --- a/src/mono/wasi/runtime/main.c +++ b/src/mono/wasi/runtime/main.c @@ -22,10 +22,6 @@ int main(int argc, char * argv[]) { // This is supplied from the MSBuild itemgroup @(WasiAfterRuntimeLoaded) WASI_AFTER_RUNTIME_LOADED_CALLS #endif - // 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 - // AJ: not needed right now as we are bundling all the assemblies in the .wasm - /*mono_set_assemblies_path(".:./runtime/native:./runtime/lib/net7.0");*/ mono_wasm_load_runtime("", 0); const char* assembly_name = dotnet_wasi_getentrypointassemblyname(); @@ -44,5 +40,5 @@ int main(int argc, char * argv[]) { mono_print_unhandled_exception(out_exc); exit(1); } - return ret; + return ret < 0 ? -ret : ret; } From e156ceb99bc4cd8a6aba2a800c13699db4dea543 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Sat, 4 Feb 2023 23:33:40 +0000 Subject: [PATCH 03/41] enable only wasi builds --- eng/pipelines/common/platform-matrix.yml | 820 ----------------------- eng/pipelines/runtime.yml | 13 +- 2 files changed, 11 insertions(+), 822 deletions(-) diff --git a/eng/pipelines/common/platform-matrix.yml b/eng/pipelines/common/platform-matrix.yml index ff5333e089cbfa..69cf692ce572ee 100644 --- a/eng/pipelines/common/platform-matrix.yml +++ b/eng/pipelines/common/platform-matrix.yml @@ -23,341 +23,6 @@ parameters: jobs: -# Linux arm -- ${{ if or(containsValue(parameters.platforms, 'linux_arm'), in(parameters.platformGroup, 'all', 'gcstress')) }}: - - template: xplat-setup.yml - parameters: - jobTemplate: ${{ parameters.jobTemplate }} - helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} - variables: ${{ parameters.variables }} - osGroup: linux - archType: arm - targetRid: linux-arm - platform: linux_arm - shouldContinueOnError: ${{ parameters.shouldContinueOnError }} - container: linux_arm - jobParameters: - runtimeFlavor: ${{ parameters.runtimeFlavor }} - buildConfig: ${{ parameters.buildConfig }} - helixQueueGroup: ${{ parameters.helixQueueGroup }} - crossBuild: true - ${{ insert }}: ${{ parameters.jobParameters }} - -# Linux armv6 -- ${{ if containsValue(parameters.platforms, 'linux_armv6') }}: - - template: xplat-setup.yml - parameters: - jobTemplate: ${{ parameters.jobTemplate }} - helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} - variables: ${{ parameters.variables }} - osGroup: linux - archType: armv6 - targetRid: linux-armv6 - platform: linux_armv6 - shouldContinueOnError: ${{ parameters.shouldContinueOnError }} - container: linux_armv6 - jobParameters: - runtimeFlavor: ${{ parameters.runtimeFlavor }} - buildConfig: ${{ parameters.buildConfig }} - helixQueueGroup: ${{ parameters.helixQueueGroup }} - crossBuild: true - ${{ insert }}: ${{ parameters.jobParameters }} - -# Linux arm64 - -- ${{ if or(containsValue(parameters.platforms, 'linux_arm64'), in(parameters.platformGroup, 'all', 'gcstress')) }}: - - template: xplat-setup.yml - parameters: - jobTemplate: ${{ parameters.jobTemplate }} - helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} - variables: ${{ parameters.variables }} - osGroup: linux - archType: arm64 - targetRid: linux-arm64 - platform: linux_arm64 - shouldContinueOnError: ${{ parameters.shouldContinueOnError }} - ${{ if eq(parameters.container, '') }}: - container: linux_arm64 - ${{ if ne(parameters.container, '') }}: - container: - image: ${{ parameters.container }} - registry: mcr - jobParameters: - runtimeFlavor: ${{ parameters.runtimeFlavor }} - buildConfig: ${{ parameters.buildConfig }} - helixQueueGroup: ${{ parameters.helixQueueGroup }} - crossBuild: true - ${{ insert }}: ${{ parameters.jobParameters }} - -# Linux musl x64 - -- ${{ if or(containsValue(parameters.platforms, 'linux_musl_x64'), eq(parameters.platformGroup, 'all')) }}: - - template: xplat-setup.yml - parameters: - jobTemplate: ${{ parameters.jobTemplate }} - helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} - variables: ${{ parameters.variables }} - osGroup: linux - osSubgroup: _musl - archType: x64 - targetRid: linux-musl-x64 - platform: linux_musl_x64 - shouldContinueOnError: ${{ parameters.shouldContinueOnError }} - container: linux_musl_x64 - jobParameters: - runtimeFlavor: ${{ parameters.runtimeFlavor }} - buildConfig: ${{ parameters.buildConfig }} - helixQueueGroup: ${{ parameters.helixQueueGroup }} - ${{ insert }}: ${{ parameters.jobParameters }} - -# Linux musl arm - -- ${{ if or(containsValue(parameters.platforms, 'linux_musl_arm'), eq(parameters.platformGroup, 'all')) }}: - - template: xplat-setup.yml - parameters: - jobTemplate: ${{ parameters.jobTemplate }} - helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} - variables: ${{ parameters.variables }} - osGroup: linux - osSubgroup: _musl - archType: arm - targetRid: linux-musl-arm - platform: linux_musl_arm - shouldContinueOnError: ${{ parameters.shouldContinueOnError }} - container: linux_musl_arm - jobParameters: - runtimeFlavor: ${{ parameters.runtimeFlavor }} - buildConfig: ${{ parameters.buildConfig }} - helixQueueGroup: ${{ parameters.helixQueueGroup }} - crossBuild: true - ${{ insert }}: ${{ parameters.jobParameters }} - -# Linux musl arm64 - -- ${{ if or(containsValue(parameters.platforms, 'linux_musl_arm64'), eq(parameters.platformGroup, 'all')) }}: - - template: xplat-setup.yml - parameters: - jobTemplate: ${{ parameters.jobTemplate }} - helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} - variables: ${{ parameters.variables }} - osGroup: linux - osSubgroup: _musl - archType: arm64 - targetRid: linux-musl-arm64 - platform: linux_musl_arm64 - shouldContinueOnError: ${{ parameters.shouldContinueOnError }} - container: linux_musl_arm64 - jobParameters: - runtimeFlavor: ${{ parameters.runtimeFlavor }} - buildConfig: ${{ parameters.buildConfig }} - helixQueueGroup: ${{ parameters.helixQueueGroup }} - crossBuild: true - ${{ insert }}: ${{ parameters.jobParameters }} - -# Linux Bionic arm64 - -- ${{ if containsValue(parameters.platforms, 'linux_bionic_arm64') }}: - - template: xplat-setup.yml - parameters: - jobTemplate: ${{ parameters.jobTemplate }} - helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} - variables: ${{ parameters.variables }} - osGroup: linux - osSubgroup: _bionic - archType: arm64 - targetRid: linux-bionic-arm64 - platform: linux_bionic_arm64 - shouldContinueOnError: ${{ parameters.shouldContinueOnError }} - container: linux_bionic - jobParameters: - runtimeFlavor: mono - # We build on Linux, but the test queue runs Windows, so - # we need to override the test script generation - runScriptWindowsCmd: true - buildConfig: ${{ parameters.buildConfig }} - helixQueueGroup: ${{ parameters.helixQueueGroup }} - ${{ insert }}: ${{ parameters.jobParameters }} - -# Linux Bionic x64 - -- ${{ if containsValue(parameters.platforms, 'linux_bionic_x64') }}: - - template: xplat-setup.yml - parameters: - jobTemplate: ${{ parameters.jobTemplate }} - helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} - variables: ${{ parameters.variables }} - osGroup: linux - osSubgroup: _bionic - archType: x64 - targetRid: linux-bionic-x64 - platform: linux_bionic_x64 - shouldContinueOnError: ${{ parameters.shouldContinueOnError }} - container: linux_bionic - jobParameters: - runtimeFlavor: mono - buildConfig: ${{ parameters.buildConfig }} - helixQueueGroup: ${{ parameters.helixQueueGroup }} - ${{ insert }}: ${{ parameters.jobParameters }} - -# Linux x64 - -- ${{ if or(containsValue(parameters.platforms, 'linux_x64'), containsValue(parameters.platforms, 'CoreClrTestBuildHost'), in(parameters.platformGroup, 'all', 'gcstress')) }}: - - template: xplat-setup.yml - parameters: - jobTemplate: ${{ parameters.jobTemplate }} - helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} - variables: ${{ parameters.variables }} - osGroup: linux - archType: x64 - targetRid: linux-x64 - platform: linux_x64 - shouldContinueOnError: ${{ parameters.shouldContinueOnError }} - ${{ if eq(parameters.container, '') }}: - container: linux_x64 - ${{ if ne(parameters.container, '') }}: - container: - image: ${{ parameters.container }} - registry: mcr - jobParameters: - runtimeFlavor: ${{ parameters.runtimeFlavor }} - buildConfig: ${{ parameters.buildConfig }} - helixQueueGroup: ${{ parameters.helixQueueGroup }} - ${{ insert }}: ${{ parameters.jobParameters }} - -# Linux x86 - -- ${{ if containsValue(parameters.platforms, 'linux_x86') }}: - - template: xplat-setup.yml - parameters: - jobTemplate: ${{ parameters.jobTemplate }} - helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} - variables: ${{ parameters.variables }} - osGroup: linux - archType: x86 - targetRid: linux-x86 - platform: linux_x86 - shouldContinueOnError: ${{ parameters.shouldContinueOnError }} - container: linux_x86 - jobParameters: - runtimeFlavor: ${{ parameters.runtimeFlavor }} - buildConfig: ${{ parameters.buildConfig }} - helixQueueGroup: ${{ parameters.helixQueueGroup }} - crossBuild: true - disableClrTest: true - ${{ insert }}: ${{ parameters.jobParameters }} - -# Centos 7 x64 Source Build - -- ${{ if containsValue(parameters.platforms, 'SourceBuild_centos7_x64') }}: - - template: xplat-setup.yml - parameters: - jobTemplate: ${{ parameters.jobTemplate }} - helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} - variables: ${{ parameters.variables }} - osGroup: linux - archType: x64 - targetRid: centos.7-x64 - platform: centos7_linux_x64 - shouldContinueOnError: ${{ parameters.shouldContinueOnError }} - container: - image: centos-7-source-build - registry: mcr - jobParameters: - runtimeFlavor: ${{ parameters.runtimeFlavor }} - buildConfig: ${{ parameters.buildConfig }} - helixQueueGroup: ${{ parameters.helixQueueGroup }} - isSourceBuild: true - isNonPortableSourceBuild: true - ${{ insert }}: ${{ parameters.jobParameters }} - -# Non-existent RID Source Build - -- ${{ if containsValue(parameters.platforms, 'SourceBuild_banana24_x64') }}: - - template: xplat-setup.yml - parameters: - jobTemplate: ${{ parameters.jobTemplate }} - helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} - variables: ${{ parameters.variables }} - osGroup: linux - archType: x64 - targetRid: banana.24-x64 - platform: banana24_linux_x64 - shouldContinueOnError: ${{ parameters.shouldContinueOnError }} - container: - image: centos-7-source-build-20210714125450-5d87b80 - registry: mcr - jobParameters: - runtimeFlavor: ${{ parameters.runtimeFlavor }} - buildConfig: ${{ parameters.buildConfig }} - helixQueueGroup: ${{ parameters.helixQueueGroup }} - isSourceBuild: true - isNonPortableSourceBuild: true - ${{ insert }}: ${{ parameters.jobParameters }} - -# Portable Linux x64 Source Build - -- ${{ if containsValue(parameters.platforms, 'SourceBuild_linux_x64') }}: - - template: xplat-setup.yml - parameters: - jobTemplate: ${{ parameters.jobTemplate }} - helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} - variables: ${{ parameters.variables }} - osGroup: linux - archType: x64 - targetRid: linux-x64 - platform: linux_x64 - shouldContinueOnError: ${{ parameters.shouldContinueOnError }} - container: SourceBuild_linux_x64 - jobParameters: - runtimeFlavor: ${{ parameters.runtimeFlavor }} - buildConfig: ${{ parameters.buildConfig }} - helixQueueGroup: ${{ parameters.helixQueueGroup }} - isSourceBuild: true - isNonPortableSourceBuild: false - ${{ insert }}: ${{ parameters.jobParameters }} - -# Linux s390x - -- ${{ if containsValue(parameters.platforms, 'linux_s390x') }}: - - template: xplat-setup.yml - parameters: - jobTemplate: ${{ parameters.jobTemplate }} - helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} - variables: ${{ parameters.variables }} - osGroup: linux - archType: s390x - targetRid: linux-s390x - platform: linux_s390x - shouldContinueOnError: ${{ parameters.shouldContinueOnError }} - container: linux_s390x - jobParameters: - runtimeFlavor: ${{ parameters.runtimeFlavor }} - buildConfig: ${{ parameters.buildConfig }} - helixQueueGroup: ${{ parameters.helixQueueGroup }} - crossBuild: true - ${{ insert }}: ${{ parameters.jobParameters }} - -# Linux PPC64le - -- ${{ if containsValue(parameters.platforms, 'linux_ppc64le') }}: - - template: xplat-setup.yml - parameters: - jobTemplate: ${{ parameters.jobTemplate }} - helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} - variables: ${{ parameters.variables }} - osGroup: linux - archType: ppc64le - targetRid: linux-ppc64le - platform: linux_ppc64le - shouldContinueOnError: ${{ parameters.shouldContinueOnError }} - container: linux_ppc64le - jobParameters: - runtimeFlavor: ${{ parameters.runtimeFlavor }} - buildConfig: ${{ parameters.buildConfig }} - helixQueueGroup: ${{ parameters.helixQueueGroup }} - crossBuild: true - ${{ insert }}: ${{ parameters.jobParameters }} - # WASI WebAssembly - ${{ if containsValue(parameters.platforms, 'wasi_wasm') }}: @@ -398,488 +63,3 @@ jobs: stagedBuild: ${{ parameters.stagedBuild }} buildConfig: ${{ parameters.buildConfig }} ${{ insert }}: ${{ parameters.jobParameters }} - -# Browser WebAssembly - -- ${{ if containsValue(parameters.platforms, 'browser_wasm') }}: - - template: xplat-setup.yml - parameters: - jobTemplate: ${{ parameters.jobTemplate }} - helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} - variables: ${{ parameters.variables }} - osGroup: browser - archType: wasm - targetRid: browser-wasm - platform: browser_wasm - shouldContinueOnError: ${{ parameters.shouldContinueOnError }} - container: browser_wasm - jobParameters: - hostedOs: linux - runtimeFlavor: ${{ parameters.runtimeFlavor }} - buildConfig: ${{ parameters.buildConfig }} - ${{ insert }}: ${{ parameters.jobParameters }} - -# Browser WebAssembly Linux Firefox - -- ${{ if containsValue(parameters.platforms, 'browser_wasm_firefox') }}: - - template: xplat-setup.yml - parameters: - jobTemplate: ${{ parameters.jobTemplate }} - helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} - variables: ${{ parameters.variables }} - osGroup: browser - archType: wasm - targetRid: browser-wasm - platform: browser_wasm_firefox - shouldContinueOnError: ${{ parameters.shouldContinueOnError }} - container: browser_wasm - jobParameters: - hostedOs: linux - runtimeFlavor: ${{ parameters.runtimeFlavor }} - buildConfig: ${{ parameters.buildConfig }} - ${{ insert }}: ${{ parameters.jobParameters }} - -# Browser WebAssembly on Windows - -- ${{ if containsValue(parameters.platforms, 'browser_wasm_win') }}: - - template: xplat-setup.yml - parameters: - jobTemplate: ${{ parameters.jobTemplate }} - helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} - variables: ${{ parameters.variables }} - osGroup: browser - archType: wasm - targetRid: browser-wasm - platform: browser_wasm_win - shouldContinueOnError: ${{ parameters.shouldContinueOnError }} - jobParameters: - hostedOs: windows - runtimeFlavor: ${{ parameters.runtimeFlavor }} - buildConfig: ${{ parameters.buildConfig }} - ${{ insert }}: ${{ parameters.jobParameters }} - -# FreeBSD -- ${{ if containsValue(parameters.platforms, 'freebsd_x64') }}: - - template: xplat-setup.yml - parameters: - jobTemplate: ${{ parameters.jobTemplate }} - helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} - variables: ${{ parameters.variables }} - osGroup: freebsd - archType: x64 - targetRid: freebsd-x64 - platform: freebsd_x64 - shouldContinueOnError: ${{ parameters.shouldContinueOnError }} - container: freebsd_x64 - jobParameters: - runtimeFlavor: ${{ parameters.runtimeFlavor }} - buildConfig: ${{ parameters.buildConfig }} - helixQueueGroup: ${{ parameters.helixQueueGroup }} - crossBuild: true - ${{ insert }}: ${{ parameters.jobParameters }} - -# Android x64 - -- ${{ if containsValue(parameters.platforms, 'android_x64') }}: - - template: xplat-setup.yml - parameters: - jobTemplate: ${{ parameters.jobTemplate }} - helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} - variables: ${{ parameters.variables }} - osGroup: android - archType: x64 - targetRid: android-x64 - platform: android_x64 - shouldContinueOnError: ${{ parameters.shouldContinueOnError }} - container: linux_bionic - jobParameters: - runtimeFlavor: mono - buildConfig: ${{ parameters.buildConfig }} - helixQueueGroup: ${{ parameters.helixQueueGroup }} - ${{ insert }}: ${{ parameters.jobParameters }} - -# Android x86 - -- ${{ if containsValue(parameters.platforms, 'android_x86') }}: - - template: xplat-setup.yml - parameters: - jobTemplate: ${{ parameters.jobTemplate }} - helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} - variables: ${{ parameters.variables }} - osGroup: android - archType: x86 - targetRid: android-x86 - platform: android_x86 - shouldContinueOnError: ${{ parameters.shouldContinueOnError }} - container: linux_bionic - jobParameters: - runtimeFlavor: mono - buildConfig: ${{ parameters.buildConfig }} - helixQueueGroup: ${{ parameters.helixQueueGroup }} - ${{ insert }}: ${{ parameters.jobParameters }} - -# Android arm - -- ${{ if containsValue(parameters.platforms, 'android_arm') }}: - - template: xplat-setup.yml - parameters: - jobTemplate: ${{ parameters.jobTemplate }} - helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} - variables: ${{ parameters.variables }} - osGroup: android - archType: arm - targetRid: android-arm - platform: android_arm - shouldContinueOnError: ${{ parameters.shouldContinueOnError }} - container: linux_bionic - jobParameters: - runtimeFlavor: mono - buildConfig: ${{ parameters.buildConfig }} - helixQueueGroup: ${{ parameters.helixQueueGroup }} - ${{ insert }}: ${{ parameters.jobParameters }} - -# Android arm64 - -- ${{ if containsValue(parameters.platforms, 'android_arm64') }}: - - template: xplat-setup.yml - parameters: - jobTemplate: ${{ parameters.jobTemplate }} - helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} - variables: ${{ parameters.variables }} - osGroup: android - archType: arm64 - targetRid: android-arm64 - platform: android_arm64 - shouldContinueOnError: ${{ parameters.shouldContinueOnError }} - container: linux_bionic - jobParameters: - runtimeFlavor: mono - buildConfig: ${{ parameters.buildConfig }} - helixQueueGroup: ${{ parameters.helixQueueGroup }} - ${{ insert }}: ${{ parameters.jobParameters }} - -# Mac Catalyst x64 - -- ${{ if containsValue(parameters.platforms, 'maccatalyst_x64') }}: - - template: xplat-setup.yml - parameters: - jobTemplate: ${{ parameters.jobTemplate }} - helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} - variables: ${{ parameters.variables }} - osGroup: maccatalyst - archType: x64 - targetRid: maccatalyst-x64 - platform: maccatalyst_x64 - shouldContinueOnError: ${{ parameters.shouldContinueOnError }} - jobParameters: - runtimeFlavor: mono - buildConfig: ${{ parameters.buildConfig }} - helixQueueGroup: ${{ parameters.helixQueueGroup }} - ${{ insert }}: ${{ parameters.jobParameters }} - -# Mac Catalyst arm64 - -- ${{ if containsValue(parameters.platforms, 'maccatalyst_arm64') }}: - - template: xplat-setup.yml - parameters: - jobTemplate: ${{ parameters.jobTemplate }} - helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} - variables: ${{ parameters.variables }} - osGroup: maccatalyst - archType: arm64 - targetRid: maccatalyst-arm64 - platform: maccatalyst_arm64 - shouldContinueOnError: ${{ parameters.shouldContinueOnError }} - jobParameters: - runtimeFlavor: mono - buildConfig: ${{ parameters.buildConfig }} - helixQueueGroup: ${{ parameters.helixQueueGroup }} - ${{ insert }}: ${{ parameters.jobParameters }} - -# tvOS arm64 - -- ${{ if containsValue(parameters.platforms, 'tvos_arm64') }}: - - template: xplat-setup.yml - parameters: - jobTemplate: ${{ parameters.jobTemplate }} - helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} - variables: ${{ parameters.variables }} - osGroup: tvos - archType: arm64 - targetRid: tvos-arm64 - platform: tvos_arm64 - shouldContinueOnError: ${{ parameters.shouldContinueOnError }} - jobParameters: - runtimeFlavor: mono - buildConfig: ${{ parameters.buildConfig }} - helixQueueGroup: ${{ parameters.helixQueueGroup }} - ${{ insert }}: ${{ parameters.jobParameters }} - -# tvOS Simulator x64 - -- ${{ if containsValue(parameters.platforms, 'tvossimulator_x64') }}: - - template: xplat-setup.yml - parameters: - jobTemplate: ${{ parameters.jobTemplate }} - helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} - variables: ${{ parameters.variables }} - osGroup: tvossimulator - archType: x64 - targetRid: tvossimulator-x64 - platform: tvossimulator_x64 - shouldContinueOnError: ${{ parameters.shouldContinueOnError }} - jobParameters: - runtimeFlavor: mono - buildConfig: ${{ parameters.buildConfig }} - helixQueueGroup: ${{ parameters.helixQueueGroup }} - ${{ insert }}: ${{ parameters.jobParameters }} - -# tvOS Simulator arm64 - -- ${{ if containsValue(parameters.platforms, 'tvossimulator_arm64') }}: - - template: xplat-setup.yml - parameters: - jobTemplate: ${{ parameters.jobTemplate }} - helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} - variables: ${{ parameters.variables }} - osGroup: tvossimulator - archType: arm64 - targetRid: tvossimulator-arm64 - platform: tvossimulator_arm64 - shouldContinueOnError: ${{ parameters.shouldContinueOnError }} - jobParameters: - runtimeFlavor: mono - buildConfig: ${{ parameters.buildConfig }} - helixQueueGroup: ${{ parameters.helixQueueGroup }} - ${{ insert }}: ${{ parameters.jobParameters }} - -# iOS arm - -- ${{ if containsValue(parameters.platforms, 'ios_arm') }}: - - template: xplat-setup.yml - parameters: - jobTemplate: ${{ parameters.jobTemplate }} - helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} - variables: ${{ parameters.variables }} - osGroup: ios - archType: arm - targetRid: ios-arm - platform: ios_arm - shouldContinueOnError: ${{ parameters.shouldContinueOnError }} - jobParameters: - runtimeFlavor: mono - buildConfig: ${{ parameters.buildConfig }} - helixQueueGroup: ${{ parameters.helixQueueGroup }} - ${{ insert }}: ${{ parameters.jobParameters }} - -# iOS arm64 - -- ${{ if containsValue(parameters.platforms, 'ios_arm64') }}: - - template: xplat-setup.yml - parameters: - jobTemplate: ${{ parameters.jobTemplate }} - helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} - variables: ${{ parameters.variables }} - osGroup: ios - archType: arm64 - targetRid: ios-arm64 - platform: ios_arm64 - shouldContinueOnError: ${{ parameters.shouldContinueOnError }} - jobParameters: - runtimeFlavor: mono - buildConfig: ${{ parameters.buildConfig }} - helixQueueGroup: ${{ parameters.helixQueueGroup }} - ${{ insert }}: ${{ parameters.jobParameters }} - -# iOS Simulator x64 - -- ${{ if containsValue(parameters.platforms, 'iossimulator_x64') }}: - - template: xplat-setup.yml - parameters: - jobTemplate: ${{ parameters.jobTemplate }} - helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} - variables: ${{ parameters.variables }} - osGroup: iossimulator - archType: x64 - targetRid: iossimulator-x64 - platform: iossimulator_x64 - shouldContinueOnError: ${{ parameters.shouldContinueOnError }} - jobParameters: - runtimeFlavor: mono - buildConfig: ${{ parameters.buildConfig }} - helixQueueGroup: ${{ parameters.helixQueueGroup }} - ${{ insert }}: ${{ parameters.jobParameters }} - -# iOS Simulator x86 - -- ${{ if containsValue(parameters.platforms, 'iossimulator_x86') }}: - - template: xplat-setup.yml - parameters: - jobTemplate: ${{ parameters.jobTemplate }} - helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} - variables: ${{ parameters.variables }} - osGroup: iossimulator - archType: x86 - targetRid: iossimulator-x86 - platform: iossimulator_x86 - shouldContinueOnError: ${{ parameters.shouldContinueOnError }} - jobParameters: - runtimeFlavor: mono - buildConfig: ${{ parameters.buildConfig }} - helixQueueGroup: ${{ parameters.helixQueueGroup }} - ${{ insert }}: ${{ parameters.jobParameters }} - -# iOS Simulator arm64 - -- ${{ if containsValue(parameters.platforms, 'iossimulator_arm64') }}: - - template: xplat-setup.yml - parameters: - jobTemplate: ${{ parameters.jobTemplate }} - helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} - variables: ${{ parameters.variables }} - osGroup: iossimulator - archType: arm64 - targetRid: iossimulator-arm64 - platform: iossimulator_arm64 - shouldContinueOnError: ${{ parameters.shouldContinueOnError }} - jobParameters: - runtimeFlavor: mono - buildConfig: ${{ parameters.buildConfig }} - helixQueueGroup: ${{ parameters.helixQueueGroup }} - ${{ insert }}: ${{ parameters.jobParameters }} - -# macOS arm64 - -- ${{ if containsValue(parameters.platforms, 'osx_arm64') }}: - - template: xplat-setup.yml - parameters: - jobTemplate: ${{ parameters.jobTemplate }} - helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} - variables: ${{ parameters.variables }} - osGroup: osx - archType: arm64 - targetRid: osx-arm64 - platform: osx_arm64 - shouldContinueOnError: ${{ parameters.shouldContinueOnError }} - jobParameters: - runtimeFlavor: ${{ parameters.runtimeFlavor }} - buildConfig: ${{ parameters.buildConfig }} - helixQueueGroup: ${{ parameters.helixQueueGroup }} - crossBuild: true - ${{ insert }}: ${{ parameters.jobParameters }} - -# macOS x64 - -- ${{ if or(containsValue(parameters.platforms, 'osx_x64'), eq(parameters.platformGroup, 'all')) }}: - - template: xplat-setup.yml - parameters: - jobTemplate: ${{ parameters.jobTemplate }} - helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} - variables: ${{ parameters.variables }} - osGroup: osx - archType: x64 - targetRid: osx-x64 - platform: osx_x64 - shouldContinueOnError: ${{ parameters.shouldContinueOnError }} - jobParameters: - runtimeFlavor: ${{ parameters.runtimeFlavor }} - buildConfig: ${{ parameters.buildConfig }} - helixQueueGroup: ${{ parameters.helixQueueGroup }} - ${{ insert }}: ${{ parameters.jobParameters }} - -# Tizen armel - -- ${{ if containsValue(parameters.platforms, 'tizen_armel') }}: - - template: xplat-setup.yml - parameters: - jobTemplate: ${{ parameters.jobTemplate }} - helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} - variables: ${{ parameters.variables }} - osGroup: tizen - archType: armel - targetRid: tizen-armel - platform: tizen_armel - shouldContinueOnError: ${{ parameters.shouldContinueOnError }} - container: tizen_armel - jobParameters: - runtimeFlavor: ${{ parameters.runtimeFlavor }} - buildConfig: ${{ parameters.buildConfig }} - helixQueueGroup: ${{ parameters.helixQueueGroup }} - crossBuild: true - disableClrTest: true - ${{ insert }}: ${{ parameters.jobParameters }} - -# Windows x64 - -- ${{ if or(containsValue(parameters.platforms, 'windows_x64'), in(parameters.platformGroup, 'all', 'gcstress')) }}: - - template: xplat-setup.yml - parameters: - jobTemplate: ${{ parameters.jobTemplate }} - helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} - variables: ${{ parameters.variables }} - osGroup: windows - archType: x64 - targetRid: win-x64 - platform: windows_x64 - shouldContinueOnError: ${{ parameters.shouldContinueOnError }} - jobParameters: - runtimeFlavor: ${{ parameters.runtimeFlavor }} - buildConfig: ${{ parameters.buildConfig }} - helixQueueGroup: ${{ parameters.helixQueueGroup }} - ${{ insert }}: ${{ parameters.jobParameters }} - -# Windows x86 - -- ${{ if or(containsValue(parameters.platforms, 'windows_x86'), in(parameters.platformGroup, 'all', 'gcstress')) }}: - - template: xplat-setup.yml - parameters: - jobTemplate: ${{ parameters.jobTemplate }} - helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} - variables: ${{ parameters.variables }} - osGroup: windows - archType: x86 - targetRid: win-x86 - platform: windows_x86 - shouldContinueOnError: ${{ parameters.shouldContinueOnError }} - jobParameters: - runtimeFlavor: ${{ parameters.runtimeFlavor }} - buildConfig: ${{ parameters.buildConfig }} - helixQueueGroup: ${{ parameters.helixQueueGroup }} - ${{ insert }}: ${{ parameters.jobParameters }} - -# Windows arm -- ${{ if or(containsValue(parameters.platforms, 'windows_arm'), eq(parameters.platformGroup, 'all')) }}: - - template: xplat-setup.yml - parameters: - jobTemplate: ${{ parameters.jobTemplate }} - helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} - variables: ${{ parameters.variables }} - osGroup: windows - archType: arm - targetRid: win-arm - platform: windows_arm - shouldContinueOnError: ${{ parameters.shouldContinueOnError }} - jobParameters: - runtimeFlavor: ${{ parameters.runtimeFlavor }} - buildConfig: ${{ parameters.buildConfig }} - helixQueueGroup: ${{ parameters.helixQueueGroup }} - ${{ insert }}: ${{ parameters.jobParameters }} - -# Windows arm64 - -- ${{ if or(containsValue(parameters.platforms, 'windows_arm64'), in(parameters.platformGroup, 'all', 'gcstress')) }}: - - template: xplat-setup.yml - parameters: - jobTemplate: ${{ parameters.jobTemplate }} - helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} - variables: ${{ parameters.variables }} - osGroup: windows - archType: arm64 - targetRid: win-arm64 - platform: windows_arm64 - shouldContinueOnError: ${{ parameters.shouldContinueOnError }} - jobParameters: - runtimeFlavor: ${{ parameters.runtimeFlavor }} - buildConfig: ${{ parameters.buildConfig }} - helixQueueGroup: ${{ parameters.helixQueueGroup }} - ${{ insert }}: ${{ parameters.jobParameters }} diff --git a/eng/pipelines/runtime.yml b/eng/pipelines/runtime.yml index d37e3641de44a3..ad80ea99870705 100644 --- a/eng/pipelines/runtime.yml +++ b/eng/pipelines/runtime.yml @@ -462,9 +462,18 @@ extends: platforms: - wasi_wasm - wasi_wasm_win - nameSuffix: '_Smoke' + nameSuffix: _Relinking extraBuildArgs: /p:EnableAggressiveTrimming=true /p:RunWasmSamples=true - shouldRunSmokeOnly: true + alwaysRun: ${{ variables.isRollingBuild }} + scenarios: + - normal + + - template: /eng/pipelines/common/templates/wasm-library-tests.yml + parameters: + platforms: + - wasi_wasm + - wasi_wasm_win + extraBuildArgs: /p:RunWasmSamples=true alwaysRun: ${{ variables.isRollingBuild }} scenarios: - normal From dec938c7dee1536d69b039a192cbf2065380c465 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Sat, 4 Feb 2023 23:59:22 +0000 Subject: [PATCH 04/41] wasi: fix command line for tests --- eng/testing/tests.wasi.targets | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/eng/testing/tests.wasi.targets b/eng/testing/tests.wasi.targets index cbb15f6dc78bc5..85c17257a9ffbe 100644 --- a/eng/testing/tests.wasi.targets +++ b/eng/testing/tests.wasi.targets @@ -61,9 +61,10 @@ <_AppArgs Condition="'$(WasmSingleFileBundle)' == 'true'">$([System.IO.Path]::GetFileNameWithoutExtension('$(WasmMainAssemblyFileName)')).wasm - <_AppArgs Condition="'$(WasmSingleFileBundle)' != 'true'">dotnet.wasm + <_AppArgs Condition="'$(WasmSingleFileBundle)' != 'true'">dotnet.wasm WasmTestRunner - <_AppArgs Condition="'$(IsFunctionalTest)' != 'true'">$(_AppArgs) $(AssemblyName).dll + <_AppArgs Condition="'$(IsFunctionalTest)' != 'true' and '$(WasmSingleFileBundle)' != 'true'">$(_AppArgs) managed/$(AssemblyName).dll + <_AppArgs Condition="'$(IsFunctionalTest)' != 'true' and '$(WasmSingleFileBundle)' == 'true'">$(_AppArgs) $(AssemblyName).dll <_AppArgs Condition="'$(WasmTestAppArgs)' != ''">$(_AppArgs) -- $(WasmTestAppArgs) @@ -74,10 +75,7 @@ <_XHarnessArgs Condition="'$(OS)' != 'Windows_NT'">wasi $XHARNESS_COMMAND --app=. --output-directory=$XHARNESS_OUT <_XHarnessArgs Condition="'$(OS)' == 'Windows_NT'">wasi %XHARNESS_COMMAND% --app=. --output-directory=%XHARNESS_OUT% - - <_XHarnessArgs Condition="'$(OS)' == 'Windows_NT' and '$(ContinuousIntegrationBuild)' != 'true'">$(_XHarnessArgs) --wasm-engine-path=$(WasmtimeDir)wasmtime.exe - <_XHarnessArgs Condition="'$(OS)' == 'Windows_NT' and '$(ContinuousIntegrationBuild)' == 'true'">$(_XHarnessArgs) --wasm-engine-path=%HELIX_CORRELATION_PAYLOAD%\wasmtime\wasmtime.exe - + <_XHarnessArgs Condition="'$(WasmSingleFileBundle)' != 'true'" >$(_XHarnessArgs) --engine-arg=--dir=. <_XHarnessArgs Condition="'$(IsFunctionalTest)' == 'true'" >$(_XHarnessArgs) --expected-exit-code=$(ExpectedExitCode) <_XHarnessArgs Condition="'$(WasmXHarnessArgs)' != ''" >$(_XHarnessArgs) $(WasmXHarnessArgs) <_XHarnessArgs Condition="'$(_XHarnessTestsTimeout)' != '' " >$(_XHarnessArgs) "--timeout=$(_XHarnessTestsTimeout)" From ae474c36cc10b2346e1a327b66e586ab4505691c Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Sun, 5 Feb 2023 21:30:02 -0500 Subject: [PATCH 05/41] Bring back the workaround for xharness, as the fix hasn't been merged in runtime yet --- eng/testing/tests.wasi.targets | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/eng/testing/tests.wasi.targets b/eng/testing/tests.wasi.targets index 85c17257a9ffbe..5cfcef5eb9ebdc 100644 --- a/eng/testing/tests.wasi.targets +++ b/eng/testing/tests.wasi.targets @@ -75,6 +75,10 @@ <_XHarnessArgs Condition="'$(OS)' != 'Windows_NT'">wasi $XHARNESS_COMMAND --app=. --output-directory=$XHARNESS_OUT <_XHarnessArgs Condition="'$(OS)' == 'Windows_NT'">wasi %XHARNESS_COMMAND% --app=. --output-directory=%XHARNESS_OUT% + + <_XHarnessArgs Condition="'$(OS)' == 'Windows_NT' and '$(ContinuousIntegrationBuild)' != 'true'">$(_XHarnessArgs) --wasm-engine-path=$(WasmtimeDir)wasmtime.exe + <_XHarnessArgs Condition="'$(OS)' == 'Windows_NT' and '$(ContinuousIntegrationBuild)' == 'true'">$(_XHarnessArgs) --wasm-engine-path=%HELIX_CORRELATION_PAYLOAD%\wasmtime\wasmtime.exe + <_XHarnessArgs Condition="'$(WasmSingleFileBundle)' != 'true'" >$(_XHarnessArgs) --engine-arg=--dir=. <_XHarnessArgs Condition="'$(IsFunctionalTest)' == 'true'" >$(_XHarnessArgs) --expected-exit-code=$(ExpectedExitCode) <_XHarnessArgs Condition="'$(WasmXHarnessArgs)' != ''" >$(_XHarnessArgs) $(WasmXHarnessArgs) From 33ca0c07309e1c40c5944307d784685cdef7ef04 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Thu, 23 Feb 2023 22:23:06 +0000 Subject: [PATCH 06/41] Correctly set rid for ilproj on wasi --- Directory.Build.props | 6 +++--- .../System.Runtime/tests/System.Runtime.Tests.csproj | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 155df6caf76e24..7d3052b6942f0f 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -223,9 +223,9 @@ <_toolsRID Condition="'$(_toolsRID)' == ''">$(_runtimeOS)-$(_hostArch) - <_toolsRID Condition="'$(_runtimeOS)' == 'browser'">linux-x64 - <_toolsRID Condition="'$(_runtimeOS)' == 'browser' and '$(HostOS)' == 'windows'">win-x64 - <_toolsRID Condition="'$(_runtimeOS)' == 'browser' and '$(HostOS)' == 'osx'">osx-x64 + <_toolsRID Condition="'$(_runtimeOS)' == 'browser' or '$(_runtimeOS)' == 'wasi'">linux-x64 + <_toolsRID Condition="('$(_runtimeOS)' == 'browser' or '$(_runtimeOS)' == 'wasi') and '$(HostOS)' == 'windows'">win-x64 + <_toolsRID Condition="('$(_runtimeOS)' == 'browser' or '$(_runtimeOS)' == 'wasi') and '$(HostOS)' == 'osx'">osx-x64 <_toolsRID Condition="'$(_runtimeOS)' == 'android' or '$(_runtimeOS)' == 'linux-bionic'">linux-x64 diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests.csproj b/src/libraries/System.Runtime/tests/System.Runtime.Tests.csproj index 8be0ce5839a3c8..12f8820bef3775 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests.csproj +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests.csproj @@ -338,11 +338,11 @@ - + - - + + From 6589ebed1a56858e9f8bc3ffce4df8eb3a982542 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Fri, 24 Feb 2023 05:29:42 +0000 Subject: [PATCH 07/41] [wasi] Disable `System.Formats.Cbor.Tests.CborWriterTests` - crypto not .. supported. ``` [00:52:00] fail: [FAIL] System.Formats.Cbor.Tests.CborWriterTests.CoseKeyHelpers_ECDsaExportCosePublicKey_HappyPath(expectedHexEncoding: "a501020326200121582065eda5a12577c2bae829437fe33870"..., hexQx: "65eda5a12577c2bae829437fe338701a10aaa375e1bb5b5de1"..., hexQy: "1e52ed75701163f7f9e40ddf9f341b3dc9ba860af7e0ca7ca7"..., hashAlgorithmName: "SHA256", curveFriendlyName: "ECDSA_P256") [00:52:00] info: System.PlatformNotSupportedException : System.Security.Cryptography is not supported on this platform. [00:52:00] info: at System.Security.Cryptography.HashAlgorithmName..ctor(String name) [00:52:00] info: at System.Formats.Cbor.Tests.CborWriterTests.CoseKeyHelpers_ECDsaExportCosePublicKey_HappyPath(String expectedHexEncoding, String hexQx, String hexQy, String hashAlgorithmName, String curveFriendlyName) [00:52:00] info: at System.Reflection.MethodInvoker.InterpretedInvoke(Object obj, IntPtr* args) [00:52:00] info: at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr) ``` --- .../System.Formats.Cbor/tests/Writer/CborWriterTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/System.Formats.Cbor/tests/Writer/CborWriterTests.cs b/src/libraries/System.Formats.Cbor/tests/Writer/CborWriterTests.cs index d0eb7f5fb876bb..28faa0ecddc4cd 100644 --- a/src/libraries/System.Formats.Cbor/tests/Writer/CborWriterTests.cs +++ b/src/libraries/System.Formats.Cbor/tests/Writer/CborWriterTests.cs @@ -339,7 +339,7 @@ public static void InvalidConformanceMode_ShouldThrowArgumentOutOfRangeException public static IEnumerable EncodedValueBadInputs => CborReaderTests.InvalidCborValues.Select(x => new[] { x }); [Theory] - [ActiveIssue("https://github.com/dotnet/runtime/issues/37669", TestPlatforms.Browser)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/37669", TestPlatforms.Browser | TestPlatforms.Wasi)] [InlineData("a501020326200121582065eda5a12577c2bae829437fe338701a10aaa375e1bb5b5de108de439c08551d2258201e52ed75701163f7f9e40ddf9f341b3dc9ba860af7e0ca7ca7e9eecd0084d19c", "65eda5a12577c2bae829437fe338701a10aaa375e1bb5b5de108de439c08551d", "1e52ed75701163f7f9e40ddf9f341b3dc9ba860af7e0ca7ca7e9eecd0084d19c", From 8e311c1d057fe4407f9827e72c31c31afaea2471 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Fri, 24 Feb 2023 05:33:57 +0000 Subject: [PATCH 08/41] disable wbt, and relinking tests --- eng/pipelines/runtime.yml | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/eng/pipelines/runtime.yml b/eng/pipelines/runtime.yml index 24c9ce9a402d1e..38a55056d8a40b 100644 --- a/eng/pipelines/runtime.yml +++ b/eng/pipelines/runtime.yml @@ -498,16 +498,16 @@ extends: # WASI/WASM - - template: /eng/pipelines/common/templates/wasm-library-tests.yml - parameters: - platforms: - - wasi_wasm - - wasi_wasm_win - nameSuffix: _Relinking - extraBuildArgs: /p:EnableAggressiveTrimming=true /p:RunWasmSamples=true - alwaysRun: true - scenarios: - - normal + #- template: /eng/pipelines/common/templates/wasm-library-tests.yml + #parameters: + #platforms: + #- wasi_wasm + #- wasi_wasm_win + #nameSuffix: _Relinking + #extraBuildArgs: /p:EnableAggressiveTrimming=true /p:RunWasmSamples=true + #alwaysRun: true + #scenarios: + #- normal - template: /eng/pipelines/common/templates/wasm-library-tests.yml parameters: @@ -520,12 +520,12 @@ extends: scenarios: - normal - - template: /eng/pipelines/common/templates/wasm-build-tests.yml - parameters: - platforms: - - wasi_wasm - - wasi_wasm_win - alwaysRun: ${{ variables.isRollingBuild }} + #- template: /eng/pipelines/common/templates/wasm-build-tests.yml + #parameters: + #platforms: + #- wasi_wasm + #- wasi_wasm_win + #alwaysRun: ${{ variables.isRollingBuild }} # # iOS/tvOS devices - Full AOT + AggressiveTrimming to reduce size From e4080919f2d7691aeb78c99bde72b3b35db3a517 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Fri, 24 Feb 2023 06:49:18 +0000 Subject: [PATCH 09/41] Enable assert messages for wasi --- src/mono/mono.proj | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mono/mono.proj b/src/mono/mono.proj index d6a4a8fbdee567..2ff33c14763b7d 100644 --- a/src/mono/mono.proj +++ b/src/mono/mono.proj @@ -55,6 +55,7 @@ false true true + true From 9e1c812088768a2b11b4c503453bd4ff6deb3d20 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Fri, 24 Feb 2023 06:52:53 +0000 Subject: [PATCH 10/41] [wasi] Disable crypto tests - https://github.com/dotnet/runtime/issues/37669 --- src/libraries/tests.proj | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/libraries/tests.proj b/src/libraries/tests.proj index 4fd91574273a9a..15c1c226ab8878 100644 --- a/src/libraries/tests.proj +++ b/src/libraries/tests.proj @@ -345,6 +345,11 @@ + + + + + @@ -356,9 +361,6 @@ - - - From 58fe14a53749579ad18209b6a84e2c87c057df22 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Fri, 24 Feb 2023 15:57:31 +0000 Subject: [PATCH 11/41] [wasi] Disable `System.Net.Requests.Tests` .. same as for browser. --- src/libraries/System.Net.Requests/Directory.Build.props | 4 ++-- src/libraries/System.Net.Requests/tests/AssemblyInfo.cs | 1 + .../tests/System.Net.Requests.Tests.csproj | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/libraries/System.Net.Requests/Directory.Build.props b/src/libraries/System.Net.Requests/Directory.Build.props index ce244cbea56199..e3cd1bcddea8ee 100644 --- a/src/libraries/System.Net.Requests/Directory.Build.props +++ b/src/libraries/System.Net.Requests/Directory.Build.props @@ -3,6 +3,6 @@ Microsoft true - browser + browser;wasi - \ No newline at end of file + diff --git a/src/libraries/System.Net.Requests/tests/AssemblyInfo.cs b/src/libraries/System.Net.Requests/tests/AssemblyInfo.cs index ef5fa4660024d7..350d945ef0a7da 100644 --- a/src/libraries/System.Net.Requests/tests/AssemblyInfo.cs +++ b/src/libraries/System.Net.Requests/tests/AssemblyInfo.cs @@ -5,3 +5,4 @@ using Xunit; [assembly: SkipOnPlatform(TestPlatforms.Browser, "System.Net.Requests is not supported on Browser.")] +[assembly: SkipOnPlatform(TestPlatforms.Wasi, "System.Net.Requests is not supported on Browser.")] diff --git a/src/libraries/System.Net.Requests/tests/System.Net.Requests.Tests.csproj b/src/libraries/System.Net.Requests/tests/System.Net.Requests.Tests.csproj index 1a2818addac82b..cec704c5ffdcc0 100644 --- a/src/libraries/System.Net.Requests/tests/System.Net.Requests.Tests.csproj +++ b/src/libraries/System.Net.Requests/tests/System.Net.Requests.Tests.csproj @@ -4,7 +4,7 @@ true $(NetCoreAppCurrent) $(DefineConstants);NETSTANDARD - true + true $(NoWarn);SYSLIB0014 true From ec5ebb33b9efab86779b07a16493e9c5fea2e5f0 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Fri, 24 Feb 2023 16:21:03 +0000 Subject: [PATCH 12/41] [wasi] Mark some libraries, and tests as not supported The following tests get `SkipOnPlatform` for wasi, same as browser. ``` Microsoft.NETCore.Platforms/tests/AssemblyInfo.cs System.Configuration.ConfigurationManager/tests/AssemblyInfo.cs System.Diagnostics.FileVersionInfo/tests/System.Diagnostics.FileVersionInfo.Tests/AssemblyInfo.cs System.Diagnostics.Process/tests/AssemblyInfo.cs System.Drawing.Common/tests/AssemblyInfo.cs System.IO.Compression.Brotli/tests/AssemblyInfo.cs System.IO.FileSystem.Watcher/tests/AssemblyInfo.cs System.IO.IsolatedStorage/tests/AssemblyInfo.cs System.IO.Pipes/tests/AssemblyInfo.cs System.Net.HttpListener/tests/AssemblyInfo.cs System.Net.NameResolution/tests/FunctionalTests/AssemblyInfo.cs System.Net.NameResolution/tests/PalTests/AssemblyInfo.cs System.Net.NetworkInformation/tests/FunctionalTests/AssemblyInfo.cs System.Net.Ping/tests/FunctionalTests/AssemblyInfo.cs System.Net.Requests/tests/AssemblyInfo.cs System.Net.Security/tests/FunctionalTests/AssemblyInfo.cs System.Net.Security/tests/UnitTests/AssemblyInfo.cs System.Net.Sockets/tests/FunctionalTests/AssemblyInfo.cs System.Net.WebClient/tests/AssemblyInfo.cs ``` The following libraries get `` for wasi, same as browser: ``` System.CodeDom/Directory.Build.props System.Configuration.ConfigurationManager/Directory.Build.props System.Data.Odbc/Directory.Build.props System.Diagnostics.FileVersionInfo/Directory.Build.props System.Diagnostics.Process/Directory.Build.props System.DirectoryServices.Protocols/Directory.Build.props System.IO.Compression.Brotli/Directory.Build.props System.IO.FileSystem.Watcher/Directory.Build.props System.IO.IsolatedStorage/Directory.Build.props System.IO.Pipes/Directory.Build.props System.IO.Ports/Directory.Build.props System.Net.HttpListener/Directory.Build.props System.Net.NameResolution/Directory.Build.props System.Net.NetworkInformation/Directory.Build.props System.Net.Ping/Directory.Build.props System.Net.Security/Directory.Build.props System.Net.Sockets/Directory.Build.props System.Net.WebClient/Directory.Build.props System.Runtime.Serialization.Schema/Directory.Build.props System.Security.Cryptography.Cose/Directory.Build.props System.Security.Cryptography.Csp/Directory.Build.props System.Security.Cryptography.Encoding/Directory.Build.props System.Security.Cryptography.OpenSsl/Directory.Build.props System.Security.Cryptography.Pkcs/Directory.Build.props System.Security.Cryptography.X509Certificates/Directory.Build.props System.Security.Cryptography.Xml/Directory.Build.props ``` --- .../Microsoft.NETCore.Platforms/tests/AssemblyInfo.cs | 2 +- src/libraries/System.CodeDom/Directory.Build.props | 4 ++-- .../Directory.Build.props | 4 ++-- .../tests/AssemblyInfo.cs | 2 +- src/libraries/System.Data.Odbc/Directory.Build.props | 4 ++-- .../System.Diagnostics.FileVersionInfo/Directory.Build.props | 4 ++-- .../System.Diagnostics.FileVersionInfo.Tests/AssemblyInfo.cs | 2 +- .../System.Diagnostics.Process/Directory.Build.props | 4 ++-- .../System.Diagnostics.Process/tests/AssemblyInfo.cs | 2 +- .../System.DirectoryServices.Protocols/Directory.Build.props | 2 +- src/libraries/System.Drawing.Common/tests/AssemblyInfo.cs | 2 +- .../System.IO.Compression.Brotli/Directory.Build.props | 4 ++-- .../System.IO.Compression.Brotli/tests/AssemblyInfo.cs | 2 +- .../System.IO.FileSystem.Watcher/Directory.Build.props | 4 ++-- .../System.IO.FileSystem.Watcher/tests/AssemblyInfo.cs | 2 +- src/libraries/System.IO.IsolatedStorage/Directory.Build.props | 4 ++-- src/libraries/System.IO.IsolatedStorage/tests/AssemblyInfo.cs | 2 +- src/libraries/System.IO.Pipes/Directory.Build.props | 4 ++-- src/libraries/System.IO.Pipes/tests/AssemblyInfo.cs | 2 +- src/libraries/System.IO.Ports/Directory.Build.props | 2 +- src/libraries/System.Net.HttpListener/Directory.Build.props | 4 ++-- src/libraries/System.Net.HttpListener/tests/AssemblyInfo.cs | 2 +- src/libraries/System.Net.NameResolution/Directory.Build.props | 4 ++-- .../tests/FunctionalTests/AssemblyInfo.cs | 2 +- .../System.Net.NameResolution/tests/PalTests/AssemblyInfo.cs | 2 +- .../System.Net.NetworkInformation/Directory.Build.props | 4 ++-- .../tests/FunctionalTests/AssemblyInfo.cs | 2 +- src/libraries/System.Net.Ping/Directory.Build.props | 4 ++-- .../System.Net.Ping/tests/FunctionalTests/AssemblyInfo.cs | 2 +- src/libraries/System.Net.Requests/tests/AssemblyInfo.cs | 3 +-- src/libraries/System.Net.Security/Directory.Build.props | 4 ++-- .../System.Net.Security/tests/FunctionalTests/AssemblyInfo.cs | 2 +- .../System.Net.Security/tests/UnitTests/AssemblyInfo.cs | 2 +- src/libraries/System.Net.Sockets/Directory.Build.props | 4 ++-- .../System.Net.Sockets/tests/FunctionalTests/AssemblyInfo.cs | 2 +- src/libraries/System.Net.WebClient/Directory.Build.props | 4 ++-- src/libraries/System.Net.WebClient/tests/AssemblyInfo.cs | 2 +- .../System.Runtime.Serialization.Schema/Directory.Build.props | 2 +- .../System.Security.Cryptography.Cose/Directory.Build.props | 2 +- .../System.Security.Cryptography.Csp/Directory.Build.props | 4 ++-- .../Directory.Build.props | 4 ++-- .../Directory.Build.props | 2 +- .../System.Security.Cryptography.Pkcs/Directory.Build.props | 2 +- .../Directory.Build.props | 4 ++-- .../System.Security.Cryptography.Xml/Directory.Build.props | 4 ++-- 45 files changed, 65 insertions(+), 66 deletions(-) diff --git a/src/libraries/Microsoft.NETCore.Platforms/tests/AssemblyInfo.cs b/src/libraries/Microsoft.NETCore.Platforms/tests/AssemblyInfo.cs index f5a33895866d57..eb5229f0807afa 100644 --- a/src/libraries/Microsoft.NETCore.Platforms/tests/AssemblyInfo.cs +++ b/src/libraries/Microsoft.NETCore.Platforms/tests/AssemblyInfo.cs @@ -3,4 +3,4 @@ using Xunit; -[assembly: SkipOnPlatform(TestPlatforms.Browser, "MSBuild is not supported on Browser")] \ No newline at end of file +[assembly: SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.Wasi, "MSBuild is not supported on Browser/Wasi")] diff --git a/src/libraries/System.CodeDom/Directory.Build.props b/src/libraries/System.CodeDom/Directory.Build.props index 72712f3351c120..f67a0aa8ec2e4e 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.Configuration.ConfigurationManager/Directory.Build.props b/src/libraries/System.Configuration.ConfigurationManager/Directory.Build.props index c843a6347ce61c..d13e60dc1f0132 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.Configuration.ConfigurationManager/tests/AssemblyInfo.cs b/src/libraries/System.Configuration.ConfigurationManager/tests/AssemblyInfo.cs index 466b1c19ece27f..0f19f107894c67 100644 --- a/src/libraries/System.Configuration.ConfigurationManager/tests/AssemblyInfo.cs +++ b/src/libraries/System.Configuration.ConfigurationManager/tests/AssemblyInfo.cs @@ -6,4 +6,4 @@ [assembly: CollectionBehavior(DisableTestParallelization = true, MaxParallelThreads = 1)] -[assembly: SkipOnPlatform(TestPlatforms.Browser, "System.Configuration.ConfigurationManager is not supported on Browser")] +[assembly: SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.Wasi, "System.Configuration.ConfigurationManager is not supported on Browser/Wasi")] diff --git a/src/libraries/System.Data.Odbc/Directory.Build.props b/src/libraries/System.Data.Odbc/Directory.Build.props index c843a6347ce61c..d13e60dc1f0132 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.FileVersionInfo/Directory.Build.props b/src/libraries/System.Diagnostics.FileVersionInfo/Directory.Build.props index ce244cbea56199..e3cd1bcddea8ee 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.FileVersionInfo/tests/System.Diagnostics.FileVersionInfo.Tests/AssemblyInfo.cs b/src/libraries/System.Diagnostics.FileVersionInfo/tests/System.Diagnostics.FileVersionInfo.Tests/AssemblyInfo.cs index d96dcc30ef2bbe..5505a2a6252488 100644 --- a/src/libraries/System.Diagnostics.FileVersionInfo/tests/System.Diagnostics.FileVersionInfo.Tests/AssemblyInfo.cs +++ b/src/libraries/System.Diagnostics.FileVersionInfo/tests/System.Diagnostics.FileVersionInfo.Tests/AssemblyInfo.cs @@ -3,4 +3,4 @@ using Xunit; -[assembly: SkipOnPlatform(TestPlatforms.Browser, "System.Diagnostics.FileVersionInfo is not supported on Browser.")] +[assembly: SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.Wasi, "System.Diagnostics.FileVersionInfo is not supported on Browser/Wasi.")] diff --git a/src/libraries/System.Diagnostics.Process/Directory.Build.props b/src/libraries/System.Diagnostics.Process/Directory.Build.props index ce244cbea56199..e3cd1bcddea8ee 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.Process/tests/AssemblyInfo.cs b/src/libraries/System.Diagnostics.Process/tests/AssemblyInfo.cs index 80471364814581..0cbf2a35d71a64 100644 --- a/src/libraries/System.Diagnostics.Process/tests/AssemblyInfo.cs +++ b/src/libraries/System.Diagnostics.Process/tests/AssemblyInfo.cs @@ -7,4 +7,4 @@ // like the console code page and environment variables [assembly: CollectionBehavior(CollectionBehavior.CollectionPerAssembly)] -[assembly: SkipOnPlatform(TestPlatforms.Browser, "System.Diagnostics.Process is not supported on Browser.")] +[assembly: SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.Wasi, "System.Diagnostics.Process is not supported on Browser/Wasi.")] diff --git a/src/libraries/System.DirectoryServices.Protocols/Directory.Build.props b/src/libraries/System.DirectoryServices.Protocols/Directory.Build.props index 525d9a0d12ab6f..ed868ac7937d9a 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.Drawing.Common/tests/AssemblyInfo.cs b/src/libraries/System.Drawing.Common/tests/AssemblyInfo.cs index b1abf9bdf2391f..579b509faae2b3 100644 --- a/src/libraries/System.Drawing.Common/tests/AssemblyInfo.cs +++ b/src/libraries/System.Drawing.Common/tests/AssemblyInfo.cs @@ -5,4 +5,4 @@ using Xunit; [assembly: ActiveIssue("https://github.com/dotnet/runtime/issues/35917", typeof(PlatformDetection), nameof(PlatformDetection.IsMonoInterpreter))] -[assembly: SkipOnPlatform(TestPlatforms.Browser, "System.Drawing.Common is not supported on Browser")] +[assembly: SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.Wasi, "System.Drawing.Common is not supported on Browser/Wasi")] diff --git a/src/libraries/System.IO.Compression.Brotli/Directory.Build.props b/src/libraries/System.IO.Compression.Brotli/Directory.Build.props index f3f5769f936163..2a34f3542e3248 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.Brotli/tests/AssemblyInfo.cs b/src/libraries/System.IO.Compression.Brotli/tests/AssemblyInfo.cs index 7f8b8095c28136..33ce844b6f1640 100644 --- a/src/libraries/System.IO.Compression.Brotli/tests/AssemblyInfo.cs +++ b/src/libraries/System.IO.Compression.Brotli/tests/AssemblyInfo.cs @@ -4,4 +4,4 @@ using System; using Xunit; -[assembly: SkipOnPlatform(TestPlatforms.Browser, "System.IO.Compression.Brotli is not supported on Browser")] +[assembly: SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.Wasi, "System.IO.Compression.Brotli is not supported on Browser/Wasi")] diff --git a/src/libraries/System.IO.FileSystem.Watcher/Directory.Build.props b/src/libraries/System.IO.FileSystem.Watcher/Directory.Build.props index c581a9ef9e5a84..f5d6e28adaad44 100644 --- a/src/libraries/System.IO.FileSystem.Watcher/Directory.Build.props +++ b/src/libraries/System.IO.FileSystem.Watcher/Directory.Build.props @@ -3,7 +3,7 @@ Microsoft true - browser;ios;tvos + browser;wasi;ios;tvos maccatalyst - \ No newline at end of file + diff --git a/src/libraries/System.IO.FileSystem.Watcher/tests/AssemblyInfo.cs b/src/libraries/System.IO.FileSystem.Watcher/tests/AssemblyInfo.cs index d3aede3cb97cf6..db13d74c5ac43a 100644 --- a/src/libraries/System.IO.FileSystem.Watcher/tests/AssemblyInfo.cs +++ b/src/libraries/System.IO.FileSystem.Watcher/tests/AssemblyInfo.cs @@ -4,4 +4,4 @@ using System; using Xunit; -[assembly: SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.Wasi | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/iOS/tvOS")] +[assembly: SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.Wasi | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/Wasi/iOS/tvOS")] diff --git a/src/libraries/System.IO.IsolatedStorage/Directory.Build.props b/src/libraries/System.IO.IsolatedStorage/Directory.Build.props index ce244cbea56199..e3cd1bcddea8ee 100644 --- a/src/libraries/System.IO.IsolatedStorage/Directory.Build.props +++ b/src/libraries/System.IO.IsolatedStorage/Directory.Build.props @@ -3,6 +3,6 @@ Microsoft true - browser + browser;wasi - \ No newline at end of file + diff --git a/src/libraries/System.IO.IsolatedStorage/tests/AssemblyInfo.cs b/src/libraries/System.IO.IsolatedStorage/tests/AssemblyInfo.cs index bd236b298bce91..21477a207d2a96 100644 --- a/src/libraries/System.IO.IsolatedStorage/tests/AssemblyInfo.cs +++ b/src/libraries/System.IO.IsolatedStorage/tests/AssemblyInfo.cs @@ -8,4 +8,4 @@ // create unique identities for every test to allow every test to have // it's own store. [assembly: CollectionBehavior(CollectionBehavior.CollectionPerAssembly, DisableTestParallelization = true)] -[assembly: SkipOnPlatform(TestPlatforms.Browser, "System.IO.IsolatedStorage is not supported on Browser")] +[assembly: SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.Wasi, "System.IO.IsolatedStorage is not supported on Browser/Wasi")] diff --git a/src/libraries/System.IO.Pipes/Directory.Build.props b/src/libraries/System.IO.Pipes/Directory.Build.props index ce244cbea56199..e3cd1bcddea8ee 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.Pipes/tests/AssemblyInfo.cs b/src/libraries/System.IO.Pipes/tests/AssemblyInfo.cs index 8106929fe18971..3e4394148299d7 100644 --- a/src/libraries/System.IO.Pipes/tests/AssemblyInfo.cs +++ b/src/libraries/System.IO.Pipes/tests/AssemblyInfo.cs @@ -3,4 +3,4 @@ using Xunit; -[assembly: SkipOnPlatform(TestPlatforms.Browser, "System.IO.Pipes is not supported on Browser")] +[assembly: SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.Wasi, "System.IO.Pipes is not supported on Browser/Wasi")] diff --git a/src/libraries/System.IO.Ports/Directory.Build.props b/src/libraries/System.IO.Ports/Directory.Build.props index 42ef4884cef5d3..a93b4c306837b5 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.Net.HttpListener/Directory.Build.props b/src/libraries/System.Net.HttpListener/Directory.Build.props index c843a6347ce61c..d13e60dc1f0132 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.HttpListener/tests/AssemblyInfo.cs b/src/libraries/System.Net.HttpListener/tests/AssemblyInfo.cs index 2c4b07bdf7aa87..c498de418897b9 100644 --- a/src/libraries/System.Net.HttpListener/tests/AssemblyInfo.cs +++ b/src/libraries/System.Net.HttpListener/tests/AssemblyInfo.cs @@ -3,4 +3,4 @@ using Xunit; -[assembly: SkipOnPlatform(TestPlatforms.Browser, "System.Net.HttpListener is not supported on Browser")] \ No newline at end of file +[assembly: SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.Wasi, "System.Net.HttpListener is not supported on Browser/Wasi")] diff --git a/src/libraries/System.Net.NameResolution/Directory.Build.props b/src/libraries/System.Net.NameResolution/Directory.Build.props index ce244cbea56199..e3cd1bcddea8ee 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/tests/FunctionalTests/AssemblyInfo.cs b/src/libraries/System.Net.NameResolution/tests/FunctionalTests/AssemblyInfo.cs index c057237191b8a9..ba31644bb4f72e 100644 --- a/src/libraries/System.Net.NameResolution/tests/FunctionalTests/AssemblyInfo.cs +++ b/src/libraries/System.Net.NameResolution/tests/FunctionalTests/AssemblyInfo.cs @@ -3,4 +3,4 @@ using Xunit; -[assembly: SkipOnPlatform(TestPlatforms.Browser, "System.Net.NameResolution is not supported on Browser.")] +[assembly: SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.Wasi, "System.Net.NameResolution is not supported on Browser/Wasi.")] diff --git a/src/libraries/System.Net.NameResolution/tests/PalTests/AssemblyInfo.cs b/src/libraries/System.Net.NameResolution/tests/PalTests/AssemblyInfo.cs index c057237191b8a9..ba31644bb4f72e 100644 --- a/src/libraries/System.Net.NameResolution/tests/PalTests/AssemblyInfo.cs +++ b/src/libraries/System.Net.NameResolution/tests/PalTests/AssemblyInfo.cs @@ -3,4 +3,4 @@ using Xunit; -[assembly: SkipOnPlatform(TestPlatforms.Browser, "System.Net.NameResolution is not supported on Browser.")] +[assembly: SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.Wasi, "System.Net.NameResolution is not supported on Browser/Wasi.")] diff --git a/src/libraries/System.Net.NetworkInformation/Directory.Build.props b/src/libraries/System.Net.NetworkInformation/Directory.Build.props index ce244cbea56199..e3cd1bcddea8ee 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.NetworkInformation/tests/FunctionalTests/AssemblyInfo.cs b/src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/AssemblyInfo.cs index 94698a9536f2f9..1d1ab22a0496f7 100644 --- a/src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/AssemblyInfo.cs +++ b/src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/AssemblyInfo.cs @@ -3,4 +3,4 @@ using Xunit; -[assembly: SkipOnPlatform(TestPlatforms.Browser, "System.Net.NetworkInformation is not supported on Browser")] +[assembly: SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.Wasi, "System.Net.NetworkInformation is not supported on Browser/Wasi")] diff --git a/src/libraries/System.Net.Ping/Directory.Build.props b/src/libraries/System.Net.Ping/Directory.Build.props index ce244cbea56199..e3cd1bcddea8ee 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.Ping/tests/FunctionalTests/AssemblyInfo.cs b/src/libraries/System.Net.Ping/tests/FunctionalTests/AssemblyInfo.cs index da717221f60416..59692d0211e220 100644 --- a/src/libraries/System.Net.Ping/tests/FunctionalTests/AssemblyInfo.cs +++ b/src/libraries/System.Net.Ping/tests/FunctionalTests/AssemblyInfo.cs @@ -3,4 +3,4 @@ using Xunit; -[assembly: SkipOnPlatform(TestPlatforms.Browser, "System.Net.Ping is not supported on Browser")] +[assembly: SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.Wasi, "System.Net.Ping is not supported on Browser/Wasi")] diff --git a/src/libraries/System.Net.Requests/tests/AssemblyInfo.cs b/src/libraries/System.Net.Requests/tests/AssemblyInfo.cs index 350d945ef0a7da..83ea7dc56e8e2e 100644 --- a/src/libraries/System.Net.Requests/tests/AssemblyInfo.cs +++ b/src/libraries/System.Net.Requests/tests/AssemblyInfo.cs @@ -4,5 +4,4 @@ using System; using Xunit; -[assembly: SkipOnPlatform(TestPlatforms.Browser, "System.Net.Requests is not supported on Browser.")] -[assembly: SkipOnPlatform(TestPlatforms.Wasi, "System.Net.Requests is not supported on Browser.")] +[assembly: SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.Wasi, "System.Net.Requests is not supported on Browser/Wasi.")] diff --git a/src/libraries/System.Net.Security/Directory.Build.props b/src/libraries/System.Net.Security/Directory.Build.props index ce244cbea56199..e3cd1bcddea8ee 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.Security/tests/FunctionalTests/AssemblyInfo.cs b/src/libraries/System.Net.Security/tests/FunctionalTests/AssemblyInfo.cs index b80edd16806be5..eda129c0b29d0d 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/AssemblyInfo.cs +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/AssemblyInfo.cs @@ -4,4 +4,4 @@ using System; using Xunit; -[assembly: SkipOnPlatform(TestPlatforms.Browser, "System.Net.Security is not supported on Browser")] +[assembly: SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.Wasi, "System.Net.Security is not supported on Browser/Wasi")] diff --git a/src/libraries/System.Net.Security/tests/UnitTests/AssemblyInfo.cs b/src/libraries/System.Net.Security/tests/UnitTests/AssemblyInfo.cs index ea25dc5f7ade53..082cfaad2ece83 100644 --- a/src/libraries/System.Net.Security/tests/UnitTests/AssemblyInfo.cs +++ b/src/libraries/System.Net.Security/tests/UnitTests/AssemblyInfo.cs @@ -3,4 +3,4 @@ using Xunit; -[assembly: SkipOnPlatform(TestPlatforms.Browser, "System.Net.Security is not supported on Browser")] \ No newline at end of file +[assembly: SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.Wasi, "System.Net.Security is not supported on Browser/Wasi")] diff --git a/src/libraries/System.Net.Sockets/Directory.Build.props b/src/libraries/System.Net.Sockets/Directory.Build.props index ce244cbea56199..e3cd1bcddea8ee 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.Sockets/tests/FunctionalTests/AssemblyInfo.cs b/src/libraries/System.Net.Sockets/tests/FunctionalTests/AssemblyInfo.cs index 09a34bb9c412c3..a7d4bc928bd7f8 100644 --- a/src/libraries/System.Net.Sockets/tests/FunctionalTests/AssemblyInfo.cs +++ b/src/libraries/System.Net.Sockets/tests/FunctionalTests/AssemblyInfo.cs @@ -4,4 +4,4 @@ using Xunit; [assembly: SkipOnCoreClr("System.Net.Tests are flaky and/or long running: https://github.com/dotnet/runtime/issues/131", ~RuntimeConfiguration.Release)] -[assembly: SkipOnPlatform(TestPlatforms.Browser, "System.Net.Sockets is not supported on Browser")] +[assembly: SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.Wasi, "System.Net.Sockets is not supported on Browser/Wasi")] diff --git a/src/libraries/System.Net.WebClient/Directory.Build.props b/src/libraries/System.Net.WebClient/Directory.Build.props index c843a6347ce61c..d13e60dc1f0132 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/tests/AssemblyInfo.cs b/src/libraries/System.Net.WebClient/tests/AssemblyInfo.cs index 3b64820724cc76..cd256db5e062de 100644 --- a/src/libraries/System.Net.WebClient/tests/AssemblyInfo.cs +++ b/src/libraries/System.Net.WebClient/tests/AssemblyInfo.cs @@ -3,4 +3,4 @@ using Xunit; -[assembly: SkipOnPlatform(TestPlatforms.Browser, "System.Net.WebClient is not recommended for new development and not supported on Browser")] +[assembly: SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.Wasi, "System.Net.WebClient is not recommended for new development and not supported on Browser/Wasi")] diff --git a/src/libraries/System.Runtime.Serialization.Schema/Directory.Build.props b/src/libraries/System.Runtime.Serialization.Schema/Directory.Build.props index e7d357018da7bf..7d407028f6632b 100644 --- a/src/libraries/System.Runtime.Serialization.Schema/Directory.Build.props +++ b/src/libraries/System.Runtime.Serialization.Schema/Directory.Build.props @@ -4,6 +4,6 @@ Microsoft true - browser;ios;tvos;maccatalyst + browser;wasi;ios;tvos;maccatalyst diff --git a/src/libraries/System.Security.Cryptography.Cose/Directory.Build.props b/src/libraries/System.Security.Cryptography.Cose/Directory.Build.props index c4db04cc6c252f..d13e60dc1f0132 100644 --- a/src/libraries/System.Security.Cryptography.Cose/Directory.Build.props +++ b/src/libraries/System.Security.Cryptography.Cose/Directory.Build.props @@ -2,6 +2,6 @@ true - browser + browser;wasi diff --git a/src/libraries/System.Security.Cryptography.Csp/Directory.Build.props b/src/libraries/System.Security.Cryptography.Csp/Directory.Build.props index ce244cbea56199..e3cd1bcddea8ee 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 ce244cbea56199..e3cd1bcddea8ee 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 1e1390709dcc5b..4342451c25a834 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 1f799d605feb93..e3cd1bcddea8ee 100644 --- a/src/libraries/System.Security.Cryptography.Pkcs/Directory.Build.props +++ b/src/libraries/System.Security.Cryptography.Pkcs/Directory.Build.props @@ -3,6 +3,6 @@ Microsoft true - browser + browser;wasi diff --git a/src/libraries/System.Security.Cryptography.X509Certificates/Directory.Build.props b/src/libraries/System.Security.Cryptography.X509Certificates/Directory.Build.props index ce244cbea56199..e3cd1bcddea8ee 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 c843a6347ce61c..d13e60dc1f0132 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 + From 15c382beeb965919550cdfec01446e1e7287f7d8 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Mon, 27 Feb 2023 19:55:54 -0500 Subject: [PATCH 13/41] Add unsupportedOsPlatforms for wasi --- .../ref/Microsoft.Extensions.Configuration.Xml.cs | 1 + .../src/XmlDocumentDecryptor.cs | 1 + .../src/PhysicalFileProvider.cs | 2 +- .../src/PhysicalFilesWatcher.cs | 9 ++++++++- .../ref/Microsoft.Extensions.Hosting.Systemd.cs | 2 ++ .../src/SystemdLifetime.cs | 1 + .../src/SystemdNotifier.cs | 1 + .../src/Microsoft.Extensions.Http.csproj | 1 + .../ref/System.ComponentModel.TypeConverter.cs | 1 + .../ExtendedProtectionPolicyTypeConverter.cs | 1 + .../ExtendedProtectionPolicyTypeConverterTests.cs | 6 +++--- .../src/System/Diagnostics/XmlWriterTraceListener.cs | 2 +- .../src/System.IO.FileSystem.Watcher.csproj | 1 + .../System.Net.Http.Json/src/System.Net.Http.Json.csproj | 1 + src/libraries/System.Net.Http/Directory.Build.props | 3 ++- src/libraries/System.Net.Http/src/System.Net.Http.csproj | 4 ++-- .../ref/System.Net.ServicePoint.cs | 1 + .../src/System/Net/ServicePointManager.cs | 1 + .../System.Net.WebProxy/src/System.Net.WebProxy.csproj | 1 + .../System.Net.WebSockets.Client/Directory.Build.props | 3 ++- .../src/System/Xml/XmlDownloadManagerAsync.cs | 3 +++ .../Runtime/Caching/Configuration/CachingSectionGroup.cs | 1 + .../Runtime/Caching/Configuration/MemoryCacheElement.cs | 1 + .../Runtime/Caching/Configuration/MemoryCacheSection.cs | 1 + .../Configuration/MemoryCacheSettingsCollection.cs | 1 + .../src/System/Runtime/Caching/Counters.cs | 1 + .../Runtime/Caching/FileChangeNotificationSystem.cs | 1 + .../src/System/Runtime/Caching/HostFileChangeMonitor.cs | 2 +- .../src/System/Runtime/Caching/MemoryCache.cs | 3 ++- .../src/System/Runtime/Caching/MemoryCacheStatistics.cs | 3 ++- .../src/System/Runtime/Caching/MemoryCacheStore.cs | 3 ++- 31 files changed, 49 insertions(+), 14 deletions(-) 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 84d26a3faf4eaa..21f3d585c690a7 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 @@ -34,6 +34,7 @@ public partial class XmlDocumentDecryptor 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("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 2fe2ce2df91a06..e8f0b3367a785c 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Xml/src/XmlDocumentDecryptor.cs +++ b/src/libraries/Microsoft.Extensions.Configuration.Xml/src/XmlDocumentDecryptor.cs @@ -92,6 +92,7 @@ public XmlReader CreateDecryptingXmlReader(Stream input, XmlReaderSettings? sett /// The document. /// An XmlReader which can read the document. [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 fb2306d56e9f9d..614475a0188582 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 905dd855cd016a..9678a833e24334 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))); } @@ -272,6 +272,7 @@ protected virtual void Dispose(bool disposing) } [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] [SupportedOSPlatform("maccatalyst")] @@ -308,6 +309,7 @@ ex is DirectoryNotFoundException || } [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] [SupportedOSPlatform("maccatalyst")] @@ -317,6 +319,7 @@ private void OnChanged(object sender, FileSystemEventArgs e) } [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] [SupportedOSPlatform("maccatalyst")] @@ -330,6 +333,7 @@ private void OnError(object sender, ErrorEventArgs e) } [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] [SupportedOSPlatform("maccatalyst")] @@ -356,6 +360,7 @@ ex is SecurityException || } [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] [SupportedOSPlatform("maccatalyst")] @@ -396,6 +401,7 @@ private void ReportChangeForMatchedEntries(string path) } [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("wasi")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] [SupportedOSPlatform("maccatalyst")] @@ -417,6 +423,7 @@ private void TryDisableFileSystemWatcher() } [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 7d1462aba00056..acb55c93c8658f 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 @@ -34,6 +34,7 @@ public static partial class SystemdHelpers } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] [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")] @@ -45,6 +46,7 @@ public void Dispose() { } public System.Threading.Tasks.Task WaitForStartAsync(System.Threading.CancellationToken cancellationToken) { throw null; } } [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 e1b196fb2a6f5d..b63f2bcccced8a 100644 --- a/src/libraries/Microsoft.Extensions.Hosting.Systemd/src/SystemdLifetime.cs +++ b/src/libraries/Microsoft.Extensions.Hosting.Systemd/src/SystemdLifetime.cs @@ -14,6 +14,7 @@ namespace Microsoft.Extensions.Hosting.Systemd /// [UnsupportedOSPlatform("android")] [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 bfde5fe73df6a5..19a279e1b4663b 100644 --- a/src/libraries/Microsoft.Extensions.Hosting.Systemd/src/SystemdNotifier.cs +++ b/src/libraries/Microsoft.Extensions.Hosting.Systemd/src/SystemdNotifier.cs @@ -8,6 +8,7 @@ namespace Microsoft.Extensions.Hosting.Systemd { [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("wasi")] public class SystemdNotifier : ISystemdNotifier { private const string NOTIFY_SOCKET = "NOTIFY_SOCKET"; diff --git a/src/libraries/Microsoft.Extensions.Http/src/Microsoft.Extensions.Http.csproj b/src/libraries/Microsoft.Extensions.Http/src/Microsoft.Extensions.Http.csproj index 2b4f8c334fd5a7..1bb3147d3a3bac 100644 --- a/src/libraries/Microsoft.Extensions.Http/src/Microsoft.Extensions.Http.csproj +++ b/src/libraries/Microsoft.Extensions.Http/src/Microsoft.Extensions.Http.csproj @@ -8,6 +8,7 @@ Commonly Used Types: System.Net.Http.IHttpClientFactory + wasi 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 571f81e9f66911..353521a25e3981 100644 --- a/src/libraries/System.ComponentModel.TypeConverter/ref/System.ComponentModel.TypeConverter.cs +++ b/src/libraries/System.ComponentModel.TypeConverter/ref/System.ComponentModel.TypeConverter.cs @@ -2351,6 +2351,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("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/Security/Authentication/ExtendedProtection/ExtendedProtectionPolicyTypeConverter.cs b/src/libraries/System.ComponentModel.TypeConverter/src/System/Security/Authentication/ExtendedProtection/ExtendedProtectionPolicyTypeConverter.cs index c918ac07258d00..d14abe42d3be7e 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 @@ -19,6 +19,7 @@ public override bool CanConvertTo(ITypeDescriptorContext? context, [NotNullWhen( } [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.ComponentModel.TypeConverter/tests/Security/Authentication/ExtendedProtection/ExtendedProtectionPolicyTypeConverterTests.cs b/src/libraries/System.ComponentModel.TypeConverter/tests/Security/Authentication/ExtendedProtection/ExtendedProtectionPolicyTypeConverterTests.cs index 82676a7f3f6e89..46e7f11f5904ab 100644 --- a/src/libraries/System.ComponentModel.TypeConverter/tests/Security/Authentication/ExtendedProtection/ExtendedProtectionPolicyTypeConverterTests.cs +++ b/src/libraries/System.ComponentModel.TypeConverter/tests/Security/Authentication/ExtendedProtection/ExtendedProtectionPolicyTypeConverterTests.cs @@ -30,14 +30,14 @@ public void CanConvertTo_PositiveTests() } [Fact] - [SkipOnPlatform(TestPlatforms.Browser, "System.Net.Security is not supported on this platform.")] + [SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.Wasi, "System.Net.Security is not supported on this platform.")] public void ConvertTo_NullTypeTests() { Assert.Throws(() => converter.ConvertTo(null, CultureInfo.InvariantCulture, new ExtendedProtectionPolicy(PolicyEnforcement.Never), null)); } [Fact] - [SkipOnPlatform(TestPlatforms.Browser, "System.Net.Security is not supported on this platform.")] + [SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.Wasi, "System.Net.Security is not supported on this platform.")] public void ConvertTo_PositiveTests() { ExtendedProtectionPolicy policy = new ExtendedProtectionPolicy(PolicyEnforcement.Never); @@ -57,7 +57,7 @@ public void ConvertTo_PositiveTests() } [Theory] - [SkipOnPlatform(TestPlatforms.Browser, "System.Net.Security is not supported on this platform.")] + [SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.Wasi, "System.Net.Security is not supported on this platform.")] [InlineData(typeof(int))] [InlineData(typeof(ExtendedProtectionPolicy))] [InlineData(typeof(bool))] diff --git a/src/libraries/System.Diagnostics.TextWriterTraceListener/src/System/Diagnostics/XmlWriterTraceListener.cs b/src/libraries/System.Diagnostics.TextWriterTraceListener/src/System/Diagnostics/XmlWriterTraceListener.cs index a513b8aa86159c..b0aac57a4ddbb0 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, or Wasi { s_processName = processName = string.Empty; } diff --git a/src/libraries/System.IO.FileSystem.Watcher/src/System.IO.FileSystem.Watcher.csproj b/src/libraries/System.IO.FileSystem.Watcher/src/System.IO.FileSystem.Watcher.csproj index 15b70f231a8298..e1c5e839e4a616 100644 --- a/src/libraries/System.IO.FileSystem.Watcher/src/System.IO.FileSystem.Watcher.csproj +++ b/src/libraries/System.IO.FileSystem.Watcher/src/System.IO.FileSystem.Watcher.csproj @@ -2,6 +2,7 @@ true $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-linux;$(NetCoreAppCurrent)-osx;$(NetCoreAppCurrent)-maccatalyst;$(NetCoreAppCurrent)-freebsd;$(NetCoreAppCurrent) + wasi diff --git a/src/libraries/System.Net.Http.Json/src/System.Net.Http.Json.csproj b/src/libraries/System.Net.Http.Json/src/System.Net.Http.Json.csproj index 34f94be7e01092..aa3d4a4764a30d 100644 --- a/src/libraries/System.Net.Http.Json/src/System.Net.Http.Json.csproj +++ b/src/libraries/System.Net.Http.Json/src/System.Net.Http.Json.csproj @@ -8,6 +8,7 @@ Commonly Used Types: System.Net.Http.Json.HttpClientJsonExtensions System.Net.Http.Json.HttpContentJsonExtensions System.Net.Http.Json.JsonContent + wasi diff --git a/src/libraries/System.Net.Http/Directory.Build.props b/src/libraries/System.Net.Http/Directory.Build.props index d68d22c1b917f8..84c3682e1d6de0 100644 --- a/src/libraries/System.Net.Http/Directory.Build.props +++ b/src/libraries/System.Net.Http/Directory.Build.props @@ -3,5 +3,6 @@ Microsoft true + wasi - \ No newline at end of file + 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 df1d8e0ddad9d8..e06372dd206a6d 100644 --- a/src/libraries/System.Net.Http/src/System.Net.Http.csproj +++ b/src/libraries/System.Net.Http/src/System.Net.Http.csproj @@ -1,6 +1,6 @@ - $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-linux;$(NetCoreAppCurrent)-osx;$(NetCoreAppCurrent)-freebsd;$(NetCoreAppCurrent)-maccatalyst;$(NetCoreAppCurrent)-ios;$(NetCoreAppCurrent)-tvos;$(NetCoreAppCurrent)-browser;$(NetCoreAppCurrent)-wasi;$(NetCoreAppCurrent)-illumos;$(NetCoreAppCurrent)-solaris;$(NetCoreAppCurrent)-android;$(NetCoreAppCurrent) + $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-linux;$(NetCoreAppCurrent)-osx;$(NetCoreAppCurrent)-freebsd;$(NetCoreAppCurrent)-maccatalyst;$(NetCoreAppCurrent)-ios;$(NetCoreAppCurrent)-tvos;$(NetCoreAppCurrent)-browser;$(NetCoreAppCurrent)-illumos;$(NetCoreAppCurrent)-solaris;$(NetCoreAppCurrent)-android;$(NetCoreAppCurrent) true $(DefineConstants);HTTP_DLL true @@ -16,7 +16,7 @@ $(DefineConstants);TARGET_MACCATALYST $(DefineConstants);TARGET_TVOS $(DefineConstants);TARGET_BROWSER - $(DefineConstants);TARGET_WASI + $(MSBuildThisFileDirectory)ILLink\ 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 a8282e9d3cc246..c9809f25e7a8b5 100644 --- a/src/libraries/System.Net.ServicePoint/ref/System.Net.ServicePoint.cs +++ b/src/libraries/System.Net.ServicePoint/ref/System.Net.ServicePoint.cs @@ -49,6 +49,7 @@ internal ServicePointManager() { } 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("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 fc25568015f92a..8ec35a5d413e23 100644 --- a/src/libraries/System.Net.ServicePoint/src/System/Net/ServicePointManager.cs +++ b/src/libraries/System.Net.ServicePoint/src/System/Net/ServicePointManager.cs @@ -95,6 +95,7 @@ public static int DnsRefreshTimeout public static bool CheckCertificateRevocationList { get; set; } [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.WebProxy/src/System.Net.WebProxy.csproj b/src/libraries/System.Net.WebProxy/src/System.Net.WebProxy.csproj index 68485c90ea3556..2b7948bf1749ca 100644 --- a/src/libraries/System.Net.WebProxy/src/System.Net.WebProxy.csproj +++ b/src/libraries/System.Net.WebProxy/src/System.Net.WebProxy.csproj @@ -2,6 +2,7 @@ true $(NetCoreAppCurrent);$(NetCoreAppCurrent)-browser + wasi diff --git a/src/libraries/System.Net.WebSockets.Client/Directory.Build.props b/src/libraries/System.Net.WebSockets.Client/Directory.Build.props index d68d22c1b917f8..84c3682e1d6de0 100644 --- a/src/libraries/System.Net.WebSockets.Client/Directory.Build.props +++ b/src/libraries/System.Net.WebSockets.Client/Directory.Build.props @@ -3,5 +3,6 @@ Microsoft true + wasi - \ No newline at end of file + diff --git a/src/libraries/System.Private.Xml/src/System/Xml/XmlDownloadManagerAsync.cs b/src/libraries/System.Private.Xml/src/System/Xml/XmlDownloadManagerAsync.cs index c2d774d0f40067..88d6032f5ec70a 100644 --- a/src/libraries/System.Private.Xml/src/System/Xml/XmlDownloadManagerAsync.cs +++ b/src/libraries/System.Private.Xml/src/System/Xml/XmlDownloadManagerAsync.cs @@ -26,6 +26,9 @@ internal static Task GetStreamAsync(Uri uri, ICredentials? credentials, private static async Task GetNonFileStreamAsync(Uri uri, ICredentials? credentials, IWebProxy? proxy) { + if (OperatingSystem.IsOSPlatform("WASI")) + throw new XmlException(SR.Xml_UnsupportedClass, string.Empty); + var handler = new HttpClientHandler(); using (var client = new HttpClient(handler)) { 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 327dd53ba40735..e200dd6ee35625 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 @@ -9,6 +9,7 @@ namespace System.Runtime.Caching.Configuration { #if NETCOREAPP [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 9fcfd59126aa40..b3fe7332ad33a2 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 @@ -10,6 +10,7 @@ namespace System.Runtime.Caching.Configuration { #if NETCOREAPP [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 05e0387374ec8d..54983c2c224d8a 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 @@ -23,6 +23,7 @@ namespace System.Runtime.Caching.Configuration #if NETCOREAPP [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 e3c1a5bd3eb1da..7242350e3368db 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 @@ -9,6 +9,7 @@ namespace System.Runtime.Caching.Configuration { #if NETCOREAPP [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 8d3f7237d27afa..539aa9d7d606ae 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 @@ -11,6 +11,7 @@ namespace System.Runtime.Caching { #if NETCOREAPP [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 22595a4bd5845a..bd69cb824f86ba 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 @@ -13,6 +13,7 @@ namespace System.Runtime.Caching { #if NETCOREAPP [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 85730638cd743e..f087c67370dd5b 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.IsBrowser() || OperatingSystem.IsOSPlatform("WASI") || (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 e740eed69ed514..7f8692814036d9 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 @@ -42,7 +42,8 @@ public class MemoryCache : ObjectCache, IEnumerable, IDisposable private UnhandledExceptionEventHandler _onUnhandledException; #if NETCOREAPP [UnsupportedOSPlatformGuard("browser")] - private static bool _countersSupported => !OperatingSystem.IsBrowser(); + [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 96cfc3bda655bd..04ec452f721f2a 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 @@ -39,7 +39,8 @@ internal sealed class MemoryCacheStatistics : IDisposable private readonly PhysicalMemoryMonitor _physicalMemoryMonitor; #if NETCOREAPP [UnsupportedOSPlatformGuard("browser")] - private static bool _configSupported => !OperatingSystem.IsBrowser(); + [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 343f3beb4a8456..85a6cc3e545fcf 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 @@ -28,7 +28,8 @@ internal sealed class MemoryCacheStore : IDisposable private readonly Counters _perfCounters; #if NETCOREAPP [UnsupportedOSPlatformGuard("browser")] - private static bool _countersSupported => !OperatingSystem.IsBrowser(); + [UnsupportedOSPlatformGuard("wasi")] + private static bool _countersSupported => !OperatingSystem.IsBrowser() && !OperatingSystem.IsOSPlatform("WASI"); #else private static bool _countersSupported => true; #endif From 9882b65c2d4f8c36acbf7851bbc05f63723c05ba Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Mon, 27 Feb 2023 22:09:01 -0500 Subject: [PATCH 14/41] fix --- .../System.Net.Http/src/System.Net.Http.csproj | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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 f9f72f6c5d7042..12d99a6e3bc6f5 100644 --- a/src/libraries/System.Net.Http/src/System.Net.Http.csproj +++ b/src/libraries/System.Net.Http/src/System.Net.Http.csproj @@ -156,7 +156,7 @@ Link="Common\System\Text\ValueStringBuilder.AppendSpanFormattable.cs" /> - + @@ -304,12 +304,12 @@ - + - + @@ -383,7 +383,7 @@ - + - + @@ -457,7 +457,7 @@ - + From fe0ef5500be765769e21a7ebd366d81ebd2c8792 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Wed, 1 Mar 2023 14:28:44 -0500 Subject: [PATCH 15/41] use new Operatingsystem.IsWasi api --- .../src/PhysicalFileProvider.cs | 2 +- .../src/PhysicalFilesWatcher.cs | 2 +- .../src/System/Diagnostics/XmlWriterTraceListener.cs | 2 +- .../src/System/Xml/XmlDownloadManagerAsync.cs | 2 +- .../src/System/Runtime/Caching/HostFileChangeMonitor.cs | 2 +- .../src/System/Runtime/Caching/MemoryCache.cs | 2 +- .../src/System/Runtime/Caching/MemoryCacheStatistics.cs | 2 +- .../src/System/Runtime/Caching/MemoryCacheStore.cs | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/libraries/Microsoft.Extensions.FileProviders.Physical/src/PhysicalFileProvider.cs b/src/libraries/Microsoft.Extensions.FileProviders.Physical/src/PhysicalFileProvider.cs index 614475a0188582..8cb45c48a8d8b7 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.IsOSPlatform("WASI") || (OperatingSystem.IsIOS() && !OperatingSystem.IsMacCatalyst()) || OperatingSystem.IsTvOS()) + if (OperatingSystem.IsBrowser() || OperatingSystem.IsWasi() || (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 9678a833e24334..3fe8e5588818e5 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.IsOSPlatform("WASI") || (OperatingSystem.IsIOS() && !OperatingSystem.IsMacCatalyst()) || OperatingSystem.IsTvOS()) + if (OperatingSystem.IsBrowser() || OperatingSystem.IsWasi() || (OperatingSystem.IsIOS() && !OperatingSystem.IsMacCatalyst()) || OperatingSystem.IsTvOS()) { throw new PlatformNotSupportedException(SR.Format(SR.FileSystemWatcher_PlatformNotSupported, typeof(FileSystemWatcher))); } 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 b0aac57a4ddbb0..8c31895345bcbb 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() || OperatingSystem.IsOSPlatform("WASI")) // Process isn't supported on Browser, or Wasi + if (OperatingSystem.IsBrowser() || OperatingSystem.IsWasi()) // Process isn't supported on Browser, or Wasi { s_processName = processName = string.Empty; } diff --git a/src/libraries/System.Private.Xml/src/System/Xml/XmlDownloadManagerAsync.cs b/src/libraries/System.Private.Xml/src/System/Xml/XmlDownloadManagerAsync.cs index 88d6032f5ec70a..ef702ac4859ce6 100644 --- a/src/libraries/System.Private.Xml/src/System/Xml/XmlDownloadManagerAsync.cs +++ b/src/libraries/System.Private.Xml/src/System/Xml/XmlDownloadManagerAsync.cs @@ -26,7 +26,7 @@ internal static Task GetStreamAsync(Uri uri, ICredentials? credentials, private static async Task GetNonFileStreamAsync(Uri uri, ICredentials? credentials, IWebProxy? proxy) { - if (OperatingSystem.IsOSPlatform("WASI")) + if (OperatingSystem.IsWasi()) throw new XmlException(SR.Xml_UnsupportedClass, string.Empty); var handler = new HttpClientHandler(); 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 f087c67370dd5b..0fc80878ed3b94 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.IsOSPlatform("WASI") || (OperatingSystem.IsIOS() && !OperatingSystem.IsMacCatalyst()) || OperatingSystem.IsTvOS()) + if (OperatingSystem.IsBrowser() || OperatingSystem.IsWasi() || (OperatingSystem.IsIOS() && !OperatingSystem.IsMacCatalyst()) || OperatingSystem.IsTvOS()) { throw new PlatformNotSupportedException(); } diff --git a/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/MemoryCache.cs b/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/MemoryCache.cs index 7f8692814036d9..68b7d177698aec 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 @@ -43,7 +43,7 @@ public class MemoryCache : ObjectCache, IEnumerable, IDisposable #if NETCOREAPP [UnsupportedOSPlatformGuard("browser")] [UnsupportedOSPlatformGuard("wasi")] - private static bool _countersSupported => !OperatingSystem.IsBrowser() && !OperatingSystem.IsOSPlatform("WASI"); + private static bool _countersSupported => !OperatingSystem.IsBrowser() && !OperatingSystem.IsWasi(); #else private static bool _countersSupported => true; #endif diff --git a/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/MemoryCacheStatistics.cs b/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/MemoryCacheStatistics.cs index 04ec452f721f2a..3017a3ba4f977f 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 @@ -40,7 +40,7 @@ internal sealed class MemoryCacheStatistics : IDisposable #if NETCOREAPP [UnsupportedOSPlatformGuard("browser")] [UnsupportedOSPlatformGuard("wasi")] - private static bool _configSupported => !OperatingSystem.IsBrowser() && !OperatingSystem.IsOSPlatform("WASI"); + private static bool _configSupported => !OperatingSystem.IsBrowser() && !OperatingSystem.IsWasi(); #else private static bool _configSupported => true; #endif diff --git a/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/MemoryCacheStore.cs b/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/MemoryCacheStore.cs index 85a6cc3e545fcf..254c62d8107a61 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 @@ -29,7 +29,7 @@ internal sealed class MemoryCacheStore : IDisposable #if NETCOREAPP [UnsupportedOSPlatformGuard("browser")] [UnsupportedOSPlatformGuard("wasi")] - private static bool _countersSupported => !OperatingSystem.IsBrowser() && !OperatingSystem.IsOSPlatform("WASI"); + private static bool _countersSupported => !OperatingSystem.IsBrowser() && !OperatingSystem.IsWasi(); #else private static bool _countersSupported => true; #endif From 426e2fe624529f1e23bdebdde93288b37cea3cd7 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Wed, 1 Mar 2023 15:34:34 -0500 Subject: [PATCH 16/41] fix --- src/libraries/System.Net.Http/src/System.Net.Http.csproj | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) 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 12d99a6e3bc6f5..49445d8b3256b7 100644 --- a/src/libraries/System.Net.Http/src/System.Net.Http.csproj +++ b/src/libraries/System.Net.Http/src/System.Net.Http.csproj @@ -16,15 +16,14 @@ $(DefineConstants);TARGET_MACCATALYST $(DefineConstants);TARGET_TVOS $(DefineConstants);TARGET_BROWSER - $(MSBuildThisFileDirectory)ILLink\ - + - - + + From fd5648839dbad1d3259509f89fff2fbd5739efb5 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Thu, 2 Mar 2023 17:08:24 -0500 Subject: [PATCH 17/41] wip --- .../System.Net.Http/src/System.Net.Http.csproj | 17 +++++++++-------- .../src/System/Net/Http/GlobalHttpSettings.cs | 2 +- .../src/System/Net/Http/Headers/KnownHeaders.cs | 2 +- .../src/System/Net/Http/HttpClientHandler.cs | 2 +- .../System/Net/Http/HttpProtocolException.cs | 2 +- 5 files changed, 13 insertions(+), 12 deletions(-) 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 49445d8b3256b7..a9e513a5d721ac 100644 --- a/src/libraries/System.Net.Http/src/System.Net.Http.csproj +++ b/src/libraries/System.Net.Http/src/System.Net.Http.csproj @@ -19,8 +19,9 @@ $(MSBuildThisFileDirectory)ILLink\ - - + + + @@ -155,7 +156,7 @@ Link="Common\System\Text\ValueStringBuilder.AppendSpanFormattable.cs" /> - + @@ -303,12 +304,12 @@ - + - + @@ -382,7 +383,7 @@ - + - + @@ -456,7 +457,7 @@ - + diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/GlobalHttpSettings.cs b/src/libraries/System.Net.Http/src/System/Net/Http/GlobalHttpSettings.cs index afeac67e38a5d6..e5ce296731ced8 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/GlobalHttpSettings.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/GlobalHttpSettings.cs @@ -18,7 +18,7 @@ internal static class DiagnosticsHandler internal static class SocketsHttpHandler { -#if !BROWSER +#if !BROWSER && !WASI // Default to allowing HTTP/2, but enable that to be overridden by an // AppContext switch, or by an environment variable being set to false/0. public static bool AllowHttp2 { get; } = RuntimeSettingParser.QueryRuntimeSettingSwitch( diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/Headers/KnownHeaders.cs b/src/libraries/System.Net.Http/src/System/Net/Http/Headers/KnownHeaders.cs index 389174a5258afb..9dd320de092b41 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/Headers/KnownHeaders.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/Headers/KnownHeaders.cs @@ -107,7 +107,7 @@ internal static class KnownHeaders public static readonly KnownHeader XUACompatible = new KnownHeader("X-UA-Compatible"); public static readonly KnownHeader XXssProtection = new KnownHeader("X-XSS-Protection", HttpHeaderType.Custom, null, new string[] { "0", "1", "1; mode=block" }); -#if TARGET_BROWSER +#if TARGET_BROWSER || TARGET_WASI private static HttpHeaderParser? GetAltSvcHeaderParser() => null; // Allow for the AltSvcHeaderParser to be trimmed on Browser since Alt-Svc is only for SocketsHttpHandler, which isn't used on Browser. #else private static AltSvcHeaderParser? GetAltSvcHeaderParser() => AltSvcHeaderParser.Parser; diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/HttpClientHandler.cs b/src/libraries/System.Net.Http/src/System/Net/Http/HttpClientHandler.cs index 9e4bf892ceb1a9..5bb7e5ab41b083 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 @@ -256,7 +256,7 @@ public X509CertificateCollection ClientCertificates [UnsupportedOSPlatform("browser")] public Func? ServerCertificateCustomValidationCallback { -#if TARGET_BROWSER +#if TARGET_BROWSER || TARGET_WASI get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); #else diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/HttpProtocolException.cs b/src/libraries/System.Net.Http/src/System/Net/Http/HttpProtocolException.cs index 15d9eae82b00c4..2044a29df5abfc 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/HttpProtocolException.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/HttpProtocolException.cs @@ -34,7 +34,7 @@ public HttpProtocolException(long errorCode, string message, Exception? innerExc /// public long ErrorCode { get; } -#if !TARGET_BROWSER +#if !TARGET_BROWSER && !TARGET_WASI internal static HttpProtocolException CreateHttp2StreamException(Http2ProtocolErrorCode protocolError) { string message = SR.Format(SR.net_http_http2_stream_error, GetName(protocolError), ((int)protocolError).ToString("x")); From 39de3bed8bc6290cb1a4543d47eacc0bd9a8b49f Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Thu, 2 Mar 2023 17:09:45 -0500 Subject: [PATCH 18/41] wip --- .../System.Net.Http/src/System/Net/Http/GlobalHttpSettings.cs | 2 +- .../System.Net.Http/src/System/Net/Http/Headers/KnownHeaders.cs | 2 +- .../System.Net.Http/src/System/Net/Http/HttpClientHandler.cs | 2 +- .../src/System/Net/Http/HttpProtocolException.cs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/GlobalHttpSettings.cs b/src/libraries/System.Net.Http/src/System/Net/Http/GlobalHttpSettings.cs index e5ce296731ced8..afeac67e38a5d6 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/GlobalHttpSettings.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/GlobalHttpSettings.cs @@ -18,7 +18,7 @@ internal static class DiagnosticsHandler internal static class SocketsHttpHandler { -#if !BROWSER && !WASI +#if !BROWSER // Default to allowing HTTP/2, but enable that to be overridden by an // AppContext switch, or by an environment variable being set to false/0. public static bool AllowHttp2 { get; } = RuntimeSettingParser.QueryRuntimeSettingSwitch( diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/Headers/KnownHeaders.cs b/src/libraries/System.Net.Http/src/System/Net/Http/Headers/KnownHeaders.cs index 9dd320de092b41..389174a5258afb 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/Headers/KnownHeaders.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/Headers/KnownHeaders.cs @@ -107,7 +107,7 @@ internal static class KnownHeaders public static readonly KnownHeader XUACompatible = new KnownHeader("X-UA-Compatible"); public static readonly KnownHeader XXssProtection = new KnownHeader("X-XSS-Protection", HttpHeaderType.Custom, null, new string[] { "0", "1", "1; mode=block" }); -#if TARGET_BROWSER || TARGET_WASI +#if TARGET_BROWSER private static HttpHeaderParser? GetAltSvcHeaderParser() => null; // Allow for the AltSvcHeaderParser to be trimmed on Browser since Alt-Svc is only for SocketsHttpHandler, which isn't used on Browser. #else private static AltSvcHeaderParser? GetAltSvcHeaderParser() => AltSvcHeaderParser.Parser; diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/HttpClientHandler.cs b/src/libraries/System.Net.Http/src/System/Net/Http/HttpClientHandler.cs index 5bb7e5ab41b083..9e4bf892ceb1a9 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 @@ -256,7 +256,7 @@ public X509CertificateCollection ClientCertificates [UnsupportedOSPlatform("browser")] public Func? ServerCertificateCustomValidationCallback { -#if TARGET_BROWSER || TARGET_WASI +#if TARGET_BROWSER get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); #else diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/HttpProtocolException.cs b/src/libraries/System.Net.Http/src/System/Net/Http/HttpProtocolException.cs index 2044a29df5abfc..15d9eae82b00c4 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/HttpProtocolException.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/HttpProtocolException.cs @@ -34,7 +34,7 @@ public HttpProtocolException(long errorCode, string message, Exception? innerExc /// public long ErrorCode { get; } -#if !TARGET_BROWSER && !TARGET_WASI +#if !TARGET_BROWSER internal static HttpProtocolException CreateHttp2StreamException(Http2ProtocolErrorCode protocolError) { string message = SR.Format(SR.net_http_http2_stream_error, GetName(protocolError), ((int)protocolError).ToString("x")); From f8ba4c4b003229fda9dc1e1c7a96e187e4beb580 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Fri, 3 Mar 2023 17:19:28 -0500 Subject: [PATCH 19/41] System.Security.Cryptography: compile same level of support as browser - i.e., managed implementation --- .../src/System.Security.Cryptography.csproj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 197dba5072bf5d..2f4766f3a79b53 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 @@ -553,7 +553,7 @@ System\Security\Cryptography\X509Certificates\Asn1\PolicyInformationAsn.xml - + @@ -1863,7 +1863,7 @@ - + From 46da5780024fe369cd0cf804c1816c4e664cd33b Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Fri, 3 Mar 2023 17:22:41 -0500 Subject: [PATCH 20/41] Disable some crypto tests for wasi, same as for browser --- .../Cryptography/SP800108HmacCounterKdfTests.ThreadSafety.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libraries/Common/tests/System/Security/Cryptography/SP800108HmacCounterKdfTests.ThreadSafety.cs b/src/libraries/Common/tests/System/Security/Cryptography/SP800108HmacCounterKdfTests.ThreadSafety.cs index cf1339eb4daf76..785bf53686a96b 100644 --- a/src/libraries/Common/tests/System/Security/Cryptography/SP800108HmacCounterKdfTests.ThreadSafety.cs +++ b/src/libraries/Common/tests/System/Security/Cryptography/SP800108HmacCounterKdfTests.ThreadSafety.cs @@ -10,6 +10,7 @@ public static partial class SP800108HmacCounterKdfTests { [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/68162", TestPlatforms.Browser)] // wasm threading support + [ActiveIssue("https://github.com/dotnet/runtime/issues/82561", TestPlatforms.Wasi)] // wasm threading support public static void Race_ReusingOneInstance_Allocating() { using (SP800108HmacCounterKdf kdf = new("kdf"u8, HashAlgorithmName.SHA256)) @@ -55,6 +56,7 @@ public static void Race_ReusingOneInstance_Allocating() [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/68162", TestPlatforms.Browser)] // wasm threading support + [ActiveIssue("https://github.com/dotnet/runtime/issues/82561", TestPlatforms.Wasi)] // wasm threading support public static void Race_ReusingOneInstance_Buffering() { using (SP800108HmacCounterKdf kdf = new("kdf"u8, HashAlgorithmName.SHA256)) @@ -128,6 +130,7 @@ public static void Race_ReusingOneInstance_Buffering() [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/68162", TestPlatforms.Browser)] // wasm threading support + [ActiveIssue("https://github.com/dotnet/runtime/issues/82561", TestPlatforms.Wasi)] // wasm threading support public static void Race_UseAndDisposeOneInstance_Allocating() { SP800108HmacCounterKdf kdf; From 7ba14c32afcf50a0c93218768e98bde8c6db8147 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Fri, 3 Mar 2023 17:29:15 -0500 Subject: [PATCH 21/41] Fix System.Formats.Asn1.Tests, and System.Formats.Cbor.Tests --- .../System.Formats.Asn1/tests/Reader/ReadNamedBitList.cs | 2 ++ .../System.Formats.Asn1/tests/Writer/WriteNamedBitList.cs | 2 ++ .../System.Formats.Cbor/tests/Reader/CborReaderTests.cs | 1 + 3 files changed, 5 insertions(+) diff --git a/src/libraries/System.Formats.Asn1/tests/Reader/ReadNamedBitList.cs b/src/libraries/System.Formats.Asn1/tests/Reader/ReadNamedBitList.cs index fab9b17f28ab61..bed447a0865906 100644 --- a/src/libraries/System.Formats.Asn1/tests/Reader/ReadNamedBitList.cs +++ b/src/libraries/System.Formats.Asn1/tests/Reader/ReadNamedBitList.cs @@ -465,6 +465,7 @@ public static void ReadNamedBitList_BitArray_7993Bits(AsnEncodingRules ruleSet) [Theory] [ActiveIssue("https://github.com/dotnet/runtime/issues/37669", TestPlatforms.Browser)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/82561", TestPlatforms.Wasi)] [InlineData(AsnEncodingRules.BER)] [InlineData(AsnEncodingRules.CER)] [InlineData(AsnEncodingRules.DER)] @@ -497,6 +498,7 @@ public static void VerifyReadNamedBitList_KeyUsage_OneByte(AsnEncodingRules rule [Theory] [ActiveIssue("https://github.com/dotnet/runtime/issues/37669", TestPlatforms.Browser)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/82561", TestPlatforms.Wasi)] [InlineData(AsnEncodingRules.BER)] [InlineData(AsnEncodingRules.CER)] [InlineData(AsnEncodingRules.DER)] diff --git a/src/libraries/System.Formats.Asn1/tests/Writer/WriteNamedBitList.cs b/src/libraries/System.Formats.Asn1/tests/Writer/WriteNamedBitList.cs index 5e0a9fbfb2b7c9..12fff663576c17 100644 --- a/src/libraries/System.Formats.Asn1/tests/Writer/WriteNamedBitList.cs +++ b/src/libraries/System.Formats.Asn1/tests/Writer/WriteNamedBitList.cs @@ -330,6 +330,7 @@ public static void VerifyWriteNamedBitList_BitArray_7993Bits(AsnEncodingRules ru [Theory] [ActiveIssue("https://github.com/dotnet/runtime/issues/37669", TestPlatforms.Browser)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/82561", TestPlatforms.Wasi)] [InlineData(AsnEncodingRules.BER)] [InlineData(AsnEncodingRules.CER)] [InlineData(AsnEncodingRules.DER)] @@ -362,6 +363,7 @@ public static void VerifyWriteNamedBitList_KeyUsage_OneByte(AsnEncodingRules rul [Theory] [ActiveIssue("https://github.com/dotnet/runtime/issues/37669", TestPlatforms.Browser)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/82561", TestPlatforms.Wasi)] [InlineData(AsnEncodingRules.BER)] [InlineData(AsnEncodingRules.CER)] [InlineData(AsnEncodingRules.DER)] diff --git a/src/libraries/System.Formats.Cbor/tests/Reader/CborReaderTests.cs b/src/libraries/System.Formats.Cbor/tests/Reader/CborReaderTests.cs index f8ef68829cce37..8632361b562766 100644 --- a/src/libraries/System.Formats.Cbor/tests/Reader/CborReaderTests.cs +++ b/src/libraries/System.Formats.Cbor/tests/Reader/CborReaderTests.cs @@ -232,6 +232,7 @@ public static void ReadEncodedValue_InvalidConformance_ConformanceCheckDisabled_ [Theory] [ActiveIssue("https://github.com/dotnet/runtime/issues/37669", TestPlatforms.Browser)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/82561", TestPlatforms.Wasi)] [InlineData("a501020326200121582065eda5a12577c2bae829437fe338701a10aaa375e1bb5b5de108de439c08551d2258201e52ed75701163f7f9e40ddf9f341b3dc9ba860af7e0ca7ca7e9eecd0084d19c", "65eda5a12577c2bae829437fe338701a10aaa375e1bb5b5de108de439c08551d", "1e52ed75701163f7f9e40ddf9f341b3dc9ba860af7e0ca7ca7e9eecd0084d19c", From d47836e2ae458d7dae5109fc7d115fc5f23f78dd Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Fri, 3 Mar 2023 18:30:24 -0500 Subject: [PATCH 22/41] Disable more library tests --- src/libraries/tests.proj | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/libraries/tests.proj b/src/libraries/tests.proj index 47fc849ed6ede4..b899e2a417a50e 100644 --- a/src/libraries/tests.proj +++ b/src/libraries/tests.proj @@ -342,11 +342,23 @@ https://github.com/mono/mono/issues/16417 --> + + + + + + - - + + + + + + + + From fff7ce8649a2600f92d6d0d3239c8100147f0ad3 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Fri, 3 Mar 2023 18:30:45 -0500 Subject: [PATCH 23/41] Set shouldContinueOnError for the test PR --- eng/pipelines/runtime.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/runtime.yml b/eng/pipelines/runtime.yml index e87bfc7f816f1d..f612c5745759a7 100644 --- a/eng/pipelines/runtime.yml +++ b/eng/pipelines/runtime.yml @@ -515,7 +515,7 @@ extends: - wasi_wasm - wasi_wasm_win extraBuildArgs: /p:RunWasmSamples=true - shouldContinueOnError: true + shouldContinueOnError: false alwaysRun: true scenarios: - normal From 97e05bc10e44219bd7e241e8f2704bf70656dc88 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Fri, 3 Mar 2023 18:55:22 -0500 Subject: [PATCH 24/41] [wasi] Copy WasmFilesToIncludeInFileSystem to the bundle too This could be changed in the future to include in the single file bundle --- src/mono/wasi/build/WasiApp.targets | 1 + src/tasks/WasmAppBuilder/WasmAppBuilder.cs | 40 +++++++--------- .../WasmAppBuilder/WasmAppBuilderBaseTask.cs | 1 + .../WasmAppBuilder/wasi/WasiAppBuilder.cs | 47 ++++++++++++------- 4 files changed, 49 insertions(+), 40 deletions(-) diff --git a/src/mono/wasi/build/WasiApp.targets b/src/mono/wasi/build/WasiApp.targets index 6085aa2e61ad74..81b5b8ab1eeec3 100644 --- a/src/mono/wasi/build/WasiApp.targets +++ b/src/mono/wasi/build/WasiApp.targets @@ -354,6 +354,7 @@ InvariantGlobalization="$(InvariantGlobalization)" SatelliteAssemblies="@(_WasmSatelliteAssemblies)" IcuDataFileNames="@(WasmIcuDataFileNames)" + FilesToIncludeInFileSystem="@(WasmFilesToIncludeInFileSystem)" ExtraFilesToDeploy="@(WasmExtraFilesToDeploy)" NativeAssets="@(WasmNativeAsset)" DebugLevel="$(WasmDebugLevel)" diff --git a/src/tasks/WasmAppBuilder/WasmAppBuilder.cs b/src/tasks/WasmAppBuilder/WasmAppBuilder.cs index b7441396754fe1..40a74d7f57975f 100644 --- a/src/tasks/WasmAppBuilder/WasmAppBuilder.cs +++ b/src/tasks/WasmAppBuilder/WasmAppBuilder.cs @@ -18,7 +18,6 @@ namespace Microsoft.WebAssembly.Build.Tasks; public class WasmAppBuilder : WasmAppBuilderBaseTask { - public ITaskItem[]? FilesToIncludeInFileSystem { get; set; } public ITaskItem[]? RemoteSources { get; set; } public bool IncludeThreadsWorker {get; set; } public int PThreadPoolSize {get; set; } @@ -265,7 +264,7 @@ protected override bool ExecuteInternal() } }); - if (FilesToIncludeInFileSystem != null) + if (FilesToIncludeInFileSystem.Length > 0) { string supportFilesDir = Path.Combine(AppDir, "supportFiles"); Directory.CreateDirectory(supportFilesDir); @@ -366,29 +365,26 @@ protected override bool ExecuteInternal() Utils.CopyIfDifferent(tmpMonoConfigPath, monoConfigPath, useHash: false); _fileWrites.Add(monoConfigPath); - if (ExtraFilesToDeploy != null) + foreach (ITaskItem item in ExtraFilesToDeploy!) { - foreach (ITaskItem item in ExtraFilesToDeploy!) - { - string src = item.ItemSpec; - string dst; - - string tgtPath = item.GetMetadata("TargetPath"); - if (!string.IsNullOrEmpty(tgtPath)) - { - dst = Path.Combine(AppDir!, tgtPath); - string? dstDir = Path.GetDirectoryName(dst); - if (!string.IsNullOrEmpty(dstDir) && !Directory.Exists(dstDir)) - Directory.CreateDirectory(dstDir!); - } - else - { - dst = Path.Combine(AppDir!, Path.GetFileName(src)); - } + string src = item.ItemSpec; + string dst; - if (!FileCopyChecked(src, dst, "ExtraFilesToDeploy")) - return false; + string tgtPath = item.GetMetadata("TargetPath"); + if (!string.IsNullOrEmpty(tgtPath)) + { + dst = Path.Combine(AppDir!, tgtPath); + string? dstDir = Path.GetDirectoryName(dst); + if (!string.IsNullOrEmpty(dstDir) && !Directory.Exists(dstDir)) + Directory.CreateDirectory(dstDir!); } + else + { + dst = Path.Combine(AppDir!, Path.GetFileName(src)); + } + + if (!FileCopyChecked(src, dst, "ExtraFilesToDeploy")) + return false; } UpdateRuntimeConfigJson(); diff --git a/src/tasks/WasmAppBuilder/WasmAppBuilderBaseTask.cs b/src/tasks/WasmAppBuilder/WasmAppBuilderBaseTask.cs index 5372ee59a1f6c0..4eb709af6897a3 100644 --- a/src/tasks/WasmAppBuilder/WasmAppBuilderBaseTask.cs +++ b/src/tasks/WasmAppBuilder/WasmAppBuilderBaseTask.cs @@ -39,6 +39,7 @@ public abstract class WasmAppBuilderBaseTask : Task public int DebugLevel { get; set; } public ITaskItem[] SatelliteAssemblies { get; set; } = Array.Empty(); public bool InvariantGlobalization { get; set; } + public ITaskItem[] FilesToIncludeInFileSystem { get; set; } = Array.Empty(); public ITaskItem[] ExtraFilesToDeploy { get; set; } = Array.Empty(); public string? DefaultHostConfig { get; set; } diff --git a/src/tasks/WasmAppBuilder/wasi/WasiAppBuilder.cs b/src/tasks/WasmAppBuilder/wasi/WasiAppBuilder.cs index 8ad5ee7960de9f..6314e60385ac43 100644 --- a/src/tasks/WasmAppBuilder/wasi/WasiAppBuilder.cs +++ b/src/tasks/WasmAppBuilder/wasi/WasiAppBuilder.cs @@ -77,30 +77,41 @@ protected override bool ExecuteInternal() FileCopyChecked(args.fullPath, Path.Combine(directory, name), "SatelliteAssemblies"); }); - foreach (ITaskItem item in ExtraFilesToDeploy!) - { - string src = item.ItemSpec; - string dst; + if (!DeployFiles(ExtraFilesToDeploy, nameof(ExtraFilesToDeploy))) + return false; + if (!DeployFiles(FilesToIncludeInFileSystem, nameof(FilesToIncludeInFileSystem))) + return false; - string tgtPath = item.GetMetadata("TargetPath"); - if (!string.IsNullOrEmpty(tgtPath)) - { - dst = Path.Combine(AppDir!, tgtPath); - string? dstDir = Path.GetDirectoryName(dst); - if (!string.IsNullOrEmpty(dstDir) && !Directory.Exists(dstDir)) - Directory.CreateDirectory(dstDir!); - } - else + UpdateRuntimeConfigJson(); + return !Log.HasLoggedErrors; + + bool DeployFiles(ITaskItem[] fileItems, string label) + { + foreach (ITaskItem item in fileItems) { - dst = Path.Combine(AppDir!, Path.GetFileName(src)); + string src = item.ItemSpec; + string dst; + + string tgtPath = item.GetMetadata("TargetPath"); + if (!string.IsNullOrEmpty(tgtPath)) + { + dst = Path.Combine(AppDir!, tgtPath); + string? dstDir = Path.GetDirectoryName(dst); + if (!string.IsNullOrEmpty(dstDir) && !Directory.Exists(dstDir)) + Directory.CreateDirectory(dstDir!); + } + else + { + dst = Path.Combine(AppDir!, Path.GetFileName(src)); + } + + if (!FileCopyChecked(src, dst, label)) + return false; } - if (!FileCopyChecked(src, dst, "ExtraFilesToDeploy")) - return false; + return true; } - UpdateRuntimeConfigJson(); - return !Log.HasLoggedErrors; } protected override void AddToRuntimeConfig(JsonObject wasmHostProperties, JsonArray runtimeArgsArray, JsonArray perHostConfigs) From 4a5f9dc0ccdcb58ad1d6d578d3baabbcb5eb13c6 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Fri, 3 Mar 2023 18:57:48 -0500 Subject: [PATCH 25/41] [wasi] Enable System.IO.Packaging, and System.Data.DataSetExtensions tests --- src/libraries/tests.proj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libraries/tests.proj b/src/libraries/tests.proj index b899e2a417a50e..f76673b2352eba 100644 --- a/src/libraries/tests.proj +++ b/src/libraries/tests.proj @@ -557,6 +557,8 @@ + + From 142f8510e7654e6ea3e582d4b2f5e32d56827b37 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Fri, 3 Mar 2023 18:55:22 -0500 Subject: [PATCH 26/41] [wasi] Copy WasmFilesToIncludeInFileSystem to the bundle too This could be changed in the future to include in the single file bundle --- src/mono/wasi/build/WasiApp.targets | 1 + src/tasks/WasmAppBuilder/WasmAppBuilder.cs | 40 +++++++--------- .../WasmAppBuilder/WasmAppBuilderBaseTask.cs | 1 + .../WasmAppBuilder/wasi/WasiAppBuilder.cs | 47 ++++++++++++------- 4 files changed, 49 insertions(+), 40 deletions(-) diff --git a/src/mono/wasi/build/WasiApp.targets b/src/mono/wasi/build/WasiApp.targets index 6085aa2e61ad74..81b5b8ab1eeec3 100644 --- a/src/mono/wasi/build/WasiApp.targets +++ b/src/mono/wasi/build/WasiApp.targets @@ -354,6 +354,7 @@ InvariantGlobalization="$(InvariantGlobalization)" SatelliteAssemblies="@(_WasmSatelliteAssemblies)" IcuDataFileNames="@(WasmIcuDataFileNames)" + FilesToIncludeInFileSystem="@(WasmFilesToIncludeInFileSystem)" ExtraFilesToDeploy="@(WasmExtraFilesToDeploy)" NativeAssets="@(WasmNativeAsset)" DebugLevel="$(WasmDebugLevel)" diff --git a/src/tasks/WasmAppBuilder/WasmAppBuilder.cs b/src/tasks/WasmAppBuilder/WasmAppBuilder.cs index b7441396754fe1..40a74d7f57975f 100644 --- a/src/tasks/WasmAppBuilder/WasmAppBuilder.cs +++ b/src/tasks/WasmAppBuilder/WasmAppBuilder.cs @@ -18,7 +18,6 @@ namespace Microsoft.WebAssembly.Build.Tasks; public class WasmAppBuilder : WasmAppBuilderBaseTask { - public ITaskItem[]? FilesToIncludeInFileSystem { get; set; } public ITaskItem[]? RemoteSources { get; set; } public bool IncludeThreadsWorker {get; set; } public int PThreadPoolSize {get; set; } @@ -265,7 +264,7 @@ protected override bool ExecuteInternal() } }); - if (FilesToIncludeInFileSystem != null) + if (FilesToIncludeInFileSystem.Length > 0) { string supportFilesDir = Path.Combine(AppDir, "supportFiles"); Directory.CreateDirectory(supportFilesDir); @@ -366,29 +365,26 @@ protected override bool ExecuteInternal() Utils.CopyIfDifferent(tmpMonoConfigPath, monoConfigPath, useHash: false); _fileWrites.Add(monoConfigPath); - if (ExtraFilesToDeploy != null) + foreach (ITaskItem item in ExtraFilesToDeploy!) { - foreach (ITaskItem item in ExtraFilesToDeploy!) - { - string src = item.ItemSpec; - string dst; - - string tgtPath = item.GetMetadata("TargetPath"); - if (!string.IsNullOrEmpty(tgtPath)) - { - dst = Path.Combine(AppDir!, tgtPath); - string? dstDir = Path.GetDirectoryName(dst); - if (!string.IsNullOrEmpty(dstDir) && !Directory.Exists(dstDir)) - Directory.CreateDirectory(dstDir!); - } - else - { - dst = Path.Combine(AppDir!, Path.GetFileName(src)); - } + string src = item.ItemSpec; + string dst; - if (!FileCopyChecked(src, dst, "ExtraFilesToDeploy")) - return false; + string tgtPath = item.GetMetadata("TargetPath"); + if (!string.IsNullOrEmpty(tgtPath)) + { + dst = Path.Combine(AppDir!, tgtPath); + string? dstDir = Path.GetDirectoryName(dst); + if (!string.IsNullOrEmpty(dstDir) && !Directory.Exists(dstDir)) + Directory.CreateDirectory(dstDir!); } + else + { + dst = Path.Combine(AppDir!, Path.GetFileName(src)); + } + + if (!FileCopyChecked(src, dst, "ExtraFilesToDeploy")) + return false; } UpdateRuntimeConfigJson(); diff --git a/src/tasks/WasmAppBuilder/WasmAppBuilderBaseTask.cs b/src/tasks/WasmAppBuilder/WasmAppBuilderBaseTask.cs index 5372ee59a1f6c0..4eb709af6897a3 100644 --- a/src/tasks/WasmAppBuilder/WasmAppBuilderBaseTask.cs +++ b/src/tasks/WasmAppBuilder/WasmAppBuilderBaseTask.cs @@ -39,6 +39,7 @@ public abstract class WasmAppBuilderBaseTask : Task public int DebugLevel { get; set; } public ITaskItem[] SatelliteAssemblies { get; set; } = Array.Empty(); public bool InvariantGlobalization { get; set; } + public ITaskItem[] FilesToIncludeInFileSystem { get; set; } = Array.Empty(); public ITaskItem[] ExtraFilesToDeploy { get; set; } = Array.Empty(); public string? DefaultHostConfig { get; set; } diff --git a/src/tasks/WasmAppBuilder/wasi/WasiAppBuilder.cs b/src/tasks/WasmAppBuilder/wasi/WasiAppBuilder.cs index 8ad5ee7960de9f..6314e60385ac43 100644 --- a/src/tasks/WasmAppBuilder/wasi/WasiAppBuilder.cs +++ b/src/tasks/WasmAppBuilder/wasi/WasiAppBuilder.cs @@ -77,30 +77,41 @@ protected override bool ExecuteInternal() FileCopyChecked(args.fullPath, Path.Combine(directory, name), "SatelliteAssemblies"); }); - foreach (ITaskItem item in ExtraFilesToDeploy!) - { - string src = item.ItemSpec; - string dst; + if (!DeployFiles(ExtraFilesToDeploy, nameof(ExtraFilesToDeploy))) + return false; + if (!DeployFiles(FilesToIncludeInFileSystem, nameof(FilesToIncludeInFileSystem))) + return false; - string tgtPath = item.GetMetadata("TargetPath"); - if (!string.IsNullOrEmpty(tgtPath)) - { - dst = Path.Combine(AppDir!, tgtPath); - string? dstDir = Path.GetDirectoryName(dst); - if (!string.IsNullOrEmpty(dstDir) && !Directory.Exists(dstDir)) - Directory.CreateDirectory(dstDir!); - } - else + UpdateRuntimeConfigJson(); + return !Log.HasLoggedErrors; + + bool DeployFiles(ITaskItem[] fileItems, string label) + { + foreach (ITaskItem item in fileItems) { - dst = Path.Combine(AppDir!, Path.GetFileName(src)); + string src = item.ItemSpec; + string dst; + + string tgtPath = item.GetMetadata("TargetPath"); + if (!string.IsNullOrEmpty(tgtPath)) + { + dst = Path.Combine(AppDir!, tgtPath); + string? dstDir = Path.GetDirectoryName(dst); + if (!string.IsNullOrEmpty(dstDir) && !Directory.Exists(dstDir)) + Directory.CreateDirectory(dstDir!); + } + else + { + dst = Path.Combine(AppDir!, Path.GetFileName(src)); + } + + if (!FileCopyChecked(src, dst, label)) + return false; } - if (!FileCopyChecked(src, dst, "ExtraFilesToDeploy")) - return false; + return true; } - UpdateRuntimeConfigJson(); - return !Log.HasLoggedErrors; } protected override void AddToRuntimeConfig(JsonObject wasmHostProperties, JsonArray runtimeArgsArray, JsonArray perHostConfigs) From 5571eb5a3b7420e5ff2d42ad2df98fac299f9cd2 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Fri, 3 Mar 2023 18:57:48 -0500 Subject: [PATCH 27/41] [wasi] Enable System.IO.Packaging, and System.Data.DataSetExtensions tests --- src/libraries/tests.proj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libraries/tests.proj b/src/libraries/tests.proj index 47fc849ed6ede4..6e0fb421c07e38 100644 --- a/src/libraries/tests.proj +++ b/src/libraries/tests.proj @@ -545,6 +545,8 @@ + + From db9ecc347c908bc4d838929397fc2662036f6f84 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Fri, 3 Mar 2023 19:14:56 -0500 Subject: [PATCH 28/41] WasiAppBuilder: Create an empty /tmp --- src/tasks/WasmAppBuilder/wasi/WasiAppBuilder.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/tasks/WasmAppBuilder/wasi/WasiAppBuilder.cs b/src/tasks/WasmAppBuilder/wasi/WasiAppBuilder.cs index 6314e60385ac43..5d13cba888221c 100644 --- a/src/tasks/WasmAppBuilder/wasi/WasiAppBuilder.cs +++ b/src/tasks/WasmAppBuilder/wasi/WasiAppBuilder.cs @@ -62,6 +62,7 @@ protected override bool ExecuteInternal() } } + // TODO: Files on disk are not solved for IsSingleFileBundle yet foreach (ITaskItem item in NativeAssets) { string dest = Path.Combine(AppDir, Path.GetFileName(item.ItemSpec)); @@ -82,6 +83,8 @@ protected override bool ExecuteInternal() if (!DeployFiles(FilesToIncludeInFileSystem, nameof(FilesToIncludeInFileSystem))) return false; + Directory.CreateDirectory(Path.Combine(AppDir, "tmp")); + UpdateRuntimeConfigJson(); return !Log.HasLoggedErrors; From 492ac1191b9f034a688ab5596d2a84f77f0bdcc7 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Fri, 3 Mar 2023 19:15:26 -0500 Subject: [PATCH 29/41] Disable System.Runtime.Serialization.Xml.XsdDataContractExporterTests.ExporterTypesTests.TypesTest_Negative - Issue: https://github.com/dotnet/runtime/issues/82967 --- .../tests/XsdDataContractExporterTests/ExporterTypesTests.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libraries/System.Runtime.Serialization.Xml/tests/XsdDataContractExporterTests/ExporterTypesTests.cs b/src/libraries/System.Runtime.Serialization.Xml/tests/XsdDataContractExporterTests/ExporterTypesTests.cs index 6c9ac368fae3f3..c21b3157294a8d 100644 --- a/src/libraries/System.Runtime.Serialization.Xml/tests/XsdDataContractExporterTests/ExporterTypesTests.cs +++ b/src/libraries/System.Runtime.Serialization.Xml/tests/XsdDataContractExporterTests/ExporterTypesTests.cs @@ -81,6 +81,7 @@ public static IEnumerable GetDynamicallyVersionedTypesTestNegativeData [Theory] [SkipOnPlatform(TestPlatforms.Browser, "Inconsistent and unpredictable results.")] // TODO - Why does 'TypeWithReadWriteCollectionAndNoCtorOnCollection' only cause an exception sometimes, but not all the time? What's special about wasm here? + [ActiveIssue("https://github.com/dotnet/runtime/issues/82967", TestPlatforms.Wasi)] [InlineData(typeof(NoDataContractWithoutParameterlessConstructor), typeof(InvalidDataContractException), @"Type 'System.Runtime.Serialization.Xml.XsdDataContractExporterTests.ExporterTypesTests+NoDataContractWithoutParameterlessConstructor' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute. Alternatively, you can ensure that the type is public and has a parameterless constructor - all public members of the type will then be serialized, and no attributes will be required.")] [InlineData(typeof(DataContractWithInvalidMember), typeof(InvalidDataContractException), @"Type 'System.Runtime.Serialization.Xml.XsdDataContractExporterTests.ExporterTypesTests+NoDataContractWithoutParameterlessConstructor' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute. Alternatively, you can ensure that the type is public and has a parameterless constructor - all public members of the type will then be serialized, and no attributes will be required.")] [InlineData(typeof(SerializableWithInvalidMember), typeof(InvalidDataContractException), @"Type 'System.Runtime.Serialization.Xml.XsdDataContractExporterTests.ExporterTypesTests+NoDataContractWithoutParameterlessConstructor' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute. Alternatively, you can ensure that the type is public and has a parameterless constructor - all public members of the type will then be serialized, and no attributes will be required.")] From 7e8fa16a335c946ae3b44522e21fb0f29e19a587 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Fri, 3 Mar 2023 19:18:14 -0500 Subject: [PATCH 30/41] Enable System.Runtime.Serialization.Xml.Tests, and System.Runtime.Serialization.Xml.ReflectionOnly.Tests Remaining fixed by adding `/tmp` --- src/libraries/tests.proj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libraries/tests.proj b/src/libraries/tests.proj index 6e0fb421c07e38..21221cfde4ef94 100644 --- a/src/libraries/tests.proj +++ b/src/libraries/tests.proj @@ -547,6 +547,8 @@ + + From fd8c44ff7b448ae68169d9bc29d03f52b16c1008 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Fri, 3 Mar 2023 23:51:43 +0000 Subject: [PATCH 31/41] [wasi] Copy WasmFilesToIncludeInFileSystem to the bundle too --- src/mono/wasi/build/WasiApp.targets | 1 + src/tasks/WasmAppBuilder/WasmAppBuilder.cs | 40 +++++++--------- .../WasmAppBuilder/WasmAppBuilderBaseTask.cs | 1 + .../WasmAppBuilder/wasi/WasiAppBuilder.cs | 47 ++++++++++++------- 4 files changed, 49 insertions(+), 40 deletions(-) diff --git a/src/mono/wasi/build/WasiApp.targets b/src/mono/wasi/build/WasiApp.targets index 6085aa2e61ad74..81b5b8ab1eeec3 100644 --- a/src/mono/wasi/build/WasiApp.targets +++ b/src/mono/wasi/build/WasiApp.targets @@ -354,6 +354,7 @@ InvariantGlobalization="$(InvariantGlobalization)" SatelliteAssemblies="@(_WasmSatelliteAssemblies)" IcuDataFileNames="@(WasmIcuDataFileNames)" + FilesToIncludeInFileSystem="@(WasmFilesToIncludeInFileSystem)" ExtraFilesToDeploy="@(WasmExtraFilesToDeploy)" NativeAssets="@(WasmNativeAsset)" DebugLevel="$(WasmDebugLevel)" diff --git a/src/tasks/WasmAppBuilder/WasmAppBuilder.cs b/src/tasks/WasmAppBuilder/WasmAppBuilder.cs index b7441396754fe1..40a74d7f57975f 100644 --- a/src/tasks/WasmAppBuilder/WasmAppBuilder.cs +++ b/src/tasks/WasmAppBuilder/WasmAppBuilder.cs @@ -18,7 +18,6 @@ namespace Microsoft.WebAssembly.Build.Tasks; public class WasmAppBuilder : WasmAppBuilderBaseTask { - public ITaskItem[]? FilesToIncludeInFileSystem { get; set; } public ITaskItem[]? RemoteSources { get; set; } public bool IncludeThreadsWorker {get; set; } public int PThreadPoolSize {get; set; } @@ -265,7 +264,7 @@ protected override bool ExecuteInternal() } }); - if (FilesToIncludeInFileSystem != null) + if (FilesToIncludeInFileSystem.Length > 0) { string supportFilesDir = Path.Combine(AppDir, "supportFiles"); Directory.CreateDirectory(supportFilesDir); @@ -366,29 +365,26 @@ protected override bool ExecuteInternal() Utils.CopyIfDifferent(tmpMonoConfigPath, monoConfigPath, useHash: false); _fileWrites.Add(monoConfigPath); - if (ExtraFilesToDeploy != null) + foreach (ITaskItem item in ExtraFilesToDeploy!) { - foreach (ITaskItem item in ExtraFilesToDeploy!) - { - string src = item.ItemSpec; - string dst; - - string tgtPath = item.GetMetadata("TargetPath"); - if (!string.IsNullOrEmpty(tgtPath)) - { - dst = Path.Combine(AppDir!, tgtPath); - string? dstDir = Path.GetDirectoryName(dst); - if (!string.IsNullOrEmpty(dstDir) && !Directory.Exists(dstDir)) - Directory.CreateDirectory(dstDir!); - } - else - { - dst = Path.Combine(AppDir!, Path.GetFileName(src)); - } + string src = item.ItemSpec; + string dst; - if (!FileCopyChecked(src, dst, "ExtraFilesToDeploy")) - return false; + string tgtPath = item.GetMetadata("TargetPath"); + if (!string.IsNullOrEmpty(tgtPath)) + { + dst = Path.Combine(AppDir!, tgtPath); + string? dstDir = Path.GetDirectoryName(dst); + if (!string.IsNullOrEmpty(dstDir) && !Directory.Exists(dstDir)) + Directory.CreateDirectory(dstDir!); } + else + { + dst = Path.Combine(AppDir!, Path.GetFileName(src)); + } + + if (!FileCopyChecked(src, dst, "ExtraFilesToDeploy")) + return false; } UpdateRuntimeConfigJson(); diff --git a/src/tasks/WasmAppBuilder/WasmAppBuilderBaseTask.cs b/src/tasks/WasmAppBuilder/WasmAppBuilderBaseTask.cs index 5372ee59a1f6c0..4eb709af6897a3 100644 --- a/src/tasks/WasmAppBuilder/WasmAppBuilderBaseTask.cs +++ b/src/tasks/WasmAppBuilder/WasmAppBuilderBaseTask.cs @@ -39,6 +39,7 @@ public abstract class WasmAppBuilderBaseTask : Task public int DebugLevel { get; set; } public ITaskItem[] SatelliteAssemblies { get; set; } = Array.Empty(); public bool InvariantGlobalization { get; set; } + public ITaskItem[] FilesToIncludeInFileSystem { get; set; } = Array.Empty(); public ITaskItem[] ExtraFilesToDeploy { get; set; } = Array.Empty(); public string? DefaultHostConfig { get; set; } diff --git a/src/tasks/WasmAppBuilder/wasi/WasiAppBuilder.cs b/src/tasks/WasmAppBuilder/wasi/WasiAppBuilder.cs index 8ad5ee7960de9f..6314e60385ac43 100644 --- a/src/tasks/WasmAppBuilder/wasi/WasiAppBuilder.cs +++ b/src/tasks/WasmAppBuilder/wasi/WasiAppBuilder.cs @@ -77,30 +77,41 @@ protected override bool ExecuteInternal() FileCopyChecked(args.fullPath, Path.Combine(directory, name), "SatelliteAssemblies"); }); - foreach (ITaskItem item in ExtraFilesToDeploy!) - { - string src = item.ItemSpec; - string dst; + if (!DeployFiles(ExtraFilesToDeploy, nameof(ExtraFilesToDeploy))) + return false; + if (!DeployFiles(FilesToIncludeInFileSystem, nameof(FilesToIncludeInFileSystem))) + return false; - string tgtPath = item.GetMetadata("TargetPath"); - if (!string.IsNullOrEmpty(tgtPath)) - { - dst = Path.Combine(AppDir!, tgtPath); - string? dstDir = Path.GetDirectoryName(dst); - if (!string.IsNullOrEmpty(dstDir) && !Directory.Exists(dstDir)) - Directory.CreateDirectory(dstDir!); - } - else + UpdateRuntimeConfigJson(); + return !Log.HasLoggedErrors; + + bool DeployFiles(ITaskItem[] fileItems, string label) + { + foreach (ITaskItem item in fileItems) { - dst = Path.Combine(AppDir!, Path.GetFileName(src)); + string src = item.ItemSpec; + string dst; + + string tgtPath = item.GetMetadata("TargetPath"); + if (!string.IsNullOrEmpty(tgtPath)) + { + dst = Path.Combine(AppDir!, tgtPath); + string? dstDir = Path.GetDirectoryName(dst); + if (!string.IsNullOrEmpty(dstDir) && !Directory.Exists(dstDir)) + Directory.CreateDirectory(dstDir!); + } + else + { + dst = Path.Combine(AppDir!, Path.GetFileName(src)); + } + + if (!FileCopyChecked(src, dst, label)) + return false; } - if (!FileCopyChecked(src, dst, "ExtraFilesToDeploy")) - return false; + return true; } - UpdateRuntimeConfigJson(); - return !Log.HasLoggedErrors; } protected override void AddToRuntimeConfig(JsonObject wasmHostProperties, JsonArray runtimeArgsArray, JsonArray perHostConfigs) From dac958266d5e8e632c8d0fc45f0a4cdd167c48d4 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Sat, 4 Mar 2023 00:20:15 +0000 Subject: [PATCH 32/41] wip --- .../tests/XsdDataContractExporterTests/ExporterTypesTests.cs | 1 + src/tasks/WasmAppBuilder/wasi/WasiAppBuilder.cs | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/libraries/System.Runtime.Serialization.Xml/tests/XsdDataContractExporterTests/ExporterTypesTests.cs b/src/libraries/System.Runtime.Serialization.Xml/tests/XsdDataContractExporterTests/ExporterTypesTests.cs index 6c9ac368fae3f3..c21b3157294a8d 100644 --- a/src/libraries/System.Runtime.Serialization.Xml/tests/XsdDataContractExporterTests/ExporterTypesTests.cs +++ b/src/libraries/System.Runtime.Serialization.Xml/tests/XsdDataContractExporterTests/ExporterTypesTests.cs @@ -81,6 +81,7 @@ public static IEnumerable GetDynamicallyVersionedTypesTestNegativeData [Theory] [SkipOnPlatform(TestPlatforms.Browser, "Inconsistent and unpredictable results.")] // TODO - Why does 'TypeWithReadWriteCollectionAndNoCtorOnCollection' only cause an exception sometimes, but not all the time? What's special about wasm here? + [ActiveIssue("https://github.com/dotnet/runtime/issues/82967", TestPlatforms.Wasi)] [InlineData(typeof(NoDataContractWithoutParameterlessConstructor), typeof(InvalidDataContractException), @"Type 'System.Runtime.Serialization.Xml.XsdDataContractExporterTests.ExporterTypesTests+NoDataContractWithoutParameterlessConstructor' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute. Alternatively, you can ensure that the type is public and has a parameterless constructor - all public members of the type will then be serialized, and no attributes will be required.")] [InlineData(typeof(DataContractWithInvalidMember), typeof(InvalidDataContractException), @"Type 'System.Runtime.Serialization.Xml.XsdDataContractExporterTests.ExporterTypesTests+NoDataContractWithoutParameterlessConstructor' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute. Alternatively, you can ensure that the type is public and has a parameterless constructor - all public members of the type will then be serialized, and no attributes will be required.")] [InlineData(typeof(SerializableWithInvalidMember), typeof(InvalidDataContractException), @"Type 'System.Runtime.Serialization.Xml.XsdDataContractExporterTests.ExporterTypesTests+NoDataContractWithoutParameterlessConstructor' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute. Alternatively, you can ensure that the type is public and has a parameterless constructor - all public members of the type will then be serialized, and no attributes will be required.")] diff --git a/src/tasks/WasmAppBuilder/wasi/WasiAppBuilder.cs b/src/tasks/WasmAppBuilder/wasi/WasiAppBuilder.cs index 6314e60385ac43..bf39ee10dfb1aa 100644 --- a/src/tasks/WasmAppBuilder/wasi/WasiAppBuilder.cs +++ b/src/tasks/WasmAppBuilder/wasi/WasiAppBuilder.cs @@ -82,6 +82,8 @@ protected override bool ExecuteInternal() if (!DeployFiles(FilesToIncludeInFileSystem, nameof(FilesToIncludeInFileSystem))) return false; + Directory.CreateDirectory(Path.Combine(AppDir, "tmp")); + UpdateRuntimeConfigJson(); return !Log.HasLoggedErrors; From 80d31079ae773e23bc9b23b8e3c8ea5fc3982718 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Sat, 4 Mar 2023 07:00:07 +0800 Subject: [PATCH 33/41] Implement managed SegmentCommandLine (#82883) * Implement managed version of SegmentCommandLine * Remove P/Invoke for CommandLineToArgv * Update parsing to latest UCRT * Add test and fix trailing space in command * Fix test cases --- .../Shell32/Interop.CommandLineToArgv.cs | 13 -- .../System.Private.CoreLib.Shared.projitems | 5 +- .../src/System/Environment.Windows.cs | 147 ++++++++++++++++-- .../System/Environment.GetCommandLineArgs.cs | 25 +++ 4 files changed, 160 insertions(+), 30 deletions(-) delete mode 100644 src/libraries/Common/src/Interop/Windows/Shell32/Interop.CommandLineToArgv.cs diff --git a/src/libraries/Common/src/Interop/Windows/Shell32/Interop.CommandLineToArgv.cs b/src/libraries/Common/src/Interop/Windows/Shell32/Interop.CommandLineToArgv.cs deleted file mode 100644 index ecc73f56005e0e..00000000000000 --- a/src/libraries/Common/src/Interop/Windows/Shell32/Interop.CommandLineToArgv.cs +++ /dev/null @@ -1,13 +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.Runtime.InteropServices; - -internal static unsafe partial class Interop -{ - internal static partial class Shell32 - { - [LibraryImport(Libraries.Shell32, EntryPoint = "CommandLineToArgvW")] - internal static partial char** CommandLineToArgv(char* lpCommandLine, int* pNumArgs); - } -} 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 b200e12ef36c5c..f28e4c0ac8eba9 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 @@ -1938,9 +1938,6 @@ Common\Interop\Windows\Secur32\Interop.GetUserNameExW.cs - - Common\Interop\Windows\Shell32\Interop.CommandLineToArgv.cs - Common\Interop\Windows\Shell32\Interop.SHGetKnownFolderPath.cs @@ -2577,4 +2574,4 @@ - + \ No newline at end of file diff --git a/src/libraries/System.Private.CoreLib/src/System/Environment.Windows.cs b/src/libraries/System.Private.CoreLib/src/System/Environment.Windows.cs index 5934ac451ff366..5344f92ac8e5d4 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Environment.Windows.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Environment.Windows.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using Microsoft.Win32.SafeHandles; +using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Runtime.CompilerServices; @@ -216,26 +217,146 @@ private static unsafe string[] GetCommandLineArgsNative() char* lpCmdLine = Interop.Kernel32.GetCommandLine(); Debug.Assert(lpCmdLine != null); - int numArgs = 0; - char** argvW = Interop.Shell32.CommandLineToArgv(lpCmdLine, &numArgs); - if (argvW == null) - { - ThrowHelper.ThrowOutOfMemoryException(); - } + return SegmentCommandLine(lpCmdLine); + } - try + private static unsafe string[] SegmentCommandLine(char* cmdLine) + { + // Parse command line arguments using the rules documented at + // https://learn.microsoft.com/cpp/cpp/main-function-command-line-args#parsing-c-command-line-arguments + + // CommandLineToArgvW API cannot be used here since + // it has slightly different behavior. + + ArrayBuilder arrayBuilder = default; + + Span stringBuffer = stackalloc char[260]; // Use MAX_PATH for a typical maximum + scoped ValueStringBuilder stringBuilder; + + char c; + + // First scan the program name, copy it, and count the bytes + + char* p = cmdLine; + + // A quoted program name is handled here. The handling is much + // simpler than for other arguments. Basically, whatever lies + // between the leading double-quote and next one, or a terminal null + // character is simply accepted. Fancier handling is not required + // because the program name must be a legal NTFS/HPFS file name. + // Note that the double-quote characters are not copied, nor do they + // contribyte to character_count. + + bool inQuotes = false; + stringBuilder = new ValueStringBuilder(stringBuffer); + + do { - string[] result = new string[numArgs]; - for (int i = 0; i < result.Length; i++) + if (*p == '"') { - result[i] = new string(*(argvW + i)); + inQuotes = !inQuotes; + c = *p++; + continue; } - return result; + + c = *p++; + stringBuilder.Append(c); } - finally + while (c != '\0' && (inQuotes || (c is not (' ' or '\t')))); + + if (c == '\0') { - Interop.Kernel32.LocalFree((IntPtr)argvW); + p--; } + + stringBuilder.Length--; + arrayBuilder.Add(stringBuilder.ToString()); + inQuotes = false; + + // loop on each argument + while (true) + { + if (*p != '\0') + { + while (*p is ' ' or '\t') + { + ++p; + } + } + + if (*p == '\0') + { + // end of args + break; + } + + // scan an argument + stringBuilder = new ValueStringBuilder(stringBuffer); + + // loop through scanning one argument + while (true) + { + bool copyChar = true; + + // Rules: + // 2N backslashes + " ==> N backslashes and begin/end quote + // 2N+1 backslashes + " ==> N backslashes + literal " + // N backslashes ==> N backslashes + int numSlash = 0; + + while (*p == '\\') + { + // Count number of backslashes for use below + ++p; + ++numSlash; + } + + if (*p == '"') + { + // if 2N backslashes before, start / end quote, otherwise + // copy literally: + if (numSlash % 2 == 0) + { + if (inQuotes && p[1] == '"') + { + p++; // Double quote inside quoted string + } + else + { + // Skip first quote char and copy second: + copyChar = false; // Don't copy quote + inQuotes = !inQuotes; + } + } + + numSlash /= 2; + } + + // Copy slashes: + while (numSlash-- > 0) + { + stringBuilder.Append('\\'); + } + + // If at end of arg, break loop: + if (*p == '\0' || (!inQuotes && *p is ' ' or '\t')) + { + break; + } + + // Copy character into argument: + if (copyChar) + { + stringBuilder.Append(*p); + } + + ++p; + } + + arrayBuilder.Add(stringBuilder.ToString()); + } + + return arrayBuilder.ToArray(); } } } diff --git a/src/libraries/System.Runtime.Extensions/tests/System/Environment.GetCommandLineArgs.cs b/src/libraries/System.Runtime.Extensions/tests/System/Environment.GetCommandLineArgs.cs index dc07a790909757..759f0e07ac6ad9 100644 --- a/src/libraries/System.Runtime.Extensions/tests/System/Environment.GetCommandLineArgs.cs +++ b/src/libraries/System.Runtime.Extensions/tests/System/Environment.GetCommandLineArgs.cs @@ -103,5 +103,30 @@ public static int CheckCommandLineArgsFallback() return RemoteExecutor.SuccessExitCode; } + + public static bool IsWindowsCoreCLRJit + => PlatformDetection.IsWindows + && PlatformDetection.IsNotMonoRuntime + && PlatformDetection.IsNotNativeAot; + + [ConditionalTheory(typeof(GetCommandLineArgs), nameof(IsWindowsCoreCLRJit))] + [InlineData(@"cmd ""abc"" d e", new[] { "cmd", "abc", "d", "e" })] + [InlineData(@"cmd a\\b d""e f""g h", new[] { "cmd", @"a\\b", "de fg", "h" })] + [InlineData(@"cmd a\\\""b c d", new[] { "cmd", @"a\""b", "c", "d" })] + [InlineData(@"cmd a\\\\""b c"" d e", new[] { "cmd", @"a\\b c", "d", "e" })] + [InlineData(@"cmd a""b"""" c d", new[] { "cmd", @"ab"" c d" })] + [InlineData(@"X:\No""t A"""" P""ath arg", new[] { @"X:\Not A Path", "arg" })] + [InlineData(@"""\\Some Server\cmd"" ""arg", new[] { @"\\Some Server\cmd", "arg" })] + public static unsafe void CheckCommandLineParser(string cmdLine, string[] args) + { + var method = typeof(Environment).GetMethod("SegmentCommandLine", BindingFlags.Static | BindingFlags.NonPublic); + Assert.NotNull(method); + + var span = cmdLine.AsSpan(); // Workaround + fixed (char* p = span) + { + Assert.Equal(args, method.Invoke(null, new object[] { Pointer.Box(p, typeof(char*)) })); + } + } } } From da53a7e33e4b0973dde109493c34b8499f0c8dc9 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Fri, 3 Mar 2023 18:57:48 -0500 Subject: [PATCH 34/41] [wasi] Enable System.IO.Packaging, and System.Data.DataSetExtensions tests --- src/libraries/tests.proj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libraries/tests.proj b/src/libraries/tests.proj index b899e2a417a50e..f76673b2352eba 100644 --- a/src/libraries/tests.proj +++ b/src/libraries/tests.proj @@ -557,6 +557,8 @@ + + From f886a5e223f158cf15752d1814b603e2d68097dd Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Fri, 3 Mar 2023 19:14:56 -0500 Subject: [PATCH 35/41] WasiAppBuilder: Create an empty /tmp --- src/tasks/WasmAppBuilder/wasi/WasiAppBuilder.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tasks/WasmAppBuilder/wasi/WasiAppBuilder.cs b/src/tasks/WasmAppBuilder/wasi/WasiAppBuilder.cs index bf39ee10dfb1aa..5d13cba888221c 100644 --- a/src/tasks/WasmAppBuilder/wasi/WasiAppBuilder.cs +++ b/src/tasks/WasmAppBuilder/wasi/WasiAppBuilder.cs @@ -62,6 +62,7 @@ protected override bool ExecuteInternal() } } + // TODO: Files on disk are not solved for IsSingleFileBundle yet foreach (ITaskItem item in NativeAssets) { string dest = Path.Combine(AppDir, Path.GetFileName(item.ItemSpec)); From 1d30b3f4be14e41fd60cfbebe9e3d582f43bf290 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Fri, 3 Mar 2023 19:18:14 -0500 Subject: [PATCH 36/41] Enable System.Runtime.Serialization.Xml.Tests, and System.Runtime.Serialization.Xml.ReflectionOnly.Tests Remaining fixed by adding `/tmp` --- src/libraries/tests.proj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libraries/tests.proj b/src/libraries/tests.proj index f76673b2352eba..337207e0983cd8 100644 --- a/src/libraries/tests.proj +++ b/src/libraries/tests.proj @@ -559,6 +559,8 @@ + + From c7ecd57af9f39effb185ca35a67c4dda625e9499 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Sat, 4 Mar 2023 00:39:24 +0000 Subject: [PATCH 37/41] Disable some System.Data.Common tests, matching browser --- .../tests/System/Data/Common/DbProviderFactoriesTests.cs | 2 +- .../tests/System/Data/Common/DbProviderFactoryTest.cs | 2 +- .../tests/System/Data/DataTableExtensionsTest.cs | 2 +- .../System.Data.Common/tests/System/Data/FacadeTest.cs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libraries/System.Data.Common/tests/System/Data/Common/DbProviderFactoriesTests.cs b/src/libraries/System.Data.Common/tests/System/Data/Common/DbProviderFactoriesTests.cs index b758b3967c62ee..b367448275e60c 100644 --- a/src/libraries/System.Data.Common/tests/System/Data/Common/DbProviderFactoriesTests.cs +++ b/src/libraries/System.Data.Common/tests/System/Data/Common/DbProviderFactoriesTests.cs @@ -15,7 +15,7 @@ public sealed class TestProviderFactory : DbProviderFactory private TestProviderFactory() { } } - [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser.")] + [SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.Wasi, "Not supported on Browser/Wasi.")] public class DbProviderFactoriesTests { [Fact] diff --git a/src/libraries/System.Data.Common/tests/System/Data/Common/DbProviderFactoryTest.cs b/src/libraries/System.Data.Common/tests/System/Data/Common/DbProviderFactoryTest.cs index 92f2cb69b0bfae..2486f74255f11a 100644 --- a/src/libraries/System.Data.Common/tests/System/Data/Common/DbProviderFactoryTest.cs +++ b/src/libraries/System.Data.Common/tests/System/Data/Common/DbProviderFactoryTest.cs @@ -6,7 +6,7 @@ namespace System.Data.Tests.Common { - [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser.")] + [SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.Wasi, "Not supported on Browser/Wasi.")] public class DbProviderFactoryTest { [Fact] diff --git a/src/libraries/System.Data.Common/tests/System/Data/DataTableExtensionsTest.cs b/src/libraries/System.Data.Common/tests/System/Data/DataTableExtensionsTest.cs index 9d73511e9b07a9..84f453abed5251 100644 --- a/src/libraries/System.Data.Common/tests/System/Data/DataTableExtensionsTest.cs +++ b/src/libraries/System.Data.Common/tests/System/Data/DataTableExtensionsTest.cs @@ -5,7 +5,7 @@ namespace System.Data.Tests { - [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser.")] + [SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.Wasi, "Not supported on Browser/Wasi.")] public class DataTableExtensionsTest { private DataTable _dt; diff --git a/src/libraries/System.Data.Common/tests/System/Data/FacadeTest.cs b/src/libraries/System.Data.Common/tests/System/Data/FacadeTest.cs index de9ce64a4c1ade..c9f07bce8cba5b 100644 --- a/src/libraries/System.Data.Common/tests/System/Data/FacadeTest.cs +++ b/src/libraries/System.Data.Common/tests/System/Data/FacadeTest.cs @@ -10,7 +10,7 @@ public class FacadeTest [Theory] [InlineData("Microsoft.SqlServer.Server.SqlMetaData")] // Type from System.Data.SqlClient [InlineData("System.Data.SqlTypes.SqlBytes")] // Type from System.Data.Common - [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser.")] + [SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.Wasi, "Not supported on Browser/Wasi.")] public void TestSystemData(string typeName) { // Verify that the type can be loaded via .NET Framework compat facade From 3530475b277652ad54465756cd905aa91e746878 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Mon, 6 Mar 2023 17:05:13 -0500 Subject: [PATCH 38/41] Disable Microsoft.Extensions.Configuration.FileExtensions.Tests as it depends on GetTempSubDirectory which needs mkdtemp --- src/libraries/tests.proj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libraries/tests.proj b/src/libraries/tests.proj index f76673b2352eba..c3fc7eb1d397ec 100644 --- a/src/libraries/tests.proj +++ b/src/libraries/tests.proj @@ -411,6 +411,8 @@ + + From c50f8b92ee2956fd264ece1bf562b23bc5d8a58b Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Mon, 6 Mar 2023 17:06:21 -0500 Subject: [PATCH 39/41] Throw PNSE for Path.GetTempFileName, and Directory.GetTempSubDirectory --- .../System.Private.CoreLib/src/System/IO/Directory.Unix.cs | 3 +++ .../System.Private.CoreLib/src/System/IO/Path.Unix.cs | 3 +++ src/native/libs/System.Native/pal_io.c | 3 ++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/libraries/System.Private.CoreLib/src/System/IO/Directory.Unix.cs b/src/libraries/System.Private.CoreLib/src/System/IO/Directory.Unix.cs index 26116cd19e4f78..e5a5ceec27c8e6 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IO/Directory.Unix.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IO/Directory.Unix.cs @@ -26,6 +26,9 @@ private static DirectoryInfo CreateDirectoryCore(string path, UnixFileMode unixC private static unsafe string CreateTempSubdirectoryCore(string? prefix) { + if (OperatingSystem.IsWasi()) + throw new PlatformNotSupportedException(); + // mkdtemp takes a char* and overwrites the XXXXXX with six characters // that'll result in a unique directory name. string tempPath = Path.GetTempPath(); diff --git a/src/libraries/System.Private.CoreLib/src/System/IO/Path.Unix.cs b/src/libraries/System.Private.CoreLib/src/System/IO/Path.Unix.cs index e7b21263a8be1f..6b28ceccb51efc 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IO/Path.Unix.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IO/Path.Unix.cs @@ -94,6 +94,9 @@ public static string GetTempPath() public static unsafe string GetTempFileName() { + if (OperatingSystem.IsWasi()) + throw new PlatformNotSupportedException(); + const int SuffixByteLength = 4; // ".tmp" ReadOnlySpan fileTemplate = "tmpXXXXXX.tmp"u8; diff --git a/src/native/libs/System.Native/pal_io.c b/src/native/libs/System.Native/pal_io.c index 7551b426d0b844..975b0eb5a3e489 100644 --- a/src/native/libs/System.Native/pal_io.c +++ b/src/native/libs/System.Native/pal_io.c @@ -892,10 +892,11 @@ intptr_t SystemNative_MksTemps(char* pathTemplate, int32_t suffixLength) #elif TARGET_WASI assert_msg(false, "Not supported on WASI", 0); result = -1; + errno = ENOTSUP; #else #error "Cannot find mkstemps nor mkstemp on this platform" #endif - return result; + return result; } static int32_t ConvertMMapProtection(int32_t protection) From ccd951bf256ae77445846f81683f5a31e22d7798 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Mon, 6 Mar 2023 17:11:28 -0500 Subject: [PATCH 40/41] Disable Microsoft.Extensions.Configuration.Functional.Tests as it depends on GetTempSubDirectory which needs mkdtemp --- src/libraries/tests.proj | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libraries/tests.proj b/src/libraries/tests.proj index c3fc7eb1d397ec..af4cb739eeca41 100644 --- a/src/libraries/tests.proj +++ b/src/libraries/tests.proj @@ -413,6 +413,7 @@ + From 9de5f1e1905635c1d6ddf71f3aa295f74215689d Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Mon, 6 Mar 2023 17:17:37 -0500 Subject: [PATCH 41/41] Disable Microsoft.Extensions.Configuration.UserSecrets.Tests - cannot determine user secrets folder --- src/libraries/tests.proj | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libraries/tests.proj b/src/libraries/tests.proj index af4cb739eeca41..e36277eadda0b3 100644 --- a/src/libraries/tests.proj +++ b/src/libraries/tests.proj @@ -414,6 +414,9 @@ + + +