Skip to content

Commit cdcbe44

Browse files
committed
Fixup RuntimeDependenciesResolver test
Fixes #12059
1 parent 2f6938e commit cdcbe44

File tree

3 files changed

+57
-57
lines changed

3 files changed

+57
-57
lines changed

src/Components/WebAssembly/Build/test/Microsoft.AspNetCore.Components.WebAssembly.Build.Tests.csproj

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,4 @@
5656
MicrosoftNETSdkRazorPackageVersion=$(MicrosoftNETSdkRazorPackageVersion)" />
5757
</Target>
5858

59-
<!-- A bit of msbuild magic to support reference resolver tests -->
60-
<Target Name="CreateReferenceHintPathsList" AfterTargets="Build">
61-
<ItemGroup>
62-
<_BclDirectory Include="$(ComponentsWebAssemblyBaseClassLibraryPath)" />
63-
<_BclDirectory Include="$(ComponentsWebAssemblyBaseClassLibraryFacadesPath)" />
64-
<_BclDirectory Include="$(ComponentsWebAssemblyFrameworkPath)" />
65-
</ItemGroup>
66-
67-
<WriteLinesToFile Lines="@(ReferencePath)" File="$(TargetDir)referenceHints.txt" WriteOnlyWhenDifferent="true" Overwrite="true" />
68-
<WriteLinesToFile Lines="@(_BclDirectory)" File="$(TargetDir)bclLocations.txt" WriteOnlyWhenDifferent="true" Overwrite="true" />
69-
</Target>
70-
7159
</Project>

src/Components/WebAssembly/Build/test/RuntimeDependenciesResolverTest.cs

Lines changed: 39 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -5,39 +5,23 @@
55
using System.Collections.Generic;
66
using System.IO;
77
using System.Linq;
8+
using System.Reflection;
89
using System.Text;
9-
using Microsoft.AspNetCore.Testing;
1010
using Xunit;
1111

1212
namespace Microsoft.AspNetCore.Components.WebAssembly.Build
1313
{
1414
public class RuntimeDependenciesResolverTest
1515
{
16-
[ConditionalFact(Skip = " https://github.com/aspnet/AspNetCore/issues/12059")]
17-
[SkipOnHelix("https://github.com/aspnet/AspNetCore/issues/10426")]
16+
[Fact]
1817
public void FindsReferenceAssemblyGraph_ForStandaloneApp()
1918
{
2019
// Arrange
2120
var standaloneAppAssembly = typeof(StandaloneApp.Program).Assembly;
2221
var mainAssemblyLocation = standaloneAppAssembly.Location;
23-
var mainAssemblyDirectory = Path.GetDirectoryName(mainAssemblyLocation);
24-
// This list of hints is populated by MSBuild so it will be on the output
25-
// folder.
26-
var hintPaths = File.ReadAllLines(Path.Combine(
27-
mainAssemblyDirectory, "referenceHints.txt"));
28-
var bclLocations = File.ReadAllLines(Path.Combine(
29-
mainAssemblyDirectory, "bclLocations.txt"));
30-
var references = new[]
31-
{
32-
"Microsoft.AspNetCore.Blazor.dll",
33-
"Microsoft.AspNetCore.Components.Web.dll",
34-
"Microsoft.AspNetCore.Components.dll",
35-
"Microsoft.Extensions.DependencyInjection.Abstractions.dll",
36-
"Microsoft.Extensions.DependencyInjection.dll",
37-
"Microsoft.JSInterop.dll",
38-
"Mono.WebAssembly.Interop.dll",
39-
}.Select(a => hintPaths.Single(p => Path.GetFileName(p) == a))
40-
.ToArray();
22+
23+
var hintPaths = ReadContent(standaloneAppAssembly, "StandaloneApp.referenceHints.txt");
24+
var bclLocations = ReadContent(standaloneAppAssembly, "StandaloneApp.bclLocations.txt");
4125

4226
var expectedContents = new[]
4327
{
@@ -57,63 +41,65 @@ implementations 100% forwarding to mscorlib.dll. Then in development you'd fetch
5741
fewer assemblies from the server, and during publishing, illink would remove all the
5842
uncalled implementation code from mscorlib.dll anyway.
5943
*/
60-
"Microsoft.AspNetCore.Blazor.dll",
61-
"Microsoft.AspNetCore.Blazor.pdb",
62-
"Microsoft.AspNetCore.Components.Web.dll",
63-
"Microsoft.AspNetCore.Components.Web.pdb",
44+
"Microsoft.AspNetCore.Blazor.HttpClient.dll",
45+
"Microsoft.AspNetCore.Blazor.HttpClient.pdb",
6446
"Microsoft.AspNetCore.Components.dll",
65-
"Microsoft.AspNetCore.Components.pdb",
47+
"Microsoft.AspNetCore.Components.Forms.dll",
48+
"Microsoft.AspNetCore.Components.Web.dll",
49+
"Microsoft.AspNetCore.Components.WebAssembly.dll",
50+
"Microsoft.AspNetCore.Components.WebAssembly.pdb",
51+
"Microsoft.Bcl.AsyncInterfaces.dll",
52+
"Microsoft.Extensions.Configuration.Abstractions.dll",
53+
"Microsoft.Extensions.Configuration.dll",
6654
"Microsoft.Extensions.DependencyInjection.Abstractions.dll",
6755
"Microsoft.Extensions.DependencyInjection.dll",
56+
"Microsoft.Extensions.Logging.Abstractions.dll",
57+
"Microsoft.Extensions.Primitives.dll",
6858
"Microsoft.JSInterop.dll",
6959
"Mono.Security.dll",
7060
"Mono.WebAssembly.Interop.dll",
61+
"Mono.WebAssembly.Interop.pdb",
7162
"mscorlib.dll",
7263
"netstandard.dll",
7364
"StandaloneApp.dll",
7465
"StandaloneApp.pdb",
7566
"System.dll",
7667
"System.Buffers.dll",
77-
"System.Collections.Concurrent.dll",
78-
"System.Collections.dll",
79-
"System.ComponentModel.Composition.dll",
80-
"System.ComponentModel.dll",
8168
"System.ComponentModel.Annotations.dll",
8269
"System.ComponentModel.DataAnnotations.dll",
70+
"System.ComponentModel.Composition.dll",
8371
"System.Core.dll",
8472
"System.Data.dll",
85-
"System.Diagnostics.Debug.dll",
86-
"System.Diagnostics.Tracing.dll",
73+
"System.Data.DataSetExtensions.dll",
8774
"System.Drawing.Common.dll",
8875
"System.IO.Compression.dll",
8976
"System.IO.Compression.FileSystem.dll",
90-
"System.Linq.dll",
91-
"System.Linq.Expressions.dll",
77+
"System.Memory.dll",
9278
"System.Net.Http.dll",
9379
"System.Numerics.dll",
94-
"System.Reflection.Emit.ILGeneration.dll",
95-
"System.Reflection.Emit.Lightweight.dll",
96-
"System.Reflection.Primitives.dll",
97-
"System.Resources.ResourceManager.dll",
98-
"System.Runtime.dll",
99-
"System.Runtime.Extensions.dll",
80+
"System.Numerics.Vectors.dll",
81+
"System.Runtime.CompilerServices.Unsafe.dll",
10082
"System.Runtime.Serialization.dll",
10183
"System.ServiceModel.Internals.dll",
102-
"System.Threading.dll",
84+
"System.Text.Encodings.Web.dll",
85+
"System.Text.Json.dll",
86+
"System.Threading.Tasks.Extensions.dll",
10387
"System.Transactions.dll",
104-
"System.Web.Services.dll",
10588
"System.Xml.dll",
10689
"System.Xml.Linq.dll",
90+
"WebAssembly.Bindings.dll",
91+
"WebAssembly.Net.Http.dll",
92+
"WebAssembly.Net.WebSockets.dll",
10793
}.OrderBy(i => i, StringComparer.Ordinal)
10894
.ToArray();
10995

11096
// Act
11197

11298
var paths = ResolveBlazorRuntimeDependencies
11399
.ResolveRuntimeDependenciesCore(
114-
mainAssemblyLocation,
115-
references,
116-
bclLocations);
100+
mainAssemblyLocation,
101+
hintPaths,
102+
bclLocations);
117103

118104
var contents = paths
119105
.Select(p => Path.GetFileName(p))
@@ -139,6 +125,14 @@ uncalled implementation code from mscorlib.dll anyway.
139125
Assert.Equal(expectedContents, contents);
140126
}
141127

128+
private string[] ReadContent(Assembly standaloneAppAssembly, string fileName)
129+
{
130+
using var resource = standaloneAppAssembly.GetManifestResourceStream(fileName);
131+
using var streamReader = new StreamReader(resource);
132+
133+
return streamReader.ReadToEnd().Split(Environment.NewLine, StringSplitOptions.RemoveEmptyEntries);
134+
}
135+
142136
private class ContentMisMatchException : Xunit.Sdk.XunitException
143137
{
144138
public IEnumerable<string> ContentNotFound { get; set; }

src/Components/WebAssembly/testassets/StandaloneApp/StandaloneApp.csproj

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,22 @@
1010
<Reference Include="Microsoft.AspNetCore.Components.WebAssembly" />
1111
<Reference Include="Microsoft.AspNetCore.Blazor.HttpClient" />
1212
</ItemGroup>
13+
14+
<!-- A bit of msbuild magic to support reference resolver tests -->
15+
<Target Name="CreateReferenceHintPathsList" AfterTargets="ResolveAssemblyReferences">
16+
<ItemGroup>
17+
<_BclFile Include="$(ComponentsWebAssemblyBaseClassLibraryPath)*" />
18+
<_BclFile Include="$(ComponentsWebAssemblyBaseClassLibraryFacadesPath)*" />
19+
<_BclFile Include="$(ComponentsWebAssemblyFrameworkPath)*" />
20+
</ItemGroup>
21+
22+
<WriteLinesToFile Lines="@(ReferencePath);@(ReferenceDependencyPaths)" File="$(IntermediateOutputPath)referenceHints.txt" WriteOnlyWhenDifferent="true" Overwrite="true" />
23+
<WriteLinesToFile Lines="@(_BclFile)" File="$(IntermediateOutputPath)bclLocations.txt" WriteOnlyWhenDifferent="true" Overwrite="true" />
24+
25+
<ItemGroup>
26+
<EmbeddedResource Include="$(IntermediateOutputPath)bclLocations.txt" Link="bclLocations.txt" Type="Non-Resx" />
27+
<EmbeddedResource Include="$(IntermediateOutputPath)referenceHints.txt" Link="referenceHints.txt" Type="Non-Resx" />
28+
</ItemGroup>
29+
</Target>
30+
1331
</Project>

0 commit comments

Comments
 (0)