Skip to content

Commit 79c0886

Browse files
lewingCopilot
andcommitted
Revert ComputeWasmPublishAssets.cs changes that break native/AOT tests
The SourceType=Discovered/fx path filtering and CopyToPublishDirectory=Never guard in ComputeWasmPublishAssets.cs were too broad - they blocked legitimate linker output replacements, causing mono_wasm_load_runtime crashes in all native build tests. This was already reverted on the main branch PR #126211; apply the same revert to the preview3 backport. The defense-in-depth filter in Browser.targets (excluding CopyToPublishDirectory=Never from _WasmResolvedFilesToPublish) remains - it prevents the items from reaching ComputeWasmPublishAssets in the first place. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 9249205 commit 79c0886

File tree

1 file changed

+1
-25
lines changed

1 file changed

+1
-25
lines changed

src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/ComputeWasmPublishAssets.cs

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -458,21 +458,7 @@ private void ComputeUpdatedAssemblies(
458458
filesToRemove.Add(existing);
459459
if (!string.Equals(asset.ItemSpec, existing.GetMetadata("FullPath"), StringComparison.Ordinal))
460460
{
461-
// Don't replace Framework-materialized assets. These have unique per-project
462-
// paths (from UpdatePackageStaticWebAssets) that must be preserved in multi-client
463-
// hosted scenarios. Replacing them with the ResolvedFileToPublish item (which
464-
// points to the shared SDK/NuGet path) would cause duplicate Identity crashes.
465-
var assetSourceType = asset.GetMetadata("SourceType");
466-
if (!string.Equals(assetSourceType, "Discovered", StringComparison.OrdinalIgnoreCase) ||
467-
asset.ItemSpec.IndexOf(Path.DirectorySeparatorChar + "fx" + Path.DirectorySeparatorChar, StringComparison.OrdinalIgnoreCase) < 0)
468-
{
469-
linkedAssets.Add(asset.ItemSpec, existing);
470-
}
471-
else
472-
{
473-
Log.LogMessage(MessageImportance.Low, "Skipping replacement of Framework-materialized asset '{0}' with '{1}'",
474-
asset.ItemSpec, existing.GetMetadata("FullPath"));
475-
}
461+
linkedAssets.Add(asset.ItemSpec, existing);
476462
}
477463
}
478464
else
@@ -736,16 +722,6 @@ private void GroupResolvedFilesToPublish(
736722
continue;
737723
}
738724

739-
// Skip items explicitly marked as not for publish. These should not be used
740-
// to replace build-time assets (e.g., Framework-materialized assets that have
741-
// unique per-project paths would otherwise be replaced by the raw SDK-path
742-
// original, causing duplicate Identity crashes in multi-client hosted scenarios).
743-
if (string.Equals(candidate.GetMetadata("CopyToPublishDirectory"), "Never", StringComparison.OrdinalIgnoreCase))
744-
{
745-
Log.LogMessage(MessageImportance.Low, "Skipping asset '{0}' because CopyToPublishDirectory is 'Never'", candidate.ItemSpec);
746-
continue;
747-
}
748-
749725
var fileName = candidate.GetMetadata("FileName");
750726
var extension = candidate.GetMetadata("Extension");
751727
if (string.Equals(candidate.GetMetadata("AssetType"), "native", StringComparison.Ordinal) && (fileName == "dotnet" || fileName == "dotnet.native") && extension == ".wasm")

0 commit comments

Comments
 (0)