294 instantiations of ResourceSnapshot
Aspire.Cli.Tests (294)
Backchannel\AppHostAuxiliaryBackchannelTests.cs (1)
240
new
()
Backchannel\ResourceSnapshotMapperTests.cs (26)
54
var snapshot = new
ResourceSnapshot
86
var snapshot = new
ResourceSnapshot
182
var snapshot = new
ResourceSnapshot
206
var snapshot = new
ResourceSnapshot
232
var snapshot = new
ResourceSnapshot
260
var snapshot = new
ResourceSnapshot
287
var snapshot = new
ResourceSnapshot
330
var snapshot = new
ResourceSnapshot
359
var dependency = new
ResourceSnapshot
367
var resource = new
ResourceSnapshot
385
var resource = new
ResourceSnapshot
417
var firstDependency = new
ResourceSnapshot
424
var secondDependency = new
ResourceSnapshot
432
var resource = new
ResourceSnapshot
452
new
() { Name = "cache-zuyppzgw", DisplayName = "cache", ResourceType = "Container", State = "Running" },
453
new
() { Name = "frontend", DisplayName = "frontend", ResourceType = "Project", State = "Running" }
467
new
() { Name = "cache-zuyppzgw", DisplayName = "cache", ResourceType = "Container", State = "Running" },
468
new
() { Name = "frontend", DisplayName = "frontend", ResourceType = "Project", State = "Running" }
482
new
() { Name = "cache-abc12345", DisplayName = "cache", ResourceType = "Container", State = "Running" },
483
new
() { Name = "cache-def67890", DisplayName = "cache", ResourceType = "Container", State = "Running" },
484
new
() { Name = "frontend", DisplayName = "frontend", ResourceType = "Project", State = "Running" }
497
new
() { Name = "cache-abc12345", DisplayName = "cache", ResourceType = "Container", State = "Running" },
498
new
() { Name = "cache-def67890", DisplayName = "cache", ResourceType = "Container", State = "Running" },
499
new
() { Name = "frontend", DisplayName = "frontend", ResourceType = "Project", State = "Running" }
513
new
() { Name = "cache-zuyppzgw", DisplayName = "cache", ResourceType = "Container", State = "Running" }
526
new
() { Name = "Cache-Zuyppzgw", DisplayName = "Cache", ResourceType = "Container", State = "Running" }
Backchannel\ResourceSnapshotWatcherTests.cs (12)
199
new
ResourceSnapshot
211
new
ResourceSnapshot
244
new
ResourceSnapshot
257
new
ResourceSnapshot
291
new
ResourceSnapshot
304
new
ResourceSnapshot
338
new
()
350
new
ResourceSnapshot
360
new
ResourceSnapshot
485
return new
ResourceSnapshot
556
var firstSnapshot = new
ResourceSnapshot
582
await source.Writer.WriteAsync(new
ResourceSnapshot
Backchannel\TrayResourceHealthTests.cs (13)
34
var resource = new
ResourceSnapshot
53
var resource = new
ResourceSnapshot
73
new
() { Name = "hidden-state", State = "Hidden", HealthStatus = "Unhealthy" },
74
new
() { Name = "hidden-flag", State = "FailedToStart", IsHidden = true },
75
new
() { Name = "parameter", ResourceType = "Parameter", State = "Active" },
76
new
() { Name = "connection", ResourceType = "ConnectionString" },
77
new
() { Name = "setup", State = "Finished", ExitCode = 0 }
83
[.. resources,
new
() { Name = "api", State = "Running", HealthStatus = "Healthy" }]));
91
new
() { Name = "api", State = "Running", HealthStatus = "Healthy" },
93
new
()
111
new
() { Name = "api", State = "Running", HealthStatus = "Healthy" },
112
new
() { Name = "worker", State = "Waiting" },
113
new
() { Name = "database", State = "Running", HealthStatus = "Unhealthy" }
Backchannel\TrayWatchStreamTests.cs (17)
732
new
() { Name = "api", State = "Starting", Version = 1 },
733
new
() { Name = "cache", State = "Running", HealthStatus = "Healthy", Version = 1 }
758
resourceUpdates.Writer.TryWrite(
new
() { Name = "api", State = "Running", HealthStatus = "Healthy", Version = 2 });
761
resourceUpdates.Writer.TryWrite(
new
() { Name = "cache", State = "Running", HealthStatus = "Degraded", Version = 2 });
764
resourceUpdates.Writer.TryWrite(
new
() { Name = "cache", State = "Running", HealthStatus = "Unhealthy", Version = 3 });
767
resourceUpdates.Writer.TryWrite(
new
() { Name = "cache", State = "Running", HealthStatus = "Healthy", Version = 4 });
770
resourceUpdates.Writer.TryWrite(
new
() { Name = "api", State = "Running", HealthStatus = "Unhealthy", Version = 1 });
771
resourceUpdates.Writer.TryWrite(
new
() { Name = "cache", State = "FailedToStart", Version = 5 });
774
resourceUpdates.Writer.TryWrite(
new
() { Name = "cache", State = "FailedToStart", IsHidden = true, Version = 6 });
825
? [
new
() { Name = "api", State = "Running", IsHidden = true }]
842
resourceUpdates.Writer.TryWrite(
new
() { Name = "api", State = "Running" });
845
resourceUpdates.Writer.TryWrite(
new
() { Name = "api", State = "Running", IsHidden = true });
874
connection.ResourceSnapshots = [
new
() { Name = "api", State = "Running", HealthStatus = "Healthy" }];
915
initial.ResourceSnapshots = [
new
() { Name = "api", State = "Running", HealthStatus = "Healthy" }];
918
replacement.ResourceSnapshots = [
new
() { Name = "api", State = "Waiting" }];
981
initial.ResourceSnapshots = [
new
() { Name = "api", State = "Running", HealthStatus = "Healthy" }];
984
replacement.ResourceSnapshots = [
new
() { Name = "api", State = "Waiting" }];
Commands\AgentMcpCommandTests.cs (14)
237
new
ResourceSnapshot
301
new
ResourceSnapshot
378
new
ResourceSnapshot
511
new
ResourceSnapshot
662
new
ResourceSnapshot
707
new
ResourceSnapshot
804
new
()
833
new
()
925
new
()
1123
new
ResourceSnapshot
1204
new
ResourceSnapshot
1406
new
ResourceSnapshot
1835
new
ResourceSnapshot
1950
new
ResourceSnapshot
Commands\DescribeCommandTests.cs (66)
38
var snapshot = new
ResourceSnapshot
{ Name = "resource", State = state, ExitCode = exitCode };
52
new
() { Name = "running", ResourceType = "Project", State = "Running", HealthStatus = "Healthy" },
53
new
() { Name = "finished-positive", ResourceType = "Project", State = "Finished", ExitCode = 1 },
54
new
() { Name = "finished-negative", ResourceType = "Project", State = "Finished", ExitCode = -532462766 },
55
new
() { Name = "finished-zero", ResourceType = "Project", State = "Finished", ExitCode = 0 },
56
new
() { Name = "finished-unknown", ResourceType = "Project", State = "Finished" },
57
new
() { Name = "exited-positive", ResourceType = "Container", State = "Exited", ExitCode = 1 },
58
new
() { Name = "exited-negative", ResourceType = "Container", State = "Exited", ExitCode = -532462766 },
59
new
() { Name = "exited-zero", ResourceType = "Container", State = "Exited", ExitCode = 0 },
60
new
() { Name = "exited-unknown", ResourceType = "Container", State = "Exited" }
78
new
() { Name = "api", ResourceType = "Project", State = "Finished", ExitCode = -532462766 }
103
new
() { Name = "api", ResourceType = "Project", State = "Finished", ExitCode = -532462766 }
122
new
ResourceSnapshot
{ Name = "cache", ResourceType = "Container", ResourceTypeDisplayName = "Redis", State = "Running" },
123
new
ResourceSnapshot
{ Name = "postgres", ResourceType = "Container", ResourceTypeDisplayName = "PostgreSQL Server", State = "Running" },
124
new
ResourceSnapshot
{ Name = "orders", ResourceType = "Project", ResourceTypeDisplayName = "ASP.NET Core", State = "Running" },
125
new
ResourceSnapshot
{ Name = "generic", ResourceType = "Container", State = "Running" }
499
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
507
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
509
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Stopping" },
511
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Stopping" },
551
.Select(index => new
ResourceSnapshot
561
new
ResourceSnapshot
568
new
ResourceSnapshot
631
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
667
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
668
new
ResourceSnapshot
{ Name = "postgres", DisplayName = "postgres", ResourceType = "Container", State = "Running" },
669
new
ResourceSnapshot
{ Name = "frontend", DisplayName = "frontend", ResourceType = "Project", State = "Running" },
694
new
ResourceSnapshot
760
new
ResourceSnapshot
{ Name = "redis", Version = 1, DisplayName = "redis", ResourceType = "Container", State = "Starting" },
799
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
808
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
810
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Stopping" },
812
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Stopping" },
843
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
873
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
897
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
925
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
953
new
ResourceSnapshot
995
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
1026
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
1027
new
ResourceSnapshot
{ Name = "aspire-dashboard", DisplayName = "aspire-dashboard", ResourceType = "Executable", State = "Hidden" },
1028
new
ResourceSnapshot
{ Name = "hidden-svc", DisplayName = "hidden-svc", ResourceType = "Project", State = "Running", IsHidden = true },
1052
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
1053
new
ResourceSnapshot
{ Name = "aspire-dashboard", DisplayName = "aspire-dashboard", ResourceType = "Executable", State = "Hidden" },
1054
new
ResourceSnapshot
{ Name = "hidden-svc", DisplayName = "hidden-svc", ResourceType = "Project", State = "Running", IsHidden = true },
1080
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
1081
new
ResourceSnapshot
{ Name = "aspire-dashboard", DisplayName = "aspire-dashboard", ResourceType = "Executable", State = "Hidden" },
1105
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
1106
new
ResourceSnapshot
{ Name = "aspire-dashboard", DisplayName = "aspire-dashboard", ResourceType = "Executable", State = "Hidden" },
1133
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
1134
new
ResourceSnapshot
{ Name = "aspire-dashboard", DisplayName = "aspire-dashboard", ResourceType = "Executable", State = "Hidden" },
1163
new
ResourceSnapshot
1178
new
ResourceSnapshot
{ Name = "api-2", DisplayName = "api", ResourceType = "Project", State = "Running" },
1179
new
ResourceSnapshot
{ Name = "api-1", DisplayName = "api", ResourceType = "Project", State = "Running" },
1180
new
ResourceSnapshot
{ Name = "cache", DisplayName = "cache", ResourceType = "Container", State = "Running", IsHidden = true },
1181
new
ResourceSnapshot
{ Name = "connection", DisplayName = "connection", ResourceType = "Parameter", State = "Running" }
1198
new
ResourceSnapshot
1220
new
ResourceSnapshot
1225
new
ResourceSnapshot
{ Name = "api-2", DisplayName = "api", ResourceType = "Project", State = "Running" },
1226
new
ResourceSnapshot
{ Name = "api-1", DisplayName = "api", ResourceType = "Project", State = "Running" }
1243
new
ResourceSnapshot
{ Name = "cache", DisplayName = "cache", ResourceType = "Container", State = "Hidden" },
1244
new
ResourceSnapshot
{ Name = "connection", DisplayName = "connection", ResourceType = "Parameter", State = "Running" }
1275
new
ResourceSnapshot
{ Name = "cache", DisplayName = "cache", ResourceType = "Container", State = "Running" }
1400
yield return new
ResourceSnapshot
1466
yield return new
ResourceSnapshot
1479
yield return new
ResourceSnapshot
Commands\ExportCommandTests.cs (26)
50
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
51
new
ResourceSnapshot
{ Name = "apiservice", DisplayName = "apiservice", ResourceType = "Project", State = "Running" },
127
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
204
new
ResourceSnapshot
{ Name = "other-resource", DisplayName = "other-resource", ResourceType = "Project", State = "Running" },
227
new
ResourceSnapshot
{ Name = "target-resource", DisplayName = "target-resource", ResourceType = "Container", State = "Running" },
330
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
331
new
ResourceSnapshot
{ Name = "apiservice-abc", DisplayName = "apiservice", ResourceType = "Project", State = "Running" },
332
new
ResourceSnapshot
{ Name = "apiservice-def", DisplayName = "apiservice", ResourceType = "Project", State = "Running" },
450
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
451
new
ResourceSnapshot
{ Name = "apiservice", DisplayName = "apiservice", ResourceType = "Project", State = "Running" },
507
new
ResourceSnapshot
{ Name = "apiservice", DisplayName = "apiservice", ResourceType = "Project", State = "Running" },
508
new
ResourceSnapshot
{ Name = "webfrontend", DisplayName = "webfrontend", ResourceType = "Project", State = "Running" },
565
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
566
new
ResourceSnapshot
{ Name = "apiservice-abc", DisplayName = "apiservice", ResourceType = "Project", State = "Running" },
567
new
ResourceSnapshot
{ Name = "apiservice-def", DisplayName = "apiservice", ResourceType = "Project", State = "Running" },
615
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
616
new
ResourceSnapshot
{ Name = "aspire-dashboard", DisplayName = "aspire-dashboard", ResourceType = "Executable", State = "Hidden" },
617
new
ResourceSnapshot
{ Name = "hidden-svc", DisplayName = "hidden-svc", ResourceType = "Project", State = "Running", IsHidden = true },
659
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
660
new
ResourceSnapshot
{ Name = "aspire-dashboard", DisplayName = "aspire-dashboard", ResourceType = "Executable", State = "Hidden" },
703
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
704
new
ResourceSnapshot
{ Name = "aspire-dashboard", DisplayName = "aspire-dashboard", ResourceType = "Executable", State = "Hidden" },
745
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
781
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
824
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
825
new
ResourceSnapshot
{ Name = "apiservice", DisplayName = "apiservice", ResourceType = "Project", State = "Running" },
Commands\LogsCommandTests.cs (12)
733
new
ResourceSnapshot
740
new
ResourceSnapshot
823
new
ResourceSnapshot
854
new
()
864
new
()
871
new
()
990
new
ResourceSnapshot
997
new
ResourceSnapshot
1554
new
ResourceSnapshot
1562
new
ResourceSnapshot
1569
new
ResourceSnapshot
1633
yield return new
ResourceSnapshot
Commands\ResourceCommandTests.cs (1)
2349
return new
ResourceSnapshot
Commands\TerminalCommandTests.cs (1)
820
return new
ResourceSnapshot
Commands\TerminalResourceResolverTests.cs (17)
27
new
() { Name = "shell-def456", DisplayName = "shell" },
28
new
() { Name = "shell-abc123", DisplayName = "shell" }
53
new
() { Name = "shell-abc123", DisplayName = "shell", Properties = Properties(replicaIndex) }
83
new
() { Name = "shell-abc123", DisplayName = "shell", Properties = Properties("0") },
84
new
() { Name = "shell-def456", DisplayName = "shell", Properties = Properties("1") }
108
new
() { Name = "other-abc123", DisplayName = "shell-def456", Properties = Properties("0") },
109
new
() { Name = "shell-def456", DisplayName = "shell", Properties = Properties("1") }
144
new
() { Name = "shell-abc123", DisplayName = "shell" },
145
new
() { Name = "shell-def456", DisplayName = "shell" }
177
new
() { Name = "shell-abc123", DisplayName = "shell" },
178
new
() { Name = "shell-def456", DisplayName = "shell" }
214
new
() { Name = "shell-def456", DisplayName = "shell", Properties = Properties(replicaIndex) }
248
new
()
279
new
() { Name = "shell-abc123", DisplayName = "shell" },
280
new
() { Name = "shell-def456", DisplayName = "shell" }
306
new
() { Name = "shell-abc123", DisplayName = "shell", Properties = Properties("0") }
336
ResourceSnapshots = hasOtherInstances ? [
new
() { Name = "shell-abc123", DisplayName = "shell" }] : [],
Commands\TerminalTapePlayCommandTests.cs (7)
135
new
() { Name = "shell-abc123", DisplayName = "shell" },
136
new
() { Name = "shell-def456", DisplayName = "shell" }
172
new
() { Name = "shell-def456", DisplayName = "shell" },
173
new
() { Name = "shell-abc123", DisplayName = "shell" }
207
new
()
213
new
()
567
new
ResourceSnapshot
{ Name = "shell-0", DisplayName = "shell", ResourceType = "Executable", State = "Running" }
Mcp\ExcludeFromMcpTests.cs (15)
29
var snapshot = new
ResourceSnapshot
41
var snapshot = new
ResourceSnapshot
56
var snapshot = new
ResourceSnapshot
71
var snapshot = new
ResourceSnapshot
86
var snapshot = new
ResourceSnapshot
107
new
ResourceSnapshot
123
new
ResourceSnapshot
165
new
ResourceSnapshot
211
new
ResourceSnapshot
249
new
ResourceSnapshot
283
new
ResourceSnapshot
422
new
ResourceSnapshot
429
new
ResourceSnapshot
470
new
ResourceSnapshot
477
new
ResourceSnapshot
Mcp\ListResourcesToolTests.cs (42)
76
CreateConnection(new
ResourceSnapshot
104
new
ResourceSnapshot
124
new
ResourceSnapshot
131
new
ResourceSnapshot
138
new
ResourceSnapshot
174
new
ResourceSnapshot
189
new
ResourceSnapshot
196
new
ResourceSnapshot
231
new
ResourceSnapshot
239
new
ResourceSnapshot
246
new
ResourceSnapshot
311
new
ResourceSnapshot
318
new
ResourceSnapshot
325
new
ResourceSnapshot
389
var connection = CreateConnection(names.Reverse().Select(name => new
ResourceSnapshot
394
connection.ResourceSnapshots.Insert(0, new
ResourceSnapshot
{ Name = "hidden", IsHidden = true });
395
connection.ResourceSnapshots.Insert(1, new
ResourceSnapshot
{ Name = "hidden-state", State = "Hidden" });
396
connection.ResourceSnapshots.Insert(2, new
ResourceSnapshot
447
new
ResourceSnapshot
{ Name = "first" },
448
new
ResourceSnapshot
{ Name = "second" },
449
new
ResourceSnapshot
{ Name = "third" }));
476
var snapshots = Enumerable.Range(0, 300).Select(index => new
ResourceSnapshot
480
snapshots.Insert(0, new
ResourceSnapshot
489
snapshots.Add(new
ResourceSnapshot
{ Name = "redis-visible", DisplayName = "Redis" });
490
snapshots.Add(new
ResourceSnapshot
{ Name = "redis-hidden", DisplayName = "Redis", IsHidden = true });
508
monitor.AddConnection("hash1", "socket.hash1", CreateConnection(new
ResourceSnapshot
592
monitor.AddConnection("hash1", "socket.hash1", CreateConnection(new
ResourceSnapshot
{ Name = "api", Commands = commands }));
639
CreateConnection(new
ResourceSnapshot
666
var snapshots = resourceNames.Select((name, index) => new
ResourceSnapshot
726
new
ResourceSnapshot
736
new
ResourceSnapshot
764
new
ResourceSnapshot
775
new
ResourceSnapshot
786
new
ResourceSnapshot
815
CreateConnection(new
ResourceSnapshot
842
CreateConnection(new
ResourceSnapshot
886
new
ResourceSnapshot
965
new
ResourceSnapshot
977
new
ResourceSnapshot
987
new
ResourceSnapshot
997
new
ResourceSnapshot
1055
CreateConnection(new
ResourceSnapshot
Mcp\WaitForResourcesToolTests.cs (24)
89
new
ResourceSnapshot
96
new
ResourceSnapshot
102
new
ResourceSnapshot
155
.Select(index => new
ResourceSnapshot
183
var connection = CreateConnection(new
ResourceSnapshot
217
var connection = CreateConnection(new
ResourceSnapshot
254
new
ResourceSnapshot
260
new
ResourceSnapshot
307
new
ResourceSnapshot
313
new
ResourceSnapshot
362
new
ResourceSnapshot
369
new
ResourceSnapshot
380
new
ResourceSnapshot
386
new
ResourceSnapshot
483
responses.Keys.Select(static name => new
ResourceSnapshot
540
new
ResourceSnapshot
{ Name = "ready", State = "Running" },
541
new
ResourceSnapshot
{ Name = "slow", State = "Starting" });
568
new
ResourceSnapshot
611
new
ResourceSnapshot
{ Name = "api", State = "Starting" },
612
new
ResourceSnapshot
{ Name = "worker", State = "Starting" },
613
new
ResourceSnapshot
{ Name = "database", State = "Starting" });
693
new
ResourceSnapshot
{ Name = "api", State = "Starting" },
694
new
ResourceSnapshot
{ Name = "worker", State = "Starting" });
775
var connection = CreateConnection(new
ResourceSnapshot
{ Name = "api", State = "Starting" });
236 references to ResourceSnapshot
aspire (116)
Backchannel\AppHostAuxiliaryBackchannel.cs (12)
397
public async Task<List<
ResourceSnapshot
>> GetResourceSnapshotsAsync(bool includeHidden, CancellationToken cancellationToken = default)
421
var snapshots = await rpc.InvokeWithProfilingAsync<List<
ResourceSnapshot
>>(
444
public async IAsyncEnumerable<
ResourceSnapshot
> WatchResourceSnapshotsAsync(bool includeHidden, [EnumeratorCancellation] CancellationToken cancellationToken = default)
448
await foreach (
var
snapshot in WatchResourcesV2Async(new WatchResourcesRequest
468
IAsyncEnumerable<
ResourceSnapshot
>? snapshots;
471
snapshots = await rpc.InvokeStreamingWithProfilingAsync<
ResourceSnapshot
>(
489
await foreach (
var
snapshot in snapshots.WithCancellation(cancellationToken).ConfigureAwait(false))
695
public async IAsyncEnumerable<
ResourceSnapshot
> WatchResourcesV2Async(
705
await foreach (
var
snapshot in WatchResourceSnapshotsAsync(includeHidden: true, cancellationToken).ConfigureAwait(false))
720
IAsyncEnumerable<
ResourceSnapshot
>? snapshots;
723
snapshots = await rpc.InvokeStreamingWithProfilingAsync<
ResourceSnapshot
>(
740
await foreach (
var
snapshot in snapshots.WithCancellation(cancellationToken).ConfigureAwait(false))
Backchannel\BackchannelJsonSerializerContext.cs (5)
46
[JsonSerializable(typeof(
ResourceSnapshot
))]
47
[JsonSerializable(typeof(
ResourceSnapshot
[]))]
48
[JsonSerializable(typeof(List<
ResourceSnapshot
>))]
49
[JsonSerializable(typeof(IAsyncEnumerable<
ResourceSnapshot
>))]
50
[JsonSerializable(typeof(MessageFormatterEnumerableTracker.EnumeratorResults<
ResourceSnapshot
>))]
Backchannel\IAppHostAuxiliaryBackchannel.cs (2)
92
Task<List<
ResourceSnapshot
>> GetResourceSnapshotsAsync(bool includeHidden, CancellationToken cancellationToken = default);
100
IAsyncEnumerable<
ResourceSnapshot
> WatchResourceSnapshotsAsync(bool includeHidden, CancellationToken cancellationToken = default);
Backchannel\ResourceSnapshotMapper.cs (27)
14
/// Maps <see cref="
ResourceSnapshot
"/> to <see cref="ResourceJson"/> for serialization.
20
/// <see cref="
ResourceSnapshot
.Name"/> and <see cref="
ResourceSnapshot
.DisplayName"/>.
22
internal static IEnumerable<
ResourceSnapshot
> WhereMatchesResourceName(IEnumerable<
ResourceSnapshot
> snapshots, string resourceName)
29
/// Maps a list of <see cref="
ResourceSnapshot
"/> to a list of <see cref="ResourceJson"/>.
35
public static List<ResourceJson> MapToResourceJsonList(IEnumerable<
ResourceSnapshot
> snapshots, string? dashboardBaseUrl = null, bool includeEnvironmentVariableValues = true, bool includeDisabledCommands = false)
42
/// Maps a <see cref="
ResourceSnapshot
"/> to <see cref="ResourceJson"/>.
49
public static ResourceJson MapToResourceJson(
ResourceSnapshot
snapshot, IReadOnlyList<
ResourceSnapshot
> allSnapshots, string? dashboardBaseUrl = null, bool includeEnvironmentVariableValues = true, bool includeDisabledCommands = false)
101
foreach (
var
match in matches)
173
private static string[]? GetResolvedWaitingForDependencies(
ResourceSnapshot
snapshot, IReadOnlyList<
ResourceSnapshot
> allSnapshots)
302
/// First tries an exact match on <see cref="
ResourceSnapshot
.Name"/>, then falls back
303
/// to matching by <see cref="
ResourceSnapshot
.DisplayName"/> only when the display name is
309
public static IReadOnlyList<
ResourceSnapshot
> ResolveResources(string resourceName, IReadOnlyList<
ResourceSnapshot
> snapshots)
336
public static string GetResourceName(
ResourceSnapshot
resource, IDictionary<string,
ResourceSnapshot
> allResources)
348
public static string GetResourceName(
ResourceSnapshot
resource, IEnumerable<
ResourceSnapshot
> allResources)
351
foreach (
var
item in allResources)
376
/// A resource is hidden if its <see cref="
ResourceSnapshot
.IsHidden"/> flag is set
377
/// or its <see cref="
ResourceSnapshot
.State"/> is "Hidden".
379
internal static bool IsHiddenResource(
ResourceSnapshot
snapshot)
394
internal static (bool EffectiveIncludeHidden, List<
ResourceSnapshot
> Snapshots, HashSet<string> HiddenResourceNames) FilterHiddenResources(
395
IReadOnlyList<
ResourceSnapshot
> allSnapshots,
Backchannel\ResourceSnapshotWatcher.cs (19)
19
private readonly Dictionary<string,
ResourceSnapshot
> _resources = new(StringComparers.ResourceName);
111
foreach (
var
snapshot in snapshots)
127
List<
ResourceSnapshot
> snapshots;
157
foreach (
var
snapshot in snapshots)
159
if (!_resources.TryGetValue(snapshot.Name, out
var
currentSnapshot) ||
174
await foreach (
var
snapshot in _connection.WatchResourceSnapshotsAsync(includeHidden: true, cancellationToken).ConfigureAwait(false))
181
_resources.TryGetValue(snapshot.Name, out
var
currentSnapshot) &&
296
public
ResourceSnapshot
? GetResource(string name)
309
public IReadOnlyList<
ResourceSnapshot
> GetResources()
318
public IReadOnlyList<
ResourceSnapshot
> GetAllResources()
329
ResourceSnapshot
[] resources;
340
private IReadOnlyList<
ResourceSnapshot
> GetResources(bool includeHidden)
344
ResourceSnapshot
[] resources;
353
private
ResourceSnapshot
[] CopyResourcesNoLock() => [.. _resources.Values];
355
private static IReadOnlyList<
ResourceSnapshot
> FilterAndOrderResources(
356
IEnumerable<
ResourceSnapshot
> resources,
383
IReadOnlyList<
ResourceSnapshot
> Resources,
387
IReadOnlyList<
ResourceSnapshot
> Snapshots,
392
ResourceSnapshot
Snapshot);
Backchannel\TrayResourceHealth.cs (4)
13
public static string? Aggregate(IEnumerable<
ResourceSnapshot
> resources)
17
foreach (
var
resource in resources)
40
private static string? GetHealth(
ResourceSnapshot
resource)
95
private static bool IsState(
ResourceSnapshot
resource, string state)
Commands\AppHostLauncher.cs (2)
820
Task<List<
ResourceSnapshot
>> probeTask;
827
probeTask = Task.FromException<List<
ResourceSnapshot
>>(ex);
Commands\DescribeCommand.cs (11)
230
private int ExecuteSnapshot(IReadOnlyList<
ResourceSnapshot
> snapshots, string? dashboardBaseUrl, string? resourceName, ResourceOutputFormat format, bool includeDisabledCommands)
283
void DisplaySnapshot(
ResourceSnapshot
snapshot, IReadOnlyList<
ResourceSnapshot
> currentSnapshots)
340
foreach (
var
snapshot in currentSnapshots)
348
var changedSnapshots = new List<
ResourceSnapshot
>(batch.Snapshots.Count);
349
foreach (
var
snapshot in batch.Snapshots)
369
foreach (
var
snapshot in changedSnapshots)
377
private void DisplayResourcesTable(IReadOnlyList<
ResourceSnapshot
> snapshots, string? dashboardBaseUrl)
425
private static ResourceDisplayState BuildResourceDisplayState(
ResourceSnapshot
snapshot, IReadOnlyList<
ResourceSnapshot
> allResources)
450
internal static string GetSnapshotStateMarkup(
ResourceSnapshot
snapshot)
Commands\ExportCommand.cs (4)
155
IReadOnlyList<
ResourceSnapshot
> snaps = connection is not null
231
private static void AddResources(ExportArchive exportArchive, IReadOnlyList<
ResourceSnapshot
> snapshots, string? resourceName)
254
IReadOnlyList<
ResourceSnapshot
> snapshots,
278
var
snapshot = snapshots.FirstOrDefault(s => string.Equals(s.Name, name, StringComparisons.ResourceName));
Commands\LogsCommand.cs (5)
348
var
resource = resourceWatcher.GetResource(logLine.ResourceName);
403
var
resource = resourceWatcher.GetResource(logLine.ResourceName);
436
private static LogEntry ParseLogLine(ResourceLogLine logLine, LogParser logParser, IEnumerable<
ResourceSnapshot
> snapshots)
498
private static string ResolveResourceName(string resourceName, IEnumerable<
ResourceSnapshot
> snapshots)
500
var
snapshot = snapshots.FirstOrDefault(s => string.Equals(s.Name, resourceName, StringComparisons.ResourceName));
Commands\McpToolsCommand.cs (2)
75
foreach (
var
r in resourcesWithTools)
101
foreach (
var
resource in resourcesWithTools)
Commands\TerminalResourceResolver.cs (1)
51
var
snapshot = matches[0];
Mcp\McpResourceToolRefreshService.cs (1)
99
foreach (
var
resource in resourcesWithTools)
Mcp\Tools\ListResourcesTool.cs (13)
301
private static Dictionary<string, McpResourceCommandJson> GetCommandMetadata(
ResourceSnapshot
snapshot)
337
IReadOnlyList<
ResourceSnapshot
> snapshots)
340
foreach (
var
snapshot in snapshots)
352
foreach (
var
snapshot in snapshots)
361
foreach (
var
snapshot in snapshots)
377
IReadOnlyList<
ResourceSnapshot
> snapshots)
386
foreach (
var
snapshot in snapshots)
391
foreach (
var
snapshot in snapshots)
414
ResourceSnapshot
snapshot,
455
ResourceSnapshot
snapshot,
490
private static string? GetDashboardUrl(
ResourceSnapshot
snapshot, string? dashboardBaseUrl)
501
private static string? GetBoundedSource(
ResourceSnapshot
snapshot)
537
private static string? GetStringProperty(
ResourceSnapshot
snapshot, string propertyName)
Mcp\Tools\McpToolHelpers.cs (2)
370
internal static bool IsExcludedFromMcp(
ResourceSnapshot
snapshot)
463
foreach (
var
snapshot in snapshots)
Mcp\Tools\WaitForResourcesTool.cs (5)
121
List<
ResourceSnapshot
> snapshots;
337
IReadOnlyList<
ResourceSnapshot
> snapshots)
341
var
runtimeMatch = snapshots.FirstOrDefault(snapshot =>
368
ResourceSnapshot
snapshot,
408
ResourceSnapshot
? Resource,
src\Aspire.Hosting\Backchannel\BackchannelDataTypes.cs (1)
282
public required
ResourceSnapshot
[] Resources { get; init; }
Aspire.Cli.Tests (120)
Backchannel\AppHostAuxiliaryBackchannelTests.cs (4)
27
var
snapshot = Assert.Single(snapshots);
46
var
resource = enumerator.Current;
232
public async IAsyncEnumerable<
ResourceSnapshot
> WatchResourcesAsync(WatchResourcesRequest? request = null, [EnumeratorCancellation] CancellationToken cancellationToken = default)
239
private static
ResourceSnapshot
CreateResourceSnapshot() =>
Backchannel\ResourceSnapshotMapperTests.cs (23)
22
var
snapshot = JsonSerializer.Deserialize(json, BackchannelJsonSerializerContext.Default.ResourceSnapshot);
44
var
snapshot = JsonSerializer.Deserialize(json, BackchannelJsonSerializerContext.Default.ResourceSnapshot);
54
var
snapshot = new ResourceSnapshot
86
var
snapshot = new ResourceSnapshot
139
var allSnapshots = new List<
ResourceSnapshot
> { snapshot };
182
var
snapshot = new ResourceSnapshot
206
var
snapshot = new ResourceSnapshot
232
var
snapshot = new ResourceSnapshot
260
var
snapshot = new ResourceSnapshot
287
var
snapshot = new ResourceSnapshot
330
var
snapshot = new ResourceSnapshot
359
var
dependency = new ResourceSnapshot
367
var
resource = new ResourceSnapshot
385
var
resource = new ResourceSnapshot
417
var
firstDependency = new ResourceSnapshot
424
var
secondDependency = new ResourceSnapshot
432
var
resource = new ResourceSnapshot
450
var snapshots = new List<
ResourceSnapshot
>
465
var snapshots = new List<
ResourceSnapshot
>
480
var snapshots = new List<
ResourceSnapshot
>
495
var snapshots = new List<
ResourceSnapshot
>
511
var snapshots = new List<
ResourceSnapshot
>
524
var snapshots = new List<
ResourceSnapshot
>
Backchannel\ResourceSnapshotWatcherTests.cs (30)
25
var getGate = new TaskCompletionSource<List<
ResourceSnapshot
>>(TaskCreationOptions.RunContinuationsAsynchronously);
40
return duringInitialLoad ? getGate.Task : Task.FromResult(new List<
ResourceSnapshot
>());
90
async IAsyncEnumerable<
ResourceSnapshot
> Watch([EnumeratorCancellation] CancellationToken token)
197
new List<
ResourceSnapshot
>
227
var
snapshot = Assert.Single(watcher.CaptureAllResources().Resources);
272
var
snapshot = Assert.Single(watcher.CaptureAllResources().Resources);
319
var
snapshot = Assert.Single(watcher.CaptureAllResources().Resources);
336
new List<
ResourceSnapshot
>
383
var
retainedSnapshot = Assert.Single(staleCapture.Resources);
397
var
currentSnapshot = Assert.Single(watcher.CaptureAllResources().Resources);
402
var
update = Assert.Single(consumer.Current.Snapshots);
414
GetResourceSnapshotsHandler = _ => Task.FromResult(new List<
ResourceSnapshot
>()),
474
GetResourceSnapshotsHandler = _ => Task.FromResult(new List<
ResourceSnapshot
>()),
536
var source = Channel.CreateUnbounded<
ResourceSnapshot
>();
540
GetResourceSnapshotsHandler = _ => Task.FromResult(new List<
ResourceSnapshot
>()),
556
var
firstSnapshot = new ResourceSnapshot
603
foreach (
var
snapshot in batch.Snapshots)
645
private static async IAsyncEnumerable<
ResourceSnapshot
> ReadSnapshotsAndSignalFirstApplied(
646
ChannelReader<
ResourceSnapshot
> source,
651
await foreach (
var
snapshot in source.ReadAllAsync(cancellationToken))
665
private static async IAsyncEnumerable<
ResourceSnapshot
> YieldSnapshotAndWait(
667
ResourceSnapshot
snapshot,
680
private static async IAsyncEnumerable<
ResourceSnapshot
> YieldSnapshotsInSequence(
682
ResourceSnapshot
firstSnapshot,
685
ResourceSnapshot
secondSnapshot,
700
private static async IAsyncEnumerable<
ResourceSnapshot
> ProduceResourceSnapshotsAfter(
703
Func<int,
ResourceSnapshot
> createSnapshot,
718
private static async IAsyncEnumerable<
ResourceSnapshot
> WaitForResourceSnapshotCancellation(
736
private static async IAsyncEnumerable<
ResourceSnapshot
> WaitForResourceSnapshotGate(
755
private static async IAsyncEnumerable<
ResourceSnapshot
> WaitForCancellationWithThrowingCallback(
Backchannel\TrayResourceHealthTests.cs (5)
34
var
resource = new ResourceSnapshot
53
var
resource = new ResourceSnapshot
71
ResourceSnapshot
[] resources =
89
ResourceSnapshot
[] resources =
109
ResourceSnapshot
[] resources =
Backchannel\TrayWatchStreamTests.cs (8)
725
var resourceUpdates = Channel.CreateUnbounded<
ResourceSnapshot
>();
797
async IAsyncEnumerable<
ResourceSnapshot
> Watch(bool includeHidden, [EnumeratorCancellation] CancellationToken token)
803
await foreach (
var
resource in resourceUpdates.Reader.ReadAllAsync(token))
821
var resourceUpdates = Channel.CreateUnbounded<
ResourceSnapshot
>();
871
var resourceUpdates = Channel.CreateUnbounded<
ResourceSnapshot
>();
950
async IAsyncEnumerable<
ResourceSnapshot
> Watch(bool includeHidden, [EnumeratorCancellation] CancellationToken token)
1065
async IAsyncEnumerable<
ResourceSnapshot
> Watch([EnumeratorCancellation] CancellationToken token)
1116
private static async IAsyncEnumerable<
ResourceSnapshot
> WatchUntilCanceled([EnumeratorCancellation] CancellationToken cancellationToken)
Commands\AgentMcpCommandTests.cs (6)
660
return Task.FromResult(new List<
ResourceSnapshot
>
705
return Task.FromResult(new List<
ResourceSnapshot
>
802
return Task.FromResult(new List<
ResourceSnapshot
>
831
GetResourceSnapshotsHandler = _ => Task.FromResult(new List<
ResourceSnapshot
>
923
return Task.FromResult(new List<
ResourceSnapshot
>
1404
return Task.FromResult(new List<
ResourceSnapshot
>
Commands\AppHostLauncherTests.cs (2)
489
return Task.FromResult<List<
ResourceSnapshot
>>([]);
549
return Task.FromResult<List<
ResourceSnapshot
>>([]);
Commands\DescribeCommandTests.cs (16)
38
var
snapshot = new ResourceSnapshot { Name = "resource", State = state, ExitCode = exitCode };
613
foreach (
var
snapshot in initialSnapshots)
1357
List<
ResourceSnapshot
> resourceSnapshots,
1398
private static async IAsyncEnumerable<
ResourceSnapshot
> ThrowObjectDisposedAfterSnapshot([EnumeratorCancellation] CancellationToken cancellationToken = default)
1414
private static async IAsyncEnumerable<
ResourceSnapshot
> EmptyResourceSnapshots([EnumeratorCancellation] CancellationToken cancellationToken = default)
1421
private static async IAsyncEnumerable<
ResourceSnapshot
> YieldResourceSnapshots(
1422
IEnumerable<
ResourceSnapshot
> snapshots,
1425
foreach (
var
snapshot in snapshots)
1433
private static async IAsyncEnumerable<
ResourceSnapshot
> YieldResourceSnapshotsAfter(
1435
IEnumerable<
ResourceSnapshot
> snapshots,
1439
await foreach (
var
snapshot in YieldResourceSnapshots(snapshots, cancellationToken))
1445
private static async IAsyncEnumerable<
ResourceSnapshot
> YieldResourceSnapshotsImmediatelyAfter(
1447
IEnumerable<
ResourceSnapshot
> snapshots,
1451
foreach (
var
snapshot in snapshots)
1458
private static async IAsyncEnumerable<
ResourceSnapshot
> YieldResourceAfterSignaling(
1477
private static async IAsyncEnumerable<
ResourceSnapshot
> ThrowObjectDisposedAfterCancellationAsync([EnumeratorCancellation] CancellationToken cancellationToken = default)
Commands\ExportCommandTests.cs (1)
869
List<
ResourceSnapshot
> resourceSnapshots,
Commands\LogsCommandTests.cs (3)
852
? new List<
ResourceSnapshot
>
862
: new List<
ResourceSnapshot
>
1631
private static async IAsyncEnumerable<
ResourceSnapshot
> WatchWithLateHidden([EnumeratorCancellation] CancellationToken cancellationToken)
Commands\ResourceCommandTests.cs (2)
2342
private static
ResourceSnapshot
CreateResourceSnapshot(string name, params ResourceSnapshotCommand[] commands)
2347
private static
ResourceSnapshot
CreateResourceSnapshot(string name, string state, params ResourceSnapshotCommand[] commands)
Commands\TerminalCommandTests.cs (3)
818
private static
ResourceSnapshot
CreateSnapshot(string name, string? displayName = null)
868
public Task<List<
ResourceSnapshot
>> GetResourceSnapshotsAsync(bool includeHidden, CancellationToken cancellationToken = default)
870
public IAsyncEnumerable<
ResourceSnapshot
> WatchResourceSnapshotsAsync(bool includeHidden, CancellationToken cancellationToken = default)
Mcp\ExcludeFromMcpTests.cs (5)
29
var
snapshot = new ResourceSnapshot
41
var
snapshot = new ResourceSnapshot
56
var
snapshot = new ResourceSnapshot
71
var
snapshot = new ResourceSnapshot
86
var
snapshot = new ResourceSnapshot
Mcp\ListResourcesToolTests.cs (2)
1196
private static TestAppHostAuxiliaryBackchannel CreateConnection(params
ResourceSnapshot
[] snapshots)
1199
private static TestAppHostAuxiliaryBackchannel CreateConnection(string appHostPath, params
ResourceSnapshot
[] snapshots)
Mcp\WaitForResourcesToolTests.cs (3)
251
ResourceSnapshot
[] snapshots = includeUnavailableResources
757
Task.FromCanceled<List<
ResourceSnapshot
>>(cancellationToken);
798
private static TestAppHostAuxiliaryBackchannel CreateConnection(params
ResourceSnapshot
[] snapshots)
TestServices\TestAppHostAuxiliaryBackchannel.cs (7)
47
public List<
ResourceSnapshot
> ResourceSnapshots { get; set; } = [];
87
public Func<CancellationToken, Task<List<
ResourceSnapshot
>>>? GetResourceSnapshotsHandler { get; set; }
109
public Func<bool, CancellationToken, IAsyncEnumerable<
ResourceSnapshot
>>? WatchResourceSnapshotsHandler { get; set; }
177
public Task<List<
ResourceSnapshot
>> GetResourceSnapshotsAsync(bool includeHidden, CancellationToken cancellationToken = default)
193
public async IAsyncEnumerable<
ResourceSnapshot
> WatchResourceSnapshotsAsync(bool includeHidden, [EnumeratorCancellation] CancellationToken cancellationToken = default)
197
await foreach (
var
snapshot in WatchResourceSnapshotsHandler(includeHidden, cancellationToken).WithCancellation(cancellationToken).ConfigureAwait(false))
204
foreach (
var
snapshot in ResourceSnapshots)