diff --git a/eng/testing/tests.browser.targets b/eng/testing/tests.browser.targets
index e7029f44e21915..d591b8a608bebe 100644
--- a/eng/testing/tests.browser.targets
+++ b/eng/testing/tests.browser.targets
@@ -207,6 +207,8 @@
+
+
diff --git a/eng/testing/tests.wasi.targets b/eng/testing/tests.wasi.targets
index 39642c413d0613..066c4391ad4503 100644
--- a/eng/testing/tests.wasi.targets
+++ b/eng/testing/tests.wasi.targets
@@ -129,6 +129,8 @@
TargetPath="%(WasmFilesToIncludeFromPublishDir.Identity)"
Condition="'%(WasmFilesToIncludeFromPublishDir.Identity)' != ''" />
+
+
diff --git a/eng/testing/tests.wasm.targets b/eng/testing/tests.wasm.targets
index eee739184828fa..65ab8ed35de7f8 100644
--- a/eng/testing/tests.wasm.targets
+++ b/eng/testing/tests.wasm.targets
@@ -91,7 +91,9 @@
+ AssemblyFile="$(WasmBuildTasksAssemblyPath)" TaskFactory="TaskHostFactory" />
+
+
diff --git a/src/mono/browser/browser.proj b/src/mono/browser/browser.proj
index 5ab8d0407a7751..95f56cea27e8cc 100644
--- a/src/mono/browser/browser.proj
+++ b/src/mono/browser/browser.proj
@@ -1,6 +1,6 @@
-
+
@@ -49,7 +49,7 @@
-
+
$(WasmObjDir)\pinvoke-table.h
@@ -81,7 +81,7 @@
-
+
<_WasmTimezonesPath>$([MSBuild]::NormalizePath('$(PkgSystem_Runtime_TimeZoneData)', 'contentFiles', 'any', 'any', 'data'))
diff --git a/src/mono/browser/build/BrowserWasmApp.targets b/src/mono/browser/build/BrowserWasmApp.targets
index 2e611016df020a..ac43cf31e1d11f 100644
--- a/src/mono/browser/build/BrowserWasmApp.targets
+++ b/src/mono/browser/build/BrowserWasmApp.targets
@@ -7,7 +7,7 @@
-
+
diff --git a/src/mono/browser/build/WasmApp.InTree.targets b/src/mono/browser/build/WasmApp.InTree.targets
index 885a3fba37ea8b..8babff1f7489f2 100644
--- a/src/mono/browser/build/WasmApp.InTree.targets
+++ b/src/mono/browser/build/WasmApp.InTree.targets
@@ -1,8 +1,8 @@
-
-
-
+
+
+
diff --git a/src/mono/nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.targets b/src/mono/nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.targets
index 1596acac199074..8fa97e16cb21b7 100644
--- a/src/mono/nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.targets
+++ b/src/mono/nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.targets
@@ -54,10 +54,10 @@ Copyright (c) .NET Foundation. All rights reserved.
true
-
-
-
-
+
+
+
+
true
diff --git a/src/mono/sample/Directory.Build.targets b/src/mono/sample/Directory.Build.targets
index ad0054cc1be7f1..5f7e4e32316bb7 100644
--- a/src/mono/sample/Directory.Build.targets
+++ b/src/mono/sample/Directory.Build.targets
@@ -1,5 +1,5 @@
-
+
RunTests.sh
diff --git a/src/mono/wasm/build/WasmApp.Common.targets b/src/mono/wasm/build/WasmApp.Common.targets
index be718671187a1c..d37350ecf80ad8 100644
--- a/src/mono/wasm/build/WasmApp.Common.targets
+++ b/src/mono/wasm/build/WasmApp.Common.targets
@@ -105,12 +105,12 @@
- @(EmccExportedFunction) - Extra function for emcc flag EXPORTED_FUNCTIONS
-->
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/src/mono/wasm/build/WasmApp.LocalBuild.targets b/src/mono/wasm/build/WasmApp.LocalBuild.targets
index 19f025670984ba..bedbba30750c07 100644
--- a/src/mono/wasm/build/WasmApp.LocalBuild.targets
+++ b/src/mono/wasm/build/WasmApp.LocalBuild.targets
@@ -22,9 +22,9 @@
-
-
-
+
+
+
true
diff --git a/src/tasks/AotCompilerTask/MonoAOTCompiler.cs b/src/tasks/AotCompilerTask/MonoAOTCompiler.cs
index c4a37b083d982e..7ae3255fac5bee 100644
--- a/src/tasks/AotCompilerTask/MonoAOTCompiler.cs
+++ b/src/tasks/AotCompilerTask/MonoAOTCompiler.cs
@@ -542,8 +542,16 @@ private bool ExecuteInternal()
{
int allowedParallelism = DisableParallelAot ? 1 : Math.Min(_assembliesToCompile.Count, Environment.ProcessorCount);
IBuildEngine9? be9 = BuildEngine as IBuildEngine9;
- if (be9 is not null)
- allowedParallelism = be9.RequestCores(allowedParallelism);
+ try
+ {
+ if (be9 is not null)
+ allowedParallelism = be9.RequestCores(allowedParallelism);
+ }
+ catch(NotImplementedException)
+ {
+ // RequestCores is not implemented in TaskHostFactory
+ be9 = null;
+ }
/*
From: https://github.com/dotnet/runtime/issues/46146#issuecomment-754021690
diff --git a/src/tasks/MonoTargetsTasks/EmitBundleTask/EmitBundleBase.cs b/src/tasks/MonoTargetsTasks/EmitBundleTask/EmitBundleBase.cs
index af96acb2444922..40aac49edb70bf 100644
--- a/src/tasks/MonoTargetsTasks/EmitBundleTask/EmitBundleBase.cs
+++ b/src/tasks/MonoTargetsTasks/EmitBundleTask/EmitBundleBase.cs
@@ -155,8 +155,16 @@ public override bool Execute()
// Generate source file(s) containing each resource's byte data and size
int allowedParallelism = Math.Max(Math.Min(bundledResources.Count, Environment.ProcessorCount), 1);
IBuildEngine9? be9 = BuildEngine as IBuildEngine9;
- if (be9 is not null)
- allowedParallelism = be9.RequestCores(allowedParallelism);
+ try
+ {
+ if (be9 is not null)
+ allowedParallelism = be9.RequestCores(allowedParallelism);
+ }
+ catch(NotImplementedException)
+ {
+ // RequestCores is not implemented in TaskHostFactory
+ be9 = null;
+ }
try
{
diff --git a/src/tasks/MonoTargetsTasks/ILStrip/ILStrip.cs b/src/tasks/MonoTargetsTasks/ILStrip/ILStrip.cs
index 34cc69f7752839..a71e2b69321f7d 100644
--- a/src/tasks/MonoTargetsTasks/ILStrip/ILStrip.cs
+++ b/src/tasks/MonoTargetsTasks/ILStrip/ILStrip.cs
@@ -76,8 +76,17 @@ public override bool Execute()
int allowedParallelism = DisableParallelStripping ? 1 : Math.Min(Assemblies.Length, Environment.ProcessorCount);
IBuildEngine9? be9 = BuildEngine as IBuildEngine9;
- if (be9 is not null)
- allowedParallelism = be9.RequestCores(allowedParallelism);
+ try
+ {
+ if (be9 is not null)
+ allowedParallelism = be9.RequestCores(allowedParallelism);
+ }
+ catch(NotImplementedException)
+ {
+ // RequestCores is not implemented in TaskHostFactory
+ be9 = null;
+ }
+
try
{
ParallelLoopResult result = Parallel.ForEach(Assemblies,
diff --git a/src/tasks/WasmAppBuilder/EmccCompile.cs b/src/tasks/WasmAppBuilder/EmccCompile.cs
index f549f96c316bce..52a06ed6f306e9 100644
--- a/src/tasks/WasmAppBuilder/EmccCompile.cs
+++ b/src/tasks/WasmAppBuilder/EmccCompile.cs
@@ -132,8 +132,16 @@ private bool ExecuteActual()
int allowedParallelism = DisableParallelCompile ? 1 : Math.Min(SourceFiles.Length, Environment.ProcessorCount);
IBuildEngine9? be9 = BuildEngine as IBuildEngine9;
- if (be9 is not null)
- allowedParallelism = be9.RequestCores(allowedParallelism);
+ try
+ {
+ if (be9 is not null)
+ allowedParallelism = be9.RequestCores(allowedParallelism);
+ }
+ catch(NotImplementedException)
+ {
+ // RequestCores is not implemented in TaskHostFactory
+ be9 = null;
+ }
/*
From: https://github.com/dotnet/runtime/issues/46146#issuecomment-754021690
diff --git a/src/tasks/WasmAppBuilder/ForceMSBuildGC.cs b/src/tasks/WasmAppBuilder/ForceMSBuildGC.cs
new file mode 100644
index 00000000000000..8ddf5d46bfefd5
--- /dev/null
+++ b/src/tasks/WasmAppBuilder/ForceMSBuildGC.cs
@@ -0,0 +1,19 @@
+// 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 Microsoft.Build.Framework;
+using Microsoft.Build.Utilities;
+
+namespace Microsoft.WebAssembly.Build.Tasks
+{
+ public class ForceMSBuildGC : Task
+ {
+ public override bool Execute()
+ {
+ GC.Collect();
+ GC.WaitForPendingFinalizers();
+ return true;
+ }
+ }
+}
diff --git a/src/tests/build.proj b/src/tests/build.proj
index 289fd39e04b073..46c98e88dc51c3 100644
--- a/src/tests/build.proj
+++ b/src/tests/build.proj
@@ -291,7 +291,7 @@
-
+
diff --git a/src/tools/illink/src/ILLink.Tasks/build/Microsoft.NET.ILLink.targets b/src/tools/illink/src/ILLink.Tasks/build/Microsoft.NET.ILLink.targets
index 8c5e472f879cdf..eceaebf36f48a0 100644
--- a/src/tools/illink/src/ILLink.Tasks/build/Microsoft.NET.ILLink.targets
+++ b/src/tools/illink/src/ILLink.Tasks/build/Microsoft.NET.ILLink.targets
@@ -127,7 +127,7 @@ Copyright (c) .NET Foundation. All rights reserved.
if the output semaphore file is out of date with respect to the inputs.
============================================================
-->
-
+
-
+