# ResourceWithWaitSupport.WaitForCompletion

- Module: [Aspire.Hosting](/reference/api/go/aspire.hosting.md)
- Defined on: [ResourceWithWaitSupport](/reference/api/go/aspire.hosting/resourcewithwaitsupport.md)
- Version: `17.0.0`
- Kind: `method`

Waits for the dependency resource to enter the Exited or Finished state before starting the resource.

## Definition

```go
func (ResourceWithWaitSupport) WaitForCompletion(
    dependency Resource,
    options ...*WaitForCompletionOptions,
) ResourceWithWaitSupport
```

## Signature

```go
WaitForCompletion(
    dependency Resource,
    options ...*WaitForCompletionOptions,
) ResourceWithWaitSupport
```

## Parameters

- `dependency` ([`Resource`](/reference/api/go/aspire.hosting/resource.md)) -- The resource builder for the dependency resource.
- `options` (`...*WaitForCompletionOptions`) -- optional settings, see [Options](#options)

## Options

Optional parameters are passed in a trailing `options ...*WaitForCompletionOptions` argument.

- `ExitCode` (`*float64`) -- The exit code which is interpreted as successful.

## Returns

[`ResourceWithWaitSupport`](/reference/api/go/aspire.hosting/resourcewithwaitsupport.md) -- The resource builder.

Returns a handle; failures surface later via `Err()`.

## Defined on

A marker interface declares no methods of its own in Go. Its functions are declared on the concrete types they apply to.

- [ResourceWithWaitSupport](/reference/api/go/aspire.hosting/resourcewithwaitsupport.md) -- `marker`

## Applies to

- [`CSharpAppResource`](/reference/api/go/aspire.hosting/csharpappresource.md)
- [`ContainerResource`](/reference/api/go/aspire.hosting/containerresource.md)
- [`DotnetToolResource`](/reference/api/go/aspire.hosting/dotnettoolresource.md)
- [`ExecutableResource`](/reference/api/go/aspire.hosting/executableresource.md)
- [`ProjectResource`](/reference/api/go/aspire.hosting/projectresource.md)
