Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BeforeResourceStartedEvent is not re-fired when application is restarted #7011

Open
1 task done
afscrome opened this issue Jan 2, 2025 · 1 comment
Open
1 task done

Comments

@afscrome
Copy link
Contributor

afscrome commented Jan 2, 2025

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

The BeforeResourceStartedEvent event only gets fired the FIRST time a resource is started, and not on subsequent starts.

Expected Behavior

When restarting an application in the dashboard, the BeforeResourceStartedEvent should get fired twice (+ additional times if you restart the application more than once)

Steps To Reproduce

  1. Have the below app
  2. In the aspire dashboard, stop the one resource
  3. In the aspire dashboard, start the one resource
var one = builder.AddContainer("one", "nginx");

builder.Eventing.Subscribe<BeforeResourceStartedEvent>(one.Resource, (evt, ct) =>
{
    Console.WriteLine("BeforeResourceStartedEvent");
    Console.Beep();
    return Task.CompletedTask;
});

Exceptions (if any)

No response

.NET Version info

.NET SDK:
 Version:           9.0.100
 Commit:            59db016f11
 Workload version:  9.0.100-manifests.b7b342be
 MSBuild version:   17.12.7+5b8665660

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.26100
 OS Platform: Windows
 RID:         win-x64
 Base Path:   C:\Program Files\dotnet\sdk\9.0.100\

.NET workloads installed:
 [aspire]
   Installation Source: VS 17.12.35506.116
   Manifest Version:    9.0.0-preview.4.24454.4/8.0.100
   Manifest Path:       C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.aspire\9.0.0-preview.4.24454.4\WorkloadManifest.json
   Install Type:              Msi

Configured to use loose manifests when installing new manifests.

Host:
  Version:      9.0.0
  Architecture: x64
  Commit:       9d5a6a9aa4

.NET SDKs installed:
  8.0.404 [C:\Program Files\dotnet\sdk]
  9.0.100-rc.2.24474.11 [C:\Program Files\dotnet\sdk]
  9.0.100 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 8.0.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 9.0.0-rc.2.24474.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 9.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 8.0.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 9.0.0-rc.2.24473.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 9.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 8.0.11 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 9.0.0-rc.2.24474.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 9.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
  x86   [C:\Program Files (x86)\dotnet]
    registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables:
  Not set

global.json file:
  Not found

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download

Anything else?

	  <Sdk Name="Aspire.AppHost.Sdk" Version="9.0.0" />
	  <PackageReference Include="Aspire.Hosting.AppHost" Version="9.0.0" />
@afscrome afscrome changed the title BeforeResourceStartedEvent is not fired when application is restarted BeforeResourceStartedEvent is not re-fired when application is restarted Jan 2, 2025
@davidfowl
Copy link
Member

Related to #5879

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants