Skip to content

Commit

Permalink
PR feedback.
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchdenny committed Aug 15, 2024
1 parent 357e3f9 commit 07470ec
Show file tree
Hide file tree
Showing 16 changed files with 3 additions and 35 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -476,3 +476,6 @@ dotnet_diagnostic.IDE0005.severity = silent
[{*.razor.cs,src/Aspire.Dashboard/Components/**.cs}]
# CA2007: Consider calling ConfigureAwait on the awaited task
dotnet_diagnostic.CA2007.severity = silent

[*.{cs,vb}]
dotnet_diagnostic.ASPIREEVENTING001.severity = none
1 change: 0 additions & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@
<PackageVersion Include="MySqlConnector.DependencyInjection" Version="2.3.6" />
<PackageVersion Include="MySqlConnector.Logging.Microsoft.Extensions.Logging" Version="2.1.0" />
<PackageVersion Include="NATS.Net" Version="2.3.2" />
<PackageVersion Include="Npgsql" Version="8.0.3" />
<PackageVersion Include="Npgsql.DependencyInjection" Version="8.0.3" />
<PackageVersion Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.4" />
<PackageVersion Include="Oracle.EntityFrameworkCore" Version="8.23.50" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ public static IResourceBuilder<AzureEventHubsResource> RunAsEmulator(this IResou
configureContainer(surrogateBuilder);
}

#pragma warning disable ASPIREEVENTING001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
builder.ApplicationBuilder.Eventing.Subscribe<AfterEndpointsAllocatedEvent>((e, ct) =>
{
var eventHubsEmulatorResources = builder.ApplicationBuilder.Resources.OfType<AzureEventHubsResource>().Where(x => x is { } eventHubsResource && eventHubsResource.IsEmulator);
Expand Down Expand Up @@ -227,7 +226,6 @@ public static IResourceBuilder<AzureEventHubsResource> RunAsEmulator(this IResou
return Task.CompletedTask;
});
#pragma warning restore ASPIREEVENTING001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.

return builder;
}
Expand Down
2 changes: 0 additions & 2 deletions src/Aspire.Hosting.Kafka/KafkaBuilderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ public static IResourceBuilder<KafkaServerResource> WithKafkaUI(this IResourceBu
.WithHttpEndpoint(targetPort: KafkaUIPort)
.ExcludeFromManifest();

#pragma warning disable ASPIREEVENTING001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
builder.ApplicationBuilder.Eventing.Subscribe<AfterEndpointsAllocatedEvent>((e, ct) =>
{
var kafkaResources = builder.ApplicationBuilder.Resources.OfType<KafkaServerResource>();
Expand All @@ -84,7 +83,6 @@ public static IResourceBuilder<KafkaServerResource> WithKafkaUI(this IResourceBu
return Task.CompletedTask;
});
#pragma warning restore ASPIREEVENTING001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.

configureContainer?.Invoke(kafkaUiBuilder);

Expand Down
2 changes: 0 additions & 2 deletions src/Aspire.Hosting.MySql/MySqlBuilderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ public static IResourceBuilder<T> WithPhpMyAdmin<T>(this IResourceBuilder<T> bui
.WithBindMount(configurationTempFileName, "/etc/phpmyadmin/config.user.inc.php")
.ExcludeFromManifest();

#pragma warning disable ASPIREEVENTING001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
builder.ApplicationBuilder.Eventing.Subscribe<AfterEndpointsAllocatedEvent>((e, ct) =>
{
var mySqlInstances = builder.ApplicationBuilder.Resources.OfType<MySqlServerResource>();
Expand Down Expand Up @@ -143,7 +142,6 @@ public static IResourceBuilder<T> WithPhpMyAdmin<T>(this IResourceBuilder<T> bui
return Task.CompletedTask;
});
#pragma warning restore ASPIREEVENTING001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.

configureContainer?.Invoke(phpMyAdminContainerBuilder);

Expand Down
2 changes: 0 additions & 2 deletions src/Aspire.Hosting.PostgreSQL/PostgresBuilderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ public static IResourceBuilder<T> WithPgAdmin<T>(this IResourceBuilder<T> builde
.WithBindMount(Path.GetTempFileName(), "/pgadmin4/servers.json")
.ExcludeFromManifest();

#pragma warning disable ASPIREEVENTING001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
builder.ApplicationBuilder.Eventing.Subscribe<AfterEndpointsAllocatedEvent>((e, ct) =>
{
var serverFileMount = pgAdminContainer.Annotations.OfType<ContainerMountAnnotation>().Single(v => v.Target == "/pgadmin4/servers.json");
Expand Down Expand Up @@ -140,7 +139,6 @@ public static IResourceBuilder<T> WithPgAdmin<T>(this IResourceBuilder<T> builde
return Task.CompletedTask;
});
#pragma warning restore ASPIREEVENTING001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.

configureContainer?.Invoke(pgAdminContainerBuilder);

Expand Down
2 changes: 0 additions & 2 deletions src/Aspire.Hosting.Redis/RedisBuilderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ public static IResourceBuilder<RedisResource> WithRedisCommander(this IResourceB
.WithHttpEndpoint(targetPort: 8081, name: "http")
.ExcludeFromManifest();

#pragma warning disable ASPIREEVENTING001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
builder.ApplicationBuilder.Eventing.Subscribe<AfterEndpointsAllocatedEvent>((e, ct) =>
{
var redisInstances = builder.ApplicationBuilder.Resources.OfType<RedisResource>();
Expand All @@ -89,7 +88,6 @@ public static IResourceBuilder<RedisResource> WithRedisCommander(this IResourceB
return Task.CompletedTask;
});
#pragma warning restore ASPIREEVENTING001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.

configureContainer?.Invoke(resourceBuilder);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

#pragma warning disable ASPIREEVENTING001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.

internal static class BuiltInDistributedApplicationEventSubscriptionHandlers
{
public static Task ExcludeDashboardFromManifestAsync(BeforeStartEvent beforeStartEvent, CancellationToken _)
Expand Down
4 changes: 0 additions & 4 deletions src/Aspire.Hosting/Dcp/ApplicationExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,8 @@ public async Task RunApplicationAsync(CancellationToken cancellationToken = defa

await CreateContainersAndExecutablesAsync(cancellationToken).ConfigureAwait(false);

#pragma warning disable ASPIREEVENTING001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
var afterResourcesCreatedEvent = new AfterResourcesCreatedEvent(serviceProvider, _model);
await eventing.PublishAsync(afterResourcesCreatedEvent, cancellationToken).ConfigureAwait(false);
#pragma warning restore ASPIREEVENTING001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.

foreach (var lifecycleHook in _lifecycleHooks)
{
Expand Down Expand Up @@ -895,10 +893,8 @@ private async Task CreateContainersAndExecutablesAsync(CancellationToken cancell
var toCreate = _appResources.Where(r => r.DcpResource is Container || r.DcpResource is Executable || r.DcpResource is ExecutableReplicaSet);
AddAllocatedEndpointInfo(toCreate);

#pragma warning disable ASPIREEVENTING001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
var afterEndpointsAllocatedEvent = new AfterEndpointsAllocatedEvent(serviceProvider, _model);
await eventing.PublishAsync(afterEndpointsAllocatedEvent, cancellationToken).ConfigureAwait(false);
#pragma warning restore ASPIREEVENTING001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.

foreach (var lifecycleHook in _lifecycleHooks)
{
Expand Down
2 changes: 0 additions & 2 deletions src/Aspire.Hosting/DistributedApplication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -346,11 +346,9 @@ internal async Task ExecuteBeforeStartHooksAsync(CancellationToken cancellationT

try
{
#pragma warning disable ASPIREEVENTING001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
var beforeStartEvent = new BeforeStartEvent(_host.Services, _host.Services.GetRequiredService<DistributedApplicationModel>());
var eventing = _host.Services.GetRequiredService<IDistributedApplicationEventing>();
await eventing.PublishAsync(beforeStartEvent, cancellationToken).ConfigureAwait(false);
#pragma warning restore ASPIREEVENTING001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.

var lifecycleHooks = _host.Services.GetServices<IDistributedApplicationLifecycleHook>();
var appModel = _host.Services.GetRequiredService<DistributedApplicationModel>();
Expand Down
2 changes: 0 additions & 2 deletions src/Aspire.Hosting/DistributedApplicationBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

namespace Aspire.Hosting;

#pragma warning disable ASPIREEVENTING001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.

/// <summary>
/// A builder for creating instances of <see cref="DistributedApplication"/>.
/// </summary>
Expand Down
4 changes: 0 additions & 4 deletions tests/Aspire.Hosting.MySql.Tests/AddMySqlTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,7 @@ public async Task SingleMySqlInstanceProducesCorrectMySqlHostsVariable(string co
// Add fake allocated endpoints.
mysql.WithEndpoint("tcp", e => e.AllocatedEndpoint = new AllocatedEndpoint(e, "localhost", 5001, containerHost));

#pragma warning disable ASPIREEVENTING001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
await builder.Eventing.PublishAsync<AfterEndpointsAllocatedEvent>(new(app.Services, app.Services.GetRequiredService<DistributedApplicationModel>()));
#pragma warning restore ASPIREEVENTING001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.

var myAdmin = builder.Resources.Single(r => r.Name.EndsWith("-phpmyadmin"));

Expand Down Expand Up @@ -287,9 +285,7 @@ public void WithPhpMyAdminProducesValidServerConfigFile(string containerHost)
using var app = builder.Build();
var appModel = app.Services.GetRequiredService<DistributedApplicationModel>();

#pragma warning disable ASPIREEVENTING001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
builder.Eventing.PublishAsync<AfterEndpointsAllocatedEvent>(new(app.Services, app.Services.GetRequiredService<DistributedApplicationModel>()));
#pragma warning restore ASPIREEVENTING001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.

using var stream = File.OpenRead(volume.Source!);
var fileContents = new StreamReader(stream).ReadToEnd();
Expand Down
2 changes: 0 additions & 2 deletions tests/Aspire.Hosting.PostgreSQL.Tests/AddPostgresTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -416,9 +416,7 @@ public async Task WithPostgresProducesValidServersJsonFile(string containerHost)

using var app = builder.Build();

#pragma warning disable ASPIREEVENTING001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
await builder.Eventing.PublishAsync<AfterEndpointsAllocatedEvent>(new(app.Services, app.Services.GetRequiredService<DistributedApplicationModel>()));
#pragma warning restore ASPIREEVENTING001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.

using var stream = File.OpenRead(volume.Source!);
var document = JsonDocument.Parse(stream);
Expand Down
4 changes: 0 additions & 4 deletions tests/Aspire.Hosting.Redis.Tests/AddRedisTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,7 @@ public async Task SingleRedisInstanceProducesCorrectRedisHostsVariable(string co
// Add fake allocated endpoints.
redis.WithEndpoint("tcp", e => e.AllocatedEndpoint = new AllocatedEndpoint(e, "localhost", 5001, containerHost));

#pragma warning disable ASPIREEVENTING001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
await builder.Eventing.PublishAsync<AfterEndpointsAllocatedEvent>(new(app.Services, app.Services.GetRequiredService<DistributedApplicationModel>()));
#pragma warning restore ASPIREEVENTING001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.

var commander = builder.Resources.Single(r => r.Name.EndsWith("-commander"));

Expand All @@ -193,9 +191,7 @@ public async Task MultipleRedisInstanceProducesCorrectRedisHostsVariable(string
redis1.WithEndpoint("tcp", e => e.AllocatedEndpoint = new AllocatedEndpoint(e, "localhost", 5001, containerHost));
redis2.WithEndpoint("tcp", e => e.AllocatedEndpoint = new AllocatedEndpoint(e, "localhost", 5002, "host2"));

#pragma warning disable ASPIREEVENTING001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
await builder.Eventing.PublishAsync<AfterEndpointsAllocatedEvent>(new (app.Services, app.Services.GetRequiredService<DistributedApplicationModel>()));
#pragma warning restore ASPIREEVENTING001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.

var commander = builder.Resources.Single(r => r.Name.EndsWith("-commander"));

Expand Down
2 changes: 0 additions & 2 deletions tests/Aspire.Hosting.Tests/Dcp/ApplicationExecutorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,6 @@ private static ApplicationExecutor CreateAppExecutor(
configuration = builder.Build();
}

#pragma warning disable ASPIREEVENTING001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
return new ApplicationExecutor(
NullLogger<ApplicationExecutor>.Instance,
NullLogger<DistributedApplication>.Instance,
Expand All @@ -765,7 +764,6 @@ private static ApplicationExecutor CreateAppExecutor(
new DistributedApplicationEventing(),
serviceProvider
);
#pragma warning restore ASPIREEVENTING001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
}

private sealed class TestHostApplicationLifetime : IHostApplicationLifetime
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

#pragma warning disable ASPIREEVENTING001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.

using Aspire.Hosting.Eventing;
using Aspire.Hosting.Utils;
using Microsoft.Extensions.DependencyInjection;
Expand Down

0 comments on commit 07470ec

Please sign in to comment.