Is there an existing issue for this?
Describe the bug
Issue
WithNpm(install: true) creates a separate JavaScriptInstallerResource, and the application waits for that installer to complete before starting.
The current behavior appears to ignore the WithExplicitStart() annotation on the parent JavaScript application:
WithNpm(install: true) creates the installer resource and causes it to auto-start.
WithNpm(install: false) marks the installer itself as explicit-start.
- The parent's
WithExplicitStart() annotation is not propagated to, or considered by, the generated JavaScriptInstallerResource.
As a result, an application configured with WithExplicitStart() can still cause its app-installer resource to start automatically during AppHost startup, even though the JavaScript application itself is deferred.
Expected Behavior
When the parent JavaScript application is configured with WithExplicitStart(), its associated JavaScriptInstallerResource should respect the same explicit-start semantics and not start automatically.
In other words, an explicitly started JavaScript application should not implicitly start its npm installer during AppHost startup.
This appears to conflict with the documented semantics of WithExplicitStart(), which indicate that the resource should not be started automatically.
Steps To Reproduce
Minimal reproduction
var builder = DistributedApplication.CreateBuilder(args);
var app = builder.AddJavaScriptApp("app", "../frontend")
.WithNpm(install: true)
.WithExplicitStart();
builder.Build().Run();
With this configuration, the expected behavior is:
app is marked as ExplicitStart.
app does not start automatically when the AppHost starts.
- The associated npm installer should likewise not start automatically.
However, the actual behavior is:
AppHost starts
│
├── app [ExplicitStart → not started]
│
└── app-installer [starts automatically]
│
└── npm install
The app-installer is therefore started during AppHost startup even though the parent app resource has been configured with WithExplicitStart().
For comparison, removing WithExplicitStart() results in both the application and its installer starting automatically:
var app = builder.AddJavaScriptApp("app", "../frontend")
.WithNpm(install: true);
The issue is that the generated JavaScriptInstallerResource appears to have its own startup behavior that does not take the parent's WithExplicitStart() state into account.
Exceptions (if any)
No response
Aspire doctor output
Anything else?
No response
Is there an existing issue for this?
Describe the bug
Issue
WithNpm(install: true)creates a separateJavaScriptInstallerResource, and the application waits for that installer to complete before starting.The current behavior appears to ignore the
WithExplicitStart()annotation on the parent JavaScript application:WithNpm(install: true)creates the installer resource and causes it to auto-start.WithNpm(install: false)marks the installer itself as explicit-start.WithExplicitStart()annotation is not propagated to, or considered by, the generatedJavaScriptInstallerResource.As a result, an application configured with
WithExplicitStart()can still cause itsapp-installerresource to start automatically during AppHost startup, even though the JavaScript application itself is deferred.Expected Behavior
When the parent JavaScript application is configured with
WithExplicitStart(), its associatedJavaScriptInstallerResourceshould respect the same explicit-start semantics and not start automatically.In other words, an explicitly started JavaScript application should not implicitly start its npm installer during AppHost startup.
This appears to conflict with the documented semantics of
WithExplicitStart(), which indicate that the resource should not be started automatically.Steps To Reproduce
Minimal reproduction
With this configuration, the expected behavior is:
appis marked asExplicitStart.appdoes not start automatically when the AppHost starts.However, the actual behavior is:
The
app-installeris therefore started during AppHost startup even though the parentappresource has been configured withWithExplicitStart().For comparison, removing
WithExplicitStart()results in both the application and its installer starting automatically:The issue is that the generated
JavaScriptInstallerResourceappears to have its own startup behavior that does not take the parent'sWithExplicitStart()state into account.Exceptions (if any)
No response
Aspire doctor output
Anything else?
No response