diff --git a/src/Aspire.Hosting/ApplicationModel/CustomResourceSnapshot.cs b/src/Aspire.Hosting/ApplicationModel/CustomResourceSnapshot.cs index 84d0e54d834..e11693939ec 100644 --- a/src/Aspire.Hosting/ApplicationModel/CustomResourceSnapshot.cs +++ b/src/Aspire.Hosting/ApplicationModel/CustomResourceSnapshot.cs @@ -158,5 +158,5 @@ public static class KnownResourceStates /// /// List of terminal states. /// - public static readonly string[] TerminalStates = [Finished, FailedToStart, Exited]; + public static readonly IReadOnlyList TerminalStates = [Finished, FailedToStart, Exited]; } diff --git a/src/Aspire.Hosting/ApplicationModel/ResourceNotificationService.cs b/src/Aspire.Hosting/ApplicationModel/ResourceNotificationService.cs index f0456b64279..6d807c346e1 100644 --- a/src/Aspire.Hosting/ApplicationModel/ResourceNotificationService.cs +++ b/src/Aspire.Hosting/ApplicationModel/ResourceNotificationService.cs @@ -104,12 +104,11 @@ public async Task WaitForResourceAsync(string resourceName, IEnumerable< } /// - /// Waits for a resource to reach one of the specified states. See for common states. + /// Waits until a resource satisfies the specified predicate. /// /// - /// This method returns a task that will complete when the resource reaches one of the specified target states. If the resource - /// is already in the target state, the method will return immediately.
- /// If the resource doesn't reach one of the target states before is signaled, this method + /// This method returns a task that will complete when the specified predicate returns .
+ /// If the predicate isn't satisfied before is signaled, this method /// will throw . ///
/// The name of the resource. @@ -117,7 +116,7 @@ public async Task WaitForResourceAsync(string resourceName, IEnumerable< /// A cancellation token that cancels the wait operation when signaled. /// A representing the wait operation and which of the target states the resource reached. [System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", - Justification = "targetState(s) parameters are mutually exclusive.")] + Justification = "predicate and targetState(s) parameters are mutually exclusive.")] public async Task WaitForResourceAsync(string resourceName, Func predicate, CancellationToken cancellationToken = default) { using var watchCts = CancellationTokenSource.CreateLinkedTokenSource(_applicationStopping, cancellationToken); diff --git a/src/Aspire.Hosting/PublicAPI.Unshipped.txt b/src/Aspire.Hosting/PublicAPI.Unshipped.txt index 024e8248e91..a0ff5f8815b 100644 --- a/src/Aspire.Hosting/PublicAPI.Unshipped.txt +++ b/src/Aspire.Hosting/PublicAPI.Unshipped.txt @@ -83,5 +83,5 @@ static Aspire.Hosting.ContainerResourceBuilderExtensions.WithBuildArg(this As static Aspire.Hosting.ContainerResourceBuilderExtensions.WithBuildSecret(this Aspire.Hosting.ApplicationModel.IResourceBuilder! builder, string! name, Aspire.Hosting.ApplicationModel.IResourceBuilder! value) -> Aspire.Hosting.ApplicationModel.IResourceBuilder! static Aspire.Hosting.ProjectResourceBuilderExtensions.AddProject(this Aspire.Hosting.IDistributedApplicationBuilder! builder, string! name, string! projectPath, System.Action! configure) -> Aspire.Hosting.ApplicationModel.IResourceBuilder! static Aspire.Hosting.ProjectResourceBuilderExtensions.AddProject(this Aspire.Hosting.IDistributedApplicationBuilder! builder, string! name, System.Action! configure) -> Aspire.Hosting.ApplicationModel.IResourceBuilder! -static readonly Aspire.Hosting.ApplicationModel.KnownResourceStates.TerminalStates -> string![]! +static readonly Aspire.Hosting.ApplicationModel.KnownResourceStates.TerminalStates -> System.Collections.Generic.IReadOnlyList! static readonly Aspire.Hosting.ApplicationModel.KnownResourceStates.Waiting -> string!