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