5
5
using System . Collections . Generic ;
6
6
using System . IO ;
7
7
using System . Linq ;
8
+ using System . Reflection ;
8
9
using System . Text ;
9
- using Microsoft . AspNetCore . Testing ;
10
10
using Xunit ;
11
11
12
12
namespace Microsoft . AspNetCore . Components . WebAssembly . Build
13
13
{
14
14
public class RuntimeDependenciesResolverTest
15
15
{
16
- [ ConditionalFact ( Skip = " https://github.com/aspnet/AspNetCore/issues/12059" ) ]
17
- [ SkipOnHelix ( "https://github.com/aspnet/AspNetCore/issues/10426" ) ]
16
+ [ Fact ]
18
17
public void FindsReferenceAssemblyGraph_ForStandaloneApp ( )
19
18
{
20
19
// Arrange
21
20
var standaloneAppAssembly = typeof ( StandaloneApp . Program ) . Assembly ;
22
21
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" ) ;
41
25
42
26
var expectedContents = new [ ]
43
27
{
@@ -57,63 +41,65 @@ implementations 100% forwarding to mscorlib.dll. Then in development you'd fetch
57
41
fewer assemblies from the server, and during publishing, illink would remove all the
58
42
uncalled implementation code from mscorlib.dll anyway.
59
43
*/
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" ,
64
46
"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" ,
66
54
"Microsoft.Extensions.DependencyInjection.Abstractions.dll" ,
67
55
"Microsoft.Extensions.DependencyInjection.dll" ,
56
+ "Microsoft.Extensions.Logging.Abstractions.dll" ,
57
+ "Microsoft.Extensions.Primitives.dll" ,
68
58
"Microsoft.JSInterop.dll" ,
69
59
"Mono.Security.dll" ,
70
60
"Mono.WebAssembly.Interop.dll" ,
61
+ "Mono.WebAssembly.Interop.pdb" ,
71
62
"mscorlib.dll" ,
72
63
"netstandard.dll" ,
73
64
"StandaloneApp.dll" ,
74
65
"StandaloneApp.pdb" ,
75
66
"System.dll" ,
76
67
"System.Buffers.dll" ,
77
- "System.Collections.Concurrent.dll" ,
78
- "System.Collections.dll" ,
79
- "System.ComponentModel.Composition.dll" ,
80
- "System.ComponentModel.dll" ,
81
68
"System.ComponentModel.Annotations.dll" ,
82
69
"System.ComponentModel.DataAnnotations.dll" ,
70
+ "System.ComponentModel.Composition.dll" ,
83
71
"System.Core.dll" ,
84
72
"System.Data.dll" ,
85
- "System.Diagnostics.Debug.dll" ,
86
- "System.Diagnostics.Tracing.dll" ,
73
+ "System.Data.DataSetExtensions.dll" ,
87
74
"System.Drawing.Common.dll" ,
88
75
"System.IO.Compression.dll" ,
89
76
"System.IO.Compression.FileSystem.dll" ,
90
- "System.Linq.dll" ,
91
- "System.Linq.Expressions.dll" ,
77
+ "System.Memory.dll" ,
92
78
"System.Net.Http.dll" ,
93
79
"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" ,
100
82
"System.Runtime.Serialization.dll" ,
101
83
"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" ,
103
87
"System.Transactions.dll" ,
104
- "System.Web.Services.dll" ,
105
88
"System.Xml.dll" ,
106
89
"System.Xml.Linq.dll" ,
90
+ "WebAssembly.Bindings.dll" ,
91
+ "WebAssembly.Net.Http.dll" ,
92
+ "WebAssembly.Net.WebSockets.dll" ,
107
93
} . OrderBy ( i => i , StringComparer . Ordinal )
108
94
. ToArray ( ) ;
109
95
110
96
// Act
111
97
112
98
var paths = ResolveBlazorRuntimeDependencies
113
99
. ResolveRuntimeDependenciesCore (
114
- mainAssemblyLocation ,
115
- references ,
116
- bclLocations ) ;
100
+ mainAssemblyLocation ,
101
+ hintPaths ,
102
+ bclLocations ) ;
117
103
118
104
var contents = paths
119
105
. Select ( p => Path . GetFileName ( p ) )
@@ -139,6 +125,14 @@ uncalled implementation code from mscorlib.dll anyway.
139
125
Assert . Equal ( expectedContents , contents ) ;
140
126
}
141
127
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
+
142
136
private class ContentMisMatchException : Xunit . Sdk . XunitException
143
137
{
144
138
public IEnumerable < string > ContentNotFound { get ; set ; }
0 commit comments