diff --git a/eng/pipelines/runtime-manual.yml b/eng/pipelines/runtime-manual.yml
index 4da10d969f39bb..fccddad5db0098 100644
--- a/eng/pipelines/runtime-manual.yml
+++ b/eng/pipelines/runtime-manual.yml
@@ -503,6 +503,7 @@ jobs:
or(
eq(variables['librariesContainsChange'], true),
eq(variables['monoContainsChange'], true),
+ eq(variables['isManualOrIsNotPR'], true),
eq(variables['isFullMatrix'], true))
#
diff --git a/src/libraries/sendtohelixhelp.proj b/src/libraries/sendtohelixhelp.proj
index 39e85a0a1a5f89..f1c68f3afdb0c3 100644
--- a/src/libraries/sendtohelixhelp.proj
+++ b/src/libraries/sendtohelixhelp.proj
@@ -489,7 +489,7 @@
<_WorkItem Include="$(WorkItemArchiveWildCard)" Exclude="$(HelixCorrelationPayload)" />
- <_WorkItem Include="$(TestArchiveRoot)runonly/**/WebAssembly.Console.*.Test.zip" Condition="'$(TargetOS)' == 'Browser' and '$(Scenario)' != 'WasmTestOnBrowser' and '$(Scenario)' != 'BuildWasmApps'" />
+ <_WorkItem Include="$(TestArchiveRoot)runonly/**/WebAssembly.Console.*.Test.zip" Condition="'$(TargetOS)' == 'Browser' and '$(Scenario)' != 'WasmTestOnBrowser' and '$(Scenario)' != 'BuildWasmApps' and '$(Scenario)' != 'WasmDebuggerTests'" />
<_WorkItem Include="$(TestArchiveRoot)runonly/**/WebAssembly.Browser.*.Test.zip" Condition="'$(TargetOS)' == 'Browser' and '$(Scenario)' == 'WasmTestOnBrowser'" />
<_WorkItem Include="$(TestArchiveRoot)browseronly/**/*.zip" Condition="'$(TargetOS)' == 'Browser' and '$(Scenario)' == 'WasmTestOnBrowser'" />
@@ -542,20 +542,48 @@
%XHARNESS_COMMAND%
-
-
- <_RunOnlyWorkItem Include="$(TestArchiveRoot)runonly/**/*.Console.Sample.zip" />
-
+
+
+ <_RunOnlyWorkItemCJS Include="$(TestArchiveRoot)runonly/**/*.Console.V8.CJS.Sample.zip" />
+
%(Identity)
- $(ExecXHarnessCmd) wasm $(XHarnessCommand) --app=. --engine=V8 --engine-arg=--stack-trace-limit=1000 --js-file=test-main.js --output-directory=$(XHarnessOutput) -- --run %(FileName).dll
+ $(ExecXHarnessCmd) wasm $(XHarnessCommand) --app=. --engine=V8 --engine-arg=--stack-trace-limit=1000 --js-file=main.cjs --output-directory=$(XHarnessOutput) -- --run %(FileName).dll
+
+ <_RunOnlyWorkItemES6 Include="$(TestArchiveRoot)runonly/**/*.Console.V8.ES6.Sample.zip" />
+
+ %(Identity)
+
+ $(ExecXHarnessCmd) wasm $(XHarnessCommand) --app=. --engine=V8 --engine-arg=--stack-trace-limit=1000 --js-file=v8shim.cjs --output-directory=$(XHarnessOutput) -- --run %(FileName).dll
+
+
+ <_RunOnlyWorkItemCJS Include="$(TestArchiveRoot)runonly/**/*.Console.Node.CJS.Sample.zip" />
+
+ %(Identity)
+
+ $(ExecXHarnessCmd) wasm $(XHarnessCommand) --app=. --engine=NodeJS --engine-arg=--stack-trace-limit=1000 --js-file=main.cjs --output-directory=$(XHarnessOutput) -- --run %(FileName).dll
+
+ <_RunOnlyWorkItemES6 Include="$(TestArchiveRoot)runonly/**/*.Console.Node.ES6.Sample.zip" />
+
+ %(Identity)
+
+ $(ExecXHarnessCmd) wasm $(XHarnessCommand) --app=. --engine=NodeJS --engine-arg=--stack-trace-limit=1000 --js-file=main.mjs --output-directory=$(XHarnessOutput) -- --run %(FileName).dll
+
+
+
+
-
- <_RunOnlyWorkItem Include="$(TestArchiveRoot)runonly/**/*.Browser.Sample.zip" />
-
+ <_RunOnlyWorkItemCJS Include="$(TestArchiveRoot)runonly/**/*.Browser.CJS.Sample.zip" />
+
+ %(Identity)
+
+ $(ExecXHarnessCmd) wasm $(XHarnessCommand) --app=. --browser=Chrome $(XHarnessBrowserPathArg) --html-file=index.html --output-directory=$(XHarnessOutput) -- %(FileName).dll
+
+ <_RunOnlyWorkItemES6 Include="$(TestArchiveRoot)runonly/**/*.Browser.ES6.Sample.zip" />
+
%(Identity)
$(ExecXHarnessCmd) wasm $(XHarnessCommand) --app=. --browser=Chrome $(XHarnessBrowserPathArg) --html-file=index.html --output-directory=$(XHarnessOutput) -- %(FileName).dll
diff --git a/src/libraries/tests.proj b/src/libraries/tests.proj
index aaf45da17b0032..326cbde18d7d70 100644
--- a/src/libraries/tests.proj
+++ b/src/libraries/tests.proj
@@ -324,8 +324,12 @@
-
-
+
+
+
+
+
+
diff --git a/src/mono/sample/mbr/browser/index.html b/src/mono/sample/mbr/browser/index.html
index 91ccdf9c1e4bc9..b19224774518e3 100644
--- a/src/mono/sample/mbr/browser/index.html
+++ b/src/mono/sample/mbr/browser/index.html
@@ -19,7 +19,7 @@
const App = {
init: function () {
const update = BINDING.bind_static_method("[WasmDelta] Sample.Test:Update");
- const testMeaning = BINDING.bind_static_method("[Wasm.Browser.Sample] Sample.Test:TestMeaning");
+ const testMeaning = BINDING.bind_static_method("[WasmDelta] Sample.Test:TestMeaning");
const outElement = document.getElementById("out");
document.getElementById("update").addEventListener("click", function () {
update();
diff --git a/src/mono/sample/wasm/Directory.Build.targets b/src/mono/sample/wasm/Directory.Build.targets
index cebfca1893bba3..8be4c973cf5d6c 100644
--- a/src/mono/sample/wasm/Directory.Build.targets
+++ b/src/mono/sample/wasm/Directory.Build.targets
@@ -3,8 +3,14 @@
+ Inputs="
+ Program.cs;
+ $(_WasmMainJSFileName);
+ "
+ Outputs="
+ bin/$(Configuration)/AppBundle/dotnet.wasm;
+ bin/$(Configuration)/AppBundle/$(_WasmMainJSFileName);
+ ">
<_ScriptExt Condition="'$(OS)' == 'Windows_NT'">.cmd
@@ -13,7 +19,7 @@
<_AOTFlag Condition="'$(RunAOTCompilation)' != ''">/p:RunAOTCompilation=$(RunAOTCompilation)
<_WasmMainJSFileName>$([System.IO.Path]::GetFileName('$(WasmMainJSPath)'))
-
+
diff --git a/src/mono/sample/wasm/browser-es6/Makefile b/src/mono/sample/wasm/browser-es6/Makefile
new file mode 100644
index 00000000000000..6be5669382b6e0
--- /dev/null
+++ b/src/mono/sample/wasm/browser-es6/Makefile
@@ -0,0 +1,11 @@
+TOP=../../../../..
+
+include ../wasm.mk
+
+ifneq ($(AOT),)
+override MSBUILD_ARGS+=/p:RunAOTCompilation=true
+endif
+
+PROJECT_NAME=Wasm.Browser.ES6.Sample.csproj
+
+run: run-browser
diff --git a/src/mono/sample/wasm/browser-es6/Program.cs b/src/mono/sample/wasm/browser-es6/Program.cs
index 743f481896fcb5..66ff814d0eff82 100644
--- a/src/mono/sample/wasm/browser-es6/Program.cs
+++ b/src/mono/sample/wasm/browser-es6/Program.cs
@@ -8,9 +8,10 @@ namespace Sample
{
public class Test
{
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
Console.WriteLine ("Hello, World!");
+ return 0;
}
[MethodImpl(MethodImplOptions.NoInlining)]
diff --git a/src/mono/sample/wasm/browser-es6/Wasm.Browser.ES6.Sample.csproj b/src/mono/sample/wasm/browser-es6/Wasm.Browser.ES6.Sample.csproj
index a617dd85614f20..2567910bf88061 100644
--- a/src/mono/sample/wasm/browser-es6/Wasm.Browser.ES6.Sample.csproj
+++ b/src/mono/sample/wasm/browser-es6/Wasm.Browser.ES6.Sample.csproj
@@ -1,6 +1,5 @@
- Debug
true
main.js
true
@@ -16,5 +15,6 @@
<_SampleProject>Wasm.Browser.ES6.Sample.csproj
+
diff --git a/src/mono/sample/wasm/browser-es6/index.html b/src/mono/sample/wasm/browser-es6/index.html
index 6dd3faeb7bd7ad..9172b63389a407 100644
--- a/src/mono/sample/wasm/browser-es6/index.html
+++ b/src/mono/sample/wasm/browser-es6/index.html
@@ -7,8 +7,8 @@
Sample ES6
-
-
+
+
diff --git a/src/mono/sample/wasm/browser-es6/main.js b/src/mono/sample/wasm/browser-es6/main.js
index 1cfe1fb3da6a59..d35e33db1dfa35 100644
--- a/src/mono/sample/wasm/browser-es6/main.js
+++ b/src/mono/sample/wasm/browser-es6/main.js
@@ -1,21 +1,25 @@
import createDotnetRuntime from './dotnet.js'
-const { MONO, BINDING, Module, RuntimeBuildInfo } = await createDotnetRuntime((api) => ({
- disableDotnet6Compatibility: true,
- configSrc: "./mono-config.json",
- onAbort: () => {
- wasm_exit(1);
- },
-}));
-
function wasm_exit(exit_code) {
+ /* Set result in a tests_done element, to be read by xharness in runonly CI test */
+ const tests_done_elem = document.createElement("label");
+ tests_done_elem.id = "tests_done";
+ tests_done_elem.innerHTML = exit_code.toString();
+ document.body.appendChild(tests_done_elem);
+
console.log(`WASM EXIT ${exit_code}`);
}
-const testMeaning = BINDING.bind_static_method("[Wasm.Browser.ES6.Sample] Sample.Test:TestMeaning");
-const ret = testMeaning();
-document.getElementById("out").innerHTML = `${ret} as computed on dotnet ver ${RuntimeBuildInfo.ProductVersion}`;
+try {
+ const { MONO, BINDING, Module, RuntimeBuildInfo } = await createDotnetRuntime();
+ const testMeaning = BINDING.bind_static_method("[Wasm.Browser.ES6.Sample] Sample.Test:TestMeaning");
+ const ret = testMeaning();
+ document.getElementById("out").innerHTML = `${ret} as computed on dotnet ver ${RuntimeBuildInfo.ProductVersion}`;
+ console.debug(`ret: ${ret}`);
-console.debug(`ret: ${ret}`);
-let exit_code = ret == 42 ? 0 : 1;
-wasm_exit(exit_code);
\ No newline at end of file
+ let exit_code = await MONO.mono_run_main("Wasm.Browser.ES6.Sample.dll", []);
+ wasm_exit(exit_code);
+} catch (err) {
+ console.log(`WASM ERROR ${err}`);
+ wasm_exit(2);
+}
diff --git a/src/mono/sample/wasm/browser-legacy/Wasm.Browser.LegacySample.csproj b/src/mono/sample/wasm/browser-legacy/Wasm.Browser.LegacySample.csproj
index c03897e467d94d..a105c68b663be5 100644
--- a/src/mono/sample/wasm/browser-legacy/Wasm.Browser.LegacySample.csproj
+++ b/src/mono/sample/wasm/browser-legacy/Wasm.Browser.LegacySample.csproj
@@ -1,12 +1,12 @@
- Debug
true
main.js
true
embedded
1
- true
+ false
+ false
diff --git a/src/mono/sample/wasm/browser-legacy/index.html b/src/mono/sample/wasm/browser-legacy/index.html
index a2e7322aecf0e3..7787b101941f4d 100644
--- a/src/mono/sample/wasm/browser-legacy/index.html
+++ b/src/mono/sample/wasm/browser-legacy/index.html
@@ -35,9 +35,9 @@
},
};
-
+
-
+
diff --git a/src/mono/sample/wasm/browser/Makefile b/src/mono/sample/wasm/browser/Makefile
index 7ae388cce865d3..7a6b17c4787bc4 100644
--- a/src/mono/sample/wasm/browser/Makefile
+++ b/src/mono/sample/wasm/browser/Makefile
@@ -6,6 +6,6 @@ ifneq ($(AOT),)
override MSBUILD_ARGS+=/p:RunAOTCompilation=true
endif
-PROJECT_NAME=Wasm.Browser.Sample.csproj
+PROJECT_NAME=Wasm.Browser.CJS.Sample.csproj
run: run-browser
diff --git a/src/mono/sample/wasm/browser/Wasm.Browser.Sample.csproj b/src/mono/sample/wasm/browser/Wasm.Browser.CJS.Sample.csproj
similarity index 83%
rename from src/mono/sample/wasm/browser/Wasm.Browser.Sample.csproj
rename to src/mono/sample/wasm/browser/Wasm.Browser.CJS.Sample.csproj
index eb9934dc662ca6..3cfd138946d40a 100644
--- a/src/mono/sample/wasm/browser/Wasm.Browser.Sample.csproj
+++ b/src/mono/sample/wasm/browser/Wasm.Browser.CJS.Sample.csproj
@@ -1,11 +1,11 @@
- Debug
true
main.js
true
embedded
1
+ false
@@ -13,7 +13,7 @@
- <_SampleProject>Wasm.Browser.Sample.csproj
+ <_SampleProject>Wasm.Browser.CJS.Sample.csproj
diff --git a/src/mono/sample/wasm/browser/index.html b/src/mono/sample/wasm/browser/index.html
index 340b67d645a756..765d8ccede0849 100644
--- a/src/mono/sample/wasm/browser/index.html
+++ b/src/mono/sample/wasm/browser/index.html
@@ -4,40 +4,16 @@
- Sample
+ Sample CJS
-
- Result from Sample.Test.TestMeaning:
-
-
-
-
+
+ Answer to the Ultimate Question of Life, the Universe, and Everything is :
+
+
\ No newline at end of file
diff --git a/src/mono/sample/wasm/browser/main.js b/src/mono/sample/wasm/browser/main.js
index 0c865b3f02719d..661af63b64ba8a 100644
--- a/src/mono/sample/wasm/browser/main.js
+++ b/src/mono/sample/wasm/browser/main.js
@@ -1,20 +1,38 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
+function wasm_exit(exit_code) {
+ /* Set result in a tests_done element, to be read by xharness in runonly CI test */
+ const tests_done_elem = document.createElement("label");
+ tests_done_elem.id = "tests_done";
+ tests_done_elem.innerHTML = exit_code.toString();
+ document.body.appendChild(tests_done_elem);
-"use strict";
+ console.log(`WASM EXIT ${exit_code}`);
+}
-createDotnetRuntime(({ MONO, BINDING, Module }) => ({
- disableDotnet6Compatibility: true,
- configSrc: "./mono-config.json",
- onDotnetReady: () => {
- try {
- App.init({ MONO, BINDING, Module });
- } catch (error) {
- set_exit_code(1, error);
- throw (error);
- }
- },
- onAbort: (error) => {
- set_exit_code(1, error);
- },
-}));
+async function loadRuntime() {
+ globalThis.exports = {};
+ await import("./dotnet.js");
+ return globalThis.exports.createDotnetRuntime;
+}
+
+async function main() {
+ try {
+ const createDotnetRuntime = await loadRuntime();
+ const { MONO, BINDING, Module, RuntimeBuildInfo } = await createDotnetRuntime(() => ({
+ disableDotnet6Compatibility: true,
+ configSrc: "./mono-config.json",
+ }));
+
+ const testMeaning = BINDING.bind_static_method("[Wasm.Browser.CJS.Sample] Sample.Test:TestMeaning");
+ const ret = testMeaning();
+ document.getElementById("out").innerHTML = `${ret} as computed on dotnet ver ${RuntimeBuildInfo.ProductVersion}`;
+
+ console.debug(`ret: ${ret}`);
+ let exit_code = ret == 42 ? 0 : 1;
+ wasm_exit(exit_code);
+ } catch (err) {
+ console.log(`WASM ERROR ${err}`);
+ wasm_exit(2)
+ }
+}
+
+main();
\ No newline at end of file
diff --git a/src/mono/sample/wasm/console-node-cjs/Makefile b/src/mono/sample/wasm/console-node-cjs/Makefile
new file mode 100644
index 00000000000000..e1aa7b078338e2
--- /dev/null
+++ b/src/mono/sample/wasm/console-node-cjs/Makefile
@@ -0,0 +1,16 @@
+TOP=../../../../..
+
+include ../wasm.mk
+
+ifneq ($(AOT),)
+override MSBUILD_ARGS+=/p:RunAOTCompilation=true
+endif
+
+ifneq ($(V),)
+DOTNET_MONO_LOG_LEVEL=--setenv=MONO_LOG_LEVEL=debug
+endif
+
+PROJECT_NAME=Wasm.Console.CJS.Sample.csproj
+CONSOLE_DLL=Wasm.Console.CJS.Sample.dll
+
+run: run-console
diff --git a/src/mono/sample/wasm/console-node-cjs/Program.cs b/src/mono/sample/wasm/console-node-cjs/Program.cs
new file mode 100644
index 00000000000000..f65bd654e98863
--- /dev/null
+++ b/src/mono/sample/wasm/console-node-cjs/Program.cs
@@ -0,0 +1,15 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+using System;
+using System.Threading.Tasks;
+
+public class Test
+{
+ public static async Task Main(string[] args)
+ {
+ await Task.Delay(1);
+ Console.WriteLine("Hello World!");
+ return 42;
+ }
+}
diff --git a/src/mono/sample/wasm/console-node-cjs/README.md b/src/mono/sample/wasm/console-node-cjs/README.md
new file mode 100644
index 00000000000000..14ccf622c842e4
--- /dev/null
+++ b/src/mono/sample/wasm/console-node-cjs/README.md
@@ -0,0 +1 @@
+This sample uses CommonJS version of `dotnet.js` running on NodeJS
\ No newline at end of file
diff --git a/src/mono/sample/wasm/console-node-cjs/Wasm.Console.Node.CJS.Sample.csproj b/src/mono/sample/wasm/console-node-cjs/Wasm.Console.Node.CJS.Sample.csproj
new file mode 100644
index 00000000000000..0d0a52d2ff0247
--- /dev/null
+++ b/src/mono/sample/wasm/console-node-cjs/Wasm.Console.Node.CJS.Sample.csproj
@@ -0,0 +1,18 @@
+
+
+ true
+ main.cjs
+ true
+ embedded
+ 1
+ false
+ false
+
+
+
+ <_SampleProject>Wasm.Console.Node.CJS.Sample.csproj
+ <_SampleAssembly>Wasm.Console.Node.CJS.Sample.dll
+
+
+
+
diff --git a/src/mono/sample/wasm/console-node-cjs/main.cjs b/src/mono/sample/wasm/console-node-cjs/main.cjs
new file mode 100644
index 00000000000000..4e985076e1b56b
--- /dev/null
+++ b/src/mono/sample/wasm/console-node-cjs/main.cjs
@@ -0,0 +1,9 @@
+const createDotnetRuntime = require("./dotnet.js");
+
+async function main() {
+ const { MONO } = await createDotnetRuntime();
+ const app_args = process.argv.slice(2);
+ const dllName = "Wasm.Console.Node.CJS.Sample.dll";
+ await MONO.mono_run_main_and_exit(dllName, app_args);
+};
+main();
diff --git a/src/mono/sample/wasm/console/Makefile b/src/mono/sample/wasm/console-node-es6/Makefile
similarity index 100%
rename from src/mono/sample/wasm/console/Makefile
rename to src/mono/sample/wasm/console-node-es6/Makefile
diff --git a/src/mono/sample/wasm/console/Program.cs b/src/mono/sample/wasm/console-node-es6/Program.cs
similarity index 100%
rename from src/mono/sample/wasm/console/Program.cs
rename to src/mono/sample/wasm/console-node-es6/Program.cs
diff --git a/src/mono/sample/wasm/console-node-es6/Wasm.Console.Node.ES6.Sample.csproj b/src/mono/sample/wasm/console-node-es6/Wasm.Console.Node.ES6.Sample.csproj
new file mode 100644
index 00000000000000..2ea291ea047a75
--- /dev/null
+++ b/src/mono/sample/wasm/console-node-es6/Wasm.Console.Node.ES6.Sample.csproj
@@ -0,0 +1,20 @@
+
+
+ true
+ main.mjs
+ true
+ true
+
+
+
+
+
+
+
+
+ <_SampleProject>Wasm.Console.Node.ES6.Sample.csproj
+ <_SampleAssembly>Wasm.Console.Node.ES6.Sample.dll
+
+
+
+
diff --git a/src/mono/sample/wasm/console-node-es6/main.mjs b/src/mono/sample/wasm/console-node-es6/main.mjs
new file mode 100644
index 00000000000000..2325a97eb35f3b
--- /dev/null
+++ b/src/mono/sample/wasm/console-node-es6/main.mjs
@@ -0,0 +1,19 @@
+import { createRequire } from 'module';
+import { dirname } from 'path';
+import { fileURLToPath } from 'url';
+import createDotnetRuntime from './dotnet.js'
+
+const { MONO } = await createDotnetRuntime(() => ({
+ imports: {
+ //TODO internalize into dotnet.js if possible
+ require: createRequire(import.meta.url)
+ },
+ //TODO internalize into dotnet.js if possible
+ scriptDirectory: dirname(fileURLToPath(import.meta.url)) + '/',
+ disableDotnet6Compatibility: true,
+ configSrc: "./mono-config.json",
+}));
+
+const app_args = process.argv.slice(2);
+const dllName = "Wasm.Console.Node.ES6.Sample.dll";
+await MONO.mono_run_main_and_exit(dllName, app_args);
diff --git a/src/mono/sample/wasm/console-node-es6/package.json b/src/mono/sample/wasm/console-node-es6/package.json
new file mode 100644
index 00000000000000..fd2cb753e7d8b5
--- /dev/null
+++ b/src/mono/sample/wasm/console-node-es6/package.json
@@ -0,0 +1,3 @@
+{
+ "type":"module"
+}
\ No newline at end of file
diff --git a/src/mono/sample/wasm/console-v8-cjs/Program.cs b/src/mono/sample/wasm/console-v8-cjs/Program.cs
index d5ea012a33c792..7d959dedae34d6 100644
--- a/src/mono/sample/wasm/console-v8-cjs/Program.cs
+++ b/src/mono/sample/wasm/console-v8-cjs/Program.cs
@@ -13,6 +13,6 @@ public static async Task Main(string[] args)
for (int i = 0; i < args.Length; i++) {
Console.WriteLine($"args[{i}] = {args[i]}");
}
- return args.Length;
+ return 0;
}
}
diff --git a/src/mono/sample/wasm/console-v8-cjs/Wasm.Console.V8.CJS.Sample.csproj b/src/mono/sample/wasm/console-v8-cjs/Wasm.Console.V8.CJS.Sample.csproj
index 0b28f10d49c3a9..81de63e08cd5b7 100644
--- a/src/mono/sample/wasm/console-v8-cjs/Wasm.Console.V8.CJS.Sample.csproj
+++ b/src/mono/sample/wasm/console-v8-cjs/Wasm.Console.V8.CJS.Sample.csproj
@@ -1,7 +1,7 @@
true
- main.js
+ main.cjs
true
false
diff --git a/src/mono/sample/wasm/console-v8-cjs/main.js b/src/mono/sample/wasm/console-v8-cjs/main.cjs
similarity index 100%
rename from src/mono/sample/wasm/console-v8-cjs/main.js
rename to src/mono/sample/wasm/console-v8-cjs/main.cjs
diff --git a/src/mono/sample/wasm/console-v8-es6/Makefile b/src/mono/sample/wasm/console-v8-es6/Makefile
new file mode 100644
index 00000000000000..20c9da20ad0be5
--- /dev/null
+++ b/src/mono/sample/wasm/console-v8-es6/Makefile
@@ -0,0 +1,16 @@
+TOP=../../../../..
+
+include ../wasm.mk
+
+ifneq ($(AOT),)
+override MSBUILD_ARGS+=/p:RunAOTCompilation=true
+endif
+
+ifneq ($(V),)
+DOTNET_MONO_LOG_LEVEL=--setenv=MONO_LOG_LEVEL=debug
+endif
+
+PROJECT_NAME=Wasm.Console.Sample.csproj
+CONSOLE_DLL=Wasm.Console.Sample.dll
+
+run: run-console
diff --git a/src/mono/sample/wasm/console-v8-es6/Program.cs b/src/mono/sample/wasm/console-v8-es6/Program.cs
new file mode 100644
index 00000000000000..7d959dedae34d6
--- /dev/null
+++ b/src/mono/sample/wasm/console-v8-es6/Program.cs
@@ -0,0 +1,18 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+using System;
+using System.Threading.Tasks;
+
+public class Test
+{
+ public static async Task Main(string[] args)
+ {
+ await Task.Delay(1);
+ Console.WriteLine("Hello World!");
+ for (int i = 0; i < args.Length; i++) {
+ Console.WriteLine($"args[{i}] = {args[i]}");
+ }
+ return 0;
+ }
+}
diff --git a/src/mono/sample/wasm/console/Wasm.Console.Sample.csproj b/src/mono/sample/wasm/console-v8-es6/Wasm.Console.V8.ES6.Sample.csproj
similarity index 53%
rename from src/mono/sample/wasm/console/Wasm.Console.Sample.csproj
rename to src/mono/sample/wasm/console-v8-es6/Wasm.Console.V8.ES6.Sample.csproj
index 1dabb4aa0c787f..897e9e72482008 100644
--- a/src/mono/sample/wasm/console/Wasm.Console.Sample.csproj
+++ b/src/mono/sample/wasm/console-v8-es6/Wasm.Console.V8.ES6.Sample.csproj
@@ -1,13 +1,18 @@
true
- $(MonoProjectRoot)\wasm\test-main.js
+ v8shim.cjs
true
+ true
+
+
+
+
- <_SampleProject>Wasm.Console.Sample.csproj
- <_SampleAssembly>Wasm.Console.Sample.dll
+ <_SampleProject>Wasm.Console.V8.ES6.Sample.csproj
+ <_SampleAssembly>Wasm.Console.V8.ES6.Sample.dll
diff --git a/src/mono/sample/wasm/console-v8-es6/main.mjs b/src/mono/sample/wasm/console-v8-es6/main.mjs
new file mode 100644
index 00000000000000..f6bfd7ba8e97dd
--- /dev/null
+++ b/src/mono/sample/wasm/console-v8-es6/main.mjs
@@ -0,0 +1,11 @@
+import createDotnetRuntime from './dotnet.js'
+
+const dllName = "Wasm.Console.V8.ES6.Sample.dll";
+const app_args = Array.from(arguments);
+
+async function main() {
+ const { MONO } = await createDotnetRuntime();
+ await MONO.mono_run_main_and_exit(dllName, app_args);
+}
+
+main();
\ No newline at end of file
diff --git a/src/mono/sample/wasm/console-v8-es6/v8shim.cjs b/src/mono/sample/wasm/console-v8-es6/v8shim.cjs
new file mode 100644
index 00000000000000..f8c2a61fe87fed
--- /dev/null
+++ b/src/mono/sample/wasm/console-v8-es6/v8shim.cjs
@@ -0,0 +1,15 @@
+if (typeof globalThis.URL === 'undefined') {
+ globalThis.URL = class URL {
+ constructor(url) {
+ this.url = url;
+ }
+ toString() {
+ return this.url;
+ }
+ };
+}
+
+import('./main.mjs').catch(err => {
+ console.log(err);
+ console.log(err.stack);
+});
\ No newline at end of file
diff --git a/src/mono/wasm/README.md b/src/mono/wasm/README.md
index b68aeb2d54c99a..37d5fa29643445 100644
--- a/src/mono/wasm/README.md
+++ b/src/mono/wasm/README.md
@@ -149,11 +149,11 @@ The samples in `src/mono/sample/wasm` can be build and run like this:
* console Hello world sample
-`dotnet build /t:RunSample console/Wasm.Console.Sample.csproj`
+`dotnet build /t:RunSample console-v8-cjs/Wasm.Console.V8.CJS.Sample.csproj`
* browser TestMeaning sample
-`dotnet build /t:RunSample browser/Wasm.Browser.Sample.csproj`
+`dotnet build /t:RunSample browser/Wasm.Browser.CJS.Sample.csproj`
To build and run the samples with AOT, add `/p:RunAOTCompilation=true` to the above command lines.
diff --git a/src/mono/wasm/build/WasmApp.InTree.props b/src/mono/wasm/build/WasmApp.InTree.props
index e5968f1320a949..ab70ccd739d44a 100644
--- a/src/mono/wasm/build/WasmApp.InTree.props
+++ b/src/mono/wasm/build/WasmApp.InTree.props
@@ -12,4 +12,10 @@
link
false
+
+
+ <_MonoRuntimeComponentDontLink Include="libmono-component-debugger-stub-static.a" />
+ <_MonoRuntimeComponentDontLink Include="libmono-component-diagnostics_tracing-static.a" />
+ <_MonoRuntimeComponentDontLink Include="libmono-component-hot_reload-stub-static.a" />
+