73 writes to State
Aspire.Hosting (16)
ApplicationModel\ResourceNotificationService.cs (2)
135
await PublishUpdateAsync(resource, s => s with {
State
= KnownResourceStates.Waiting }).ConfigureAwait(false);
227
await PublishUpdateAsync(resource, s => s with {
State
= KnownResourceStates.Waiting }).ConfigureAwait(false);
Dashboard\DashboardLifecycleHook.cs (1)
168
State
= configuration.GetBool("DOTNET_ASPIRE_SHOW_DASHBOARD_RESOURCES") is true ? null : KnownResourceStates.Hidden
Dcp\DcpExecutor.cs (2)
914
await _executorEvents.PublishAsync(new OnResourceChangedContext(cancellationToken, resourceType, resource, er.DcpResource.Metadata.Name, new ResourceStatus(KnownResourceStates.NotStarted, null, null), s => s with {
State
= new ResourceStateSnapshot(KnownResourceStates.NotStarted, null) })).ConfigureAwait(false);
1159
await _executorEvents.PublishAsync(new OnResourceChangedContext(cancellationToken, KnownResourceTypes.Container, cr.ModelResource, cr.DcpResourceName, new ResourceStatus(KnownResourceStates.NotStarted, null, null), s => s with {
State
= new ResourceStateSnapshot(KnownResourceStates.NotStarted, null) })).ConfigureAwait(false);
Dcp\ResourceSnapshotBuilder.cs (3)
40
State
= state,
112
State
= state,
133
State
= state,
Orchestrator\ApplicationOrchestrator.cs (6)
105
State
= KnownResourceStates.Starting,
116
State
= KnownResourceStates.Starting,
155
await _notificationService.PublishUpdateAsync(context.Resource, context.DcpResourceName, s => s with {
State
= KnownResourceStates.FailedToStart }).ConfigureAwait(false);
164
await _notificationService.PublishUpdateAsync(context.Resource, s => s with {
State
= KnownResourceStates.FailedToStart }).ConfigureAwait(false);
202
return s with {
State
= KnownResourceStates.Starting };
228
State
= state,
ParameterResourceBuilderExtensions.cs (2)
171
State
= KnownResourceStates.Hidden,
186
State
= new ResourceStateSnapshot("Configuration missing", KnownResourceStateStyles.Error),
Aspire.Hosting.Azure (4)
Provisioning\Provisioners\AzureProvisioner.cs (4)
140
State
= new("Running", KnownResourceStateStyles.Success)
148
State
= new("Missing subscription configuration", KnownResourceStateStyles.Error)
156
State
= new("Failed to Provision", KnownResourceStateStyles.Error)
169
State
= new("Starting", KnownResourceStateStyles.Info)
Aspire.Hosting.Dapr (2)
IDistributedApplicationBuilderExtensions.cs (1)
54
State
= KnownResourceStates.Hidden
IDistributedApplicationComponentBuilderExtensions.cs (1)
65
State
= KnownResourceStates.Hidden
Aspire.Hosting.Tests (45)
Codespaces\CodespacesUrlRewriterTests.cs (1)
79
State
= KnownResourceStates.Running,
Dashboard\DashboardResourceTests.cs (1)
468
await resourceNotificationService.PublishUpdateAsync(dashboard, "aspire-dashboard-0", s => s with {
State
= "Running" }).DefaultTimeout();
Dashboard\DashboardServiceTests.cs (1)
106
return s with {
State
= new ResourceStateSnapshot("Starting", null) };
Health\ResourceHealthCheckServiceTests.cs (16)
37
State
= new ResourceStateSnapshot(KnownResourceStates.Starting, null)
45
State
= new ResourceStateSnapshot(KnownResourceStates.Running, null)
78
State
= new ResourceStateSnapshot(KnownResourceStates.Starting, null)
86
State
= new ResourceStateSnapshot(KnownResourceStates.Running, null)
130
State
= new ResourceStateSnapshot(KnownResourceStates.Running, null)
145
State
= new ResourceStateSnapshot(KnownResourceStates.Exited, null)
153
State
= new ResourceStateSnapshot(KnownResourceStates.Running, null),
197
State
= KnownResourceStates.Running
240
State
= KnownResourceStates.Running
284
State
= KnownResourceStates.Running
321
State
= new ResourceStateSnapshot(KnownResourceStates.Running, null)
353
State
= new ResourceStateSnapshot(KnownResourceStates.Running, null)
417
State
= new ResourceStateSnapshot(KnownResourceStates.Running, null)
465
State
= new ResourceStateSnapshot(KnownResourceStates.Running, null)
518
State
= new ResourceStateSnapshot(KnownResourceStates.Running, null)
526
State
= new ResourceStateSnapshot(KnownResourceStates.Running, null)
ResourceCommandAnnotationTests.cs (1)
55
State
= resourceState
ResourceNotificationTests.cs (14)
165
await notificationService.PublishUpdateAsync(resource1, snapshot => snapshot with {
State
= "SomeState" }).DefaultTimeout();
181
await notificationService.PublishUpdateAsync(resource1, snapshot => snapshot with {
State
= "SomeState" }).DefaultTimeout();
195
await notificationService.PublishUpdateAsync(resource1, snapshot => snapshot with {
State
= "SomeState" }).DefaultTimeout();
211
await notificationService.PublishUpdateAsync(resource1, snapshot => snapshot with {
State
= KnownResourceStates.Running }).DefaultTimeout();
226
await notificationService.PublishUpdateAsync(resource1, snapshot => snapshot with {
State
= "SomeOtherState" }).DefaultTimeout();
241
await notificationService.PublishUpdateAsync(resource1, snapshot => snapshot with {
State
= "SomeOtherState" }).DefaultTimeout();
258
await notificationService.PublishUpdateAsync(resource1, snapshot => snapshot with {
State
= "SomeState" }).DefaultTimeout();
320
await notificationService.PublishUpdateAsync(resource1, snapshot => snapshot with {
State
= "SomeState" }).DefaultTimeout();
331
await notificationService.PublishUpdateAsync(resource1, snapshot => snapshot with {
State
= "SomeState" }).DefaultTimeout();
341
await notificationService.PublishUpdateAsync(resource1, snapshot => snapshot with {
State
= "NewState" }).DefaultTimeout();
351
await notificationService.PublishUpdateAsync(resource1, snapshot => snapshot with {
State
= null }).DefaultTimeout();
361
await notificationService.PublishUpdateAsync(resource1, snapshot => snapshot with {
State
= "" }).DefaultTimeout();
371
await notificationService.PublishUpdateAsync(resource1, snapshot => snapshot with {
State
= " " }).DefaultTimeout();
390
await notificationService.PublishUpdateAsync(resource1, snapshot => snapshot with {
State
= "SomeState" }).DefaultTimeout();
WaitForTests.cs (11)
114
State
= KnownResourceStates.Running
156
State
= KnownResourceStates.Running
197
State
= KnownResourceStates.Finished,
245
State
= KnownResourceStates.Finished,
301
State
= KnownResourceStates.Running
356
State
= KnownResourceStates.Finished,
406
State
= KnownResourceStates.Running,
414
State
= KnownResourceStates.Running,
460
State
= KnownResourceStates.Finished,
468
State
= KnownResourceStates.Finished,
510
State
= KnownResourceStates.Finished
CustomResources.AppHost (2)
TestResource.cs (2)
18
State
= "Starting",
62
State
= new(randomState, randomStyle)
HealthChecksSandbox.AppHost (1)
Program.cs (1)
54
State
= "Starting",
Stress.AppHost (3)
TestResource.cs (3)
19
State
= "Starting",
36
State
= "Starting",
80
State
= randomState
32 references to State
Aspire.Hosting (13)
ApplicationModel\CustomResourceSnapshot.cs (1)
97
HealthStatus = ComputeHealthStatus(value,
State
?.Text);
ApplicationModel\ResourceNotificationService.cs (9)
193
snapshot.
State
?.Text == KnownResourceStates.Running ||
194
snapshot.
State
?.Text == KnownResourceStates.Finished ||
195
snapshot.
State
?.Text == KnownResourceStates.Exited ||
196
snapshot.
State
?.Text == KnownResourceStates.FailedToStart;
269
KnownResourceStates.TerminalStates.Contains(snapshot.
State
?.Text) ||
439
if (_logger.IsEnabled(LogLevel.Debug) && newState.
State
?.Text is { Length: > 0 } newStateText && !string.IsNullOrWhiteSpace(newStateText))
441
var previousStateText = previousState?.
State
?.Text;
482
newState.
State
?.Text,
483
newState.
State
?.Style,
Dashboard\DashboardServiceData.cs (2)
50
State = snapshot.
State
?.Text,
51
StateStyle = snapshot.
State
?.Style,
Orchestrator\ApplicationOrchestrator.cs (1)
199
if (s.
State
?.Text == KnownResourceStates.Waiting)
Aspire.Hosting.Tests (19)
AddParameterTests.cs (4)
35
Assert.Equal("Hidden", state.
State
);
72
Assert.NotNull(state.
State
);
73
Assert.Equal("Configuration missing", state.
State
.Text);
74
Assert.Equal(KnownResourceStateStyles.Error, state.
State
.Style);
Dashboard\DashboardResourceTests.cs (1)
54
Assert.Equal("Hidden", initialSnapshot.InitialSnapshot.
State
);
DistributedApplicationTests.cs (11)
131
var resourceEvent = await rns.WaitForResourceAsync(dependentResourceName, e => e.Snapshot.
State
?.Text == KnownResourceStates.Waiting).DefaultTimeout(TestConstants.LongTimeoutTimeSpan);
135
await rns.WaitForResourceAsync(dependentResourceName, e => e.Snapshot.
State
?.Text == KnownResourceStates.Running).DefaultTimeout(TestConstants.LongTimeoutTimeSpan);
139
await rns.WaitForResourceAsync(dependentResourceName, e => e.Snapshot.
State
?.Text == KnownResourceStates.Finished).DefaultTimeout(TestConstants.LongTimeoutTimeSpan);
143
await rns.WaitForResourceAsync(dependentResourceName, e => e.Snapshot.
State
?.Text == KnownResourceStates.Waiting).DefaultTimeout(TestConstants.LongTimeoutTimeSpan);
147
await rns.WaitForResourceAsync(dependentResourceName, e => e.Snapshot.
State
?.Text == KnownResourceStates.Running).DefaultTimeout(TestConstants.LongTimeoutTimeSpan);
175
var notStartedResourceEvent = await rns.WaitForResourceAsync(notStartedResourceName, e => e.Snapshot.
State
?.Text == KnownResourceStates.NotStarted).DefaultTimeout(TestConstants.LongTimeoutTimeSpan);
176
var dependentResourceEvent = await rns.WaitForResourceAsync(dependentResourceName, e => e.Snapshot.
State
?.Text == KnownResourceStates.Waiting).DefaultTimeout(TestConstants.LongTimeoutTimeSpan);
180
await rns.WaitForResourceAsync(notStartedResourceName, e => e.Snapshot.
State
?.Text == KnownResourceStates.Running).DefaultTimeout(TestConstants.LongTimeoutTimeSpan);
183
await rns.WaitForResourceAsync(dependentResourceName, e => e.Snapshot.
State
?.Text == KnownResourceStates.Running).DefaultTimeout(TestConstants.LongTimeoutTimeSpan);
187
await rns.WaitForResourceAsync(notStartedResourceName, e => e.Snapshot.
State
?.Text == KnownResourceStates.Finished).DefaultTimeout(TestConstants.LongTimeoutTimeSpan);
191
await rns.WaitForResourceAsync(notStartedResourceName, e => e.Snapshot.
State
?.Text == KnownResourceStates.Running).DefaultTimeout(TestConstants.LongTimeoutTimeSpan);
Health\ResourceHealthCheckServiceTests.cs (3)
40
var startingEvent = await rns.WaitForResourceAsync("resource", e => e.Snapshot.
State
?.Text == KnownResourceStates.Starting).DefaultTimeout();
81
var startingEvent = await rns.WaitForResourceAsync("resource", e => e.Snapshot.
State
?.Text == KnownResourceStates.Starting).DefaultTimeout();
89
var runningEvent = await rns.WaitForResourceAsync("resource", e => e.Snapshot.
State
?.Text == KnownResourceStates.Running).DefaultTimeout();