diff --git a/.gitignore b/.gitignore
index 833551119f2d..c1a783db2aa7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -186,6 +186,7 @@ node_modules/
*.metaproj
*.metaproj.tmp
bin.localpkg/
+src/mono/wasm/runtime/dotnet.d.ts.sha256
# RIA/Silverlight projects
Generated_Code/
diff --git a/eng/liveBuilds.targets b/eng/liveBuilds.targets
index 1cd7a1d81a2a..bc2e7e5dff9a 100644
--- a/eng/liveBuilds.targets
+++ b/eng/liveBuilds.targets
@@ -176,6 +176,8 @@
+
+
+
<_WasmPropertyNames Include="WasmLinkIcalls" />
<_WasmPropertyNames Include="WasmNativeStrip" />
+ <_WasmPropertyNames Include="WasmEnableES6" />
<_WasmPropertyNames Include="_WasmDevel" />
<_WasmPropertiesToPass
diff --git a/src/installer/pkg/sfx/Microsoft.NETCore.App/Directory.Build.props b/src/installer/pkg/sfx/Microsoft.NETCore.App/Directory.Build.props
index 61f2942b48c9..f122fd1fcf52 100644
--- a/src/installer/pkg/sfx/Microsoft.NETCore.App/Directory.Build.props
+++ b/src/installer/pkg/sfx/Microsoft.NETCore.App/Directory.Build.props
@@ -210,6 +210,7 @@
+
@@ -218,10 +219,17 @@
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/mono/sample/mbr/browser/main.js b/src/mono/sample/mbr/browser/main.js
index 6294d62187e3..c1ce2f45024c 100644
--- a/src/mono/sample/mbr/browser/main.js
+++ b/src/mono/sample/mbr/browser/main.js
@@ -7,7 +7,7 @@ var Module = {
onConfigLoaded: function () {
MONO.config.environment_variables["DOTNET_MODIFIABLE_ASSEMBLIES"] = "debug";
},
- onDotNetReady: function () {
+ onDotnetReady: function () {
App.init();
},
};
diff --git a/src/mono/sample/wasm/Directory.Build.targets b/src/mono/sample/wasm/Directory.Build.targets
index 95415ef67fb1..f3ee714290d2 100644
--- a/src/mono/sample/wasm/Directory.Build.targets
+++ b/src/mono/sample/wasm/Directory.Build.targets
@@ -16,6 +16,9 @@
+
+
+
diff --git a/src/mono/sample/wasm/browser-bench/main.js b/src/mono/sample/wasm/browser-bench/main.js
index 40c3e7f67321..c62fb564e218 100644
--- a/src/mono/sample/wasm/browser-bench/main.js
+++ b/src/mono/sample/wasm/browser-bench/main.js
@@ -4,7 +4,7 @@
"use strict";
var Module = {
configSrc: "./mono-config.json",
- onDotNetReady: () => {
+ onDotnetReady: () => {
try {
App.init();
} catch (error) {
diff --git a/src/mono/sample/wasm/browser-es6/Program.cs b/src/mono/sample/wasm/browser-es6/Program.cs
new file mode 100644
index 000000000000..743f481896fc
--- /dev/null
+++ b/src/mono/sample/wasm/browser-es6/Program.cs
@@ -0,0 +1,22 @@
+// 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.Runtime.CompilerServices;
+
+namespace Sample
+{
+ public class Test
+ {
+ public static void Main(string[] args)
+ {
+ Console.WriteLine ("Hello, World!");
+ }
+
+ [MethodImpl(MethodImplOptions.NoInlining)]
+ public static int TestMeaning()
+ {
+ return 42;
+ }
+ }
+}
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
new file mode 100644
index 000000000000..a617dd85614f
--- /dev/null
+++ b/src/mono/sample/wasm/browser-es6/Wasm.Browser.ES6.Sample.csproj
@@ -0,0 +1,20 @@
+
+
+ Debug
+ true
+ main.js
+ true
+ embedded
+ 1
+ true
+
+
+
+
+
+
+
+ <_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
new file mode 100644
index 000000000000..6dd3faeb7bd7
--- /dev/null
+++ b/src/mono/sample/wasm/browser-es6/index.html
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+ Sample ES6
+
+
+
+
+
+
+
+
+ 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-es6/main.js b/src/mono/sample/wasm/browser-es6/main.js
new file mode 100644
index 000000000000..1cfe1fb3da6a
--- /dev/null
+++ b/src/mono/sample/wasm/browser-es6/main.js
@@ -0,0 +1,21 @@
+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) {
+ 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}`;
+
+console.debug(`ret: ${ret}`);
+let exit_code = ret == 42 ? 0 : 1;
+wasm_exit(exit_code);
\ No newline at end of file
diff --git a/src/mono/sample/wasm/browser-legacy/Program.cs b/src/mono/sample/wasm/browser-legacy/Program.cs
new file mode 100644
index 000000000000..743f481896fc
--- /dev/null
+++ b/src/mono/sample/wasm/browser-legacy/Program.cs
@@ -0,0 +1,22 @@
+// 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.Runtime.CompilerServices;
+
+namespace Sample
+{
+ public class Test
+ {
+ public static void Main(string[] args)
+ {
+ Console.WriteLine ("Hello, World!");
+ }
+
+ [MethodImpl(MethodImplOptions.NoInlining)]
+ public static int TestMeaning()
+ {
+ return 42;
+ }
+ }
+}
diff --git a/src/mono/sample/wasm/browser-legacy/Wasm.Browser.LegacySample.csproj b/src/mono/sample/wasm/browser-legacy/Wasm.Browser.LegacySample.csproj
new file mode 100644
index 000000000000..c03897e467d9
--- /dev/null
+++ b/src/mono/sample/wasm/browser-legacy/Wasm.Browser.LegacySample.csproj
@@ -0,0 +1,21 @@
+
+
+ Debug
+ true
+ main.js
+ true
+ embedded
+ 1
+ true
+
+
+
+
+
+
+
+ <_SampleProject>Wasm.Browser.LegacySample.csproj
+
+
+
+
diff --git a/src/mono/sample/wasm/browser-legacy/index.html b/src/mono/sample/wasm/browser-legacy/index.html
new file mode 100644
index 000000000000..a2e7322aecf0
--- /dev/null
+++ b/src/mono/sample/wasm/browser-legacy/index.html
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+ Legacy global module sample
+
+
+
+
+
+
+ Result from Sample.Test.TestMeaning:
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/mono/sample/wasm/browser-legacy/main.js b/src/mono/sample/wasm/browser-legacy/main.js
new file mode 100644
index 000000000000..1aff8d489a12
--- /dev/null
+++ b/src/mono/sample/wasm/browser-legacy/main.js
@@ -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.
+
+"use strict";
+var Module = {
+ configSrc: "./mono-config.json",
+ onDotnetReady: () => {
+ try {
+ App.init();
+ } catch (error) {
+ set_exit_code(1, error);
+ throw (error);
+ }
+ },
+ onAbort: (error) => {
+ set_exit_code(1, error);
+ },
+};
diff --git a/src/mono/sample/wasm/browser-profile/main.js b/src/mono/sample/wasm/browser-profile/main.js
index 4f9abe18afd6..ed726e4e0264 100644
--- a/src/mono/sample/wasm/browser-profile/main.js
+++ b/src/mono/sample/wasm/browser-profile/main.js
@@ -12,7 +12,7 @@ var Module = {
}
}
},
- onDotNetReady: () => {
+ onDotnetReady: () => {
try {
Module.init();
} catch (error) {
diff --git a/src/mono/sample/wasm/browser/index.html b/src/mono/sample/wasm/browser/index.html
index 2fa08c756cbf..340b67d645a7 100644
--- a/src/mono/sample/wasm/browser/index.html
+++ b/src/mono/sample/wasm/browser/index.html
@@ -24,7 +24,7 @@
};
const App = {
- init: () => {
+ init: ({ MONO, BINDING, Module }) => {
const testMeaning = BINDING.bind_static_method("[Wasm.Browser.Sample] Sample.Test:TestMeaning");
const ret = testMeaning();
document.getElementById("out").innerHTML = ret;
@@ -35,8 +35,8 @@
},
};
+
-