Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@ public ReferenceNewAssemblyRebuildTest(ITestOutputHelper output, SharedBuildPerT
[MemberData(nameof(NativeBuildData))]
public async Task ReferenceNewAssembly(Configuration config, bool aot, bool nativeRelink, bool invariant)
{
ProjectInfo info = CopyTestAsset(config, aot, TestAsset.WasmBasicTestApp, "rebuild_tasks");
// Reference a dedicated first-party library that the default app does not use, so it is
// trimmed away on the first build and only enters the AOT module set once the swapped
// entry point references it. Relying on a specific BCL assembly being absent from the
// closure is fragile (it has silently regressed as the base app's dependencies grew).
string extraItems = @"<ProjectReference Include=""..\Library\Library.csproj"" />";
ProjectInfo info = CopyTestAsset(config, aot, TestAsset.WasmBasicTestApp, "rebuild_tasks", extraItems: extraItems);
ReplaceFile(Path.Combine("..", "Library", "Library.cs"), Path.Combine(BuildEnvironment.TestAssetsPath, "EntryPoints", "NativeRebuildReferencedLibrary.cs"));
BuildPaths paths = await FirstNativeBuildAndRun(info, config, aot, nativeRelink, invariant);

var pathsDict = GetFilesTable(info.ProjectName, aot, paths, unchanged: false);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
using System;
using System.Security.Cryptography;
using System.Text;
// Reference a dedicated first-party library ("Library") that is not part of
// the WasmBasicTestApp's default assembly closure. This guarantees the rebuild
// pulls in a genuinely new AOT module, regardless of which BCL assemblies the
// base app happens to root.
using NativeRebuildReferencedLibrary;

public class Test
{
public static int Main()
{
string input = "Hello, world!";
using (SHA256 sha256 = SHA256.Create())
{
byte[] inputBytes = Encoding.UTF8.GetBytes(input);
byte[] hashBytes = sha256.ComputeHash(inputBytes);
Console.WriteLine($"Hash of {input}: {Convert.ToBase64String(hashBytes)}");
}
return 42;
}
public static int Main() => NewlyReferencedType.GetValue();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace NativeRebuildReferencedLibrary;

public static class NewlyReferencedType
{
public static int GetValue() => 42;
}
Loading