diff --git a/src/Aspire.Hosting.Yarp/YarpResourceExtensions.cs b/src/Aspire.Hosting.Yarp/YarpResourceExtensions.cs index 98b7cdeb0d7..4785e366fb8 100644 --- a/src/Aspire.Hosting.Yarp/YarpResourceExtensions.cs +++ b/src/Aspire.Hosting.Yarp/YarpResourceExtensions.cs @@ -43,7 +43,9 @@ public static IResourceBuilder AddYarp( { yarpBuilder.WithEnvironment(ctx => { +#pragma warning disable ASPIRECERTIFICATES001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. var developerCertificateService = ctx.ExecutionContext.ServiceProvider.GetRequiredService(); +#pragma warning restore ASPIRECERTIFICATES001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. if (!developerCertificateService.SupportsContainerTrust) { // On systems without the ASP.NET DevCert updates introduced in .NET 10, YARP will not trust the cert used diff --git a/src/Aspire.Hosting/ApplicationModel/ResourceExtensions.cs b/src/Aspire.Hosting/ApplicationModel/ResourceExtensions.cs index ff17b7b0e28..45f8e2bf461 100644 --- a/src/Aspire.Hosting/ApplicationModel/ResourceExtensions.cs +++ b/src/Aspire.Hosting/ApplicationModel/ResourceExtensions.cs @@ -399,7 +399,9 @@ internal static IEnumerable GetSupportedNetworks(this IResour Func certificateDirectoryPathsFactory, CancellationToken cancellationToken = default) { +#pragma warning disable ASPIRECERTIFICATES001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. var developerCertificateService = executionContext.ServiceProvider.GetRequiredService(); +#pragma warning restore ASPIRECERTIFICATES001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. var trustDevCert = developerCertificateService.TrustCertificate; var certificates = new X509Certificate2Collection(); diff --git a/src/Aspire.Hosting/Dcp/DcpExecutor.cs b/src/Aspire.Hosting/Dcp/DcpExecutor.cs index a492dbd3049..c9c21de8842 100644 --- a/src/Aspire.Hosting/Dcp/DcpExecutor.cs +++ b/src/Aspire.Hosting/Dcp/DcpExecutor.cs @@ -70,7 +70,9 @@ internal sealed partial class DcpExecutor : IDcpExecutor, IConsoleLogsService, I private readonly CancellationTokenSource _shutdownCancellation = new(); private readonly DcpExecutorEvents _executorEvents; private readonly Locations _locations; +#pragma warning disable ASPIRECERTIFICATES001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. private readonly IDeveloperCertificateService _developerCertificateService; +#pragma warning restore ASPIRECERTIFICATES001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. private readonly DcpResourceState _resourceState; private readonly ResourceSnapshotBuilder _snapshotBuilder; @@ -105,7 +107,9 @@ public DcpExecutor(ILogger logger, DcpNameGenerator nameGenerator, DcpExecutorEvents executorEvents, Locations locations, +#pragma warning disable ASPIRECERTIFICATES001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. IDeveloperCertificateService developerCertificateService) +#pragma warning restore ASPIRECERTIFICATES001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. { _distributedApplicationLogger = distributedApplicationLogger; _kubernetesService = kubernetesService; diff --git a/src/Aspire.Hosting/DeveloperCertificateService.cs b/src/Aspire.Hosting/DeveloperCertificateService.cs index e9f1e98fb92..223f5775fbb 100644 --- a/src/Aspire.Hosting/DeveloperCertificateService.cs +++ b/src/Aspire.Hosting/DeveloperCertificateService.cs @@ -9,7 +9,9 @@ namespace Aspire.Hosting; +#pragma warning disable ASPIRECERTIFICATES001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. internal class DeveloperCertificateService : IDeveloperCertificateService +#pragma warning restore ASPIRECERTIFICATES001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. { private readonly Lazy> _certificates; private readonly Lazy _supportsContainerTrust; diff --git a/src/Aspire.Hosting/DistributedApplicationBuilder.cs b/src/Aspire.Hosting/DistributedApplicationBuilder.cs index fc88bd556f8..446eb28cd3b 100644 --- a/src/Aspire.Hosting/DistributedApplicationBuilder.cs +++ b/src/Aspire.Hosting/DistributedApplicationBuilder.cs @@ -325,7 +325,9 @@ public DistributedApplicationBuilder(DistributedApplicationOptions options) return new AspireStore(Path.Combine(aspireDir, ".aspire")); }); +#pragma warning disable ASPIRECERTIFICATES001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. _innerBuilder.Services.AddSingleton(); +#pragma warning restore ASPIRECERTIFICATES001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. // Shared DCP things (even though DCP isn't used in 'publish' and 'inspect' mode // we still honour the DCP options around container runtime selection. diff --git a/src/Aspire.Hosting/IDeveloperCertificateService.cs b/src/Aspire.Hosting/IDeveloperCertificateService.cs index 81b60313a3c..1ff40760300 100644 --- a/src/Aspire.Hosting/IDeveloperCertificateService.cs +++ b/src/Aspire.Hosting/IDeveloperCertificateService.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Collections.Immutable; +using System.Diagnostics.CodeAnalysis; using System.Security.Cryptography.X509Certificates; namespace Aspire.Hosting; @@ -9,6 +10,7 @@ namespace Aspire.Hosting; /// /// Service that provides information about developer certificate trust capabilities. /// +[Experimental("ASPIRECERTIFICATES001", UrlFormat = "https://aka.ms/aspire/diagnostics/{0}")] public interface IDeveloperCertificateService { /// diff --git a/tests/Aspire.Hosting.Tests/Dcp/DcpExecutorTests.cs b/tests/Aspire.Hosting.Tests/Dcp/DcpExecutorTests.cs index 6759aeef90e..c78567bc71c 100644 --- a/tests/Aspire.Hosting.Tests/Dcp/DcpExecutorTests.cs +++ b/tests/Aspire.Hosting.Tests/Dcp/DcpExecutorTests.cs @@ -2021,6 +2021,7 @@ private static DcpExecutor CreateAppExecutor( var developerCertificateService = new TestDeveloperCertificateService(new List(), false, false); +#pragma warning disable ASPIRECERTIFICATES001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. return new DcpExecutor( NullLogger.Instance, NullLogger.Instance, @@ -2043,6 +2044,7 @@ private static DcpExecutor CreateAppExecutor( events ?? new DcpExecutorEvents(), new Locations(), developerCertificateService); +#pragma warning restore ASPIRECERTIFICATES001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. } private sealed class TestExecutableResource(string directory) : ExecutableResource("TestExecutable", "test", directory); diff --git a/tests/Aspire.Hosting.Tests/DistributedApplicationTests.cs b/tests/Aspire.Hosting.Tests/DistributedApplicationTests.cs index 5ffacba43a3..92a9ff71279 100644 --- a/tests/Aspire.Hosting.Tests/DistributedApplicationTests.cs +++ b/tests/Aspire.Hosting.Tests/DistributedApplicationTests.cs @@ -652,7 +652,9 @@ public async Task VerifyContainerIncludesExpectedDevCertificateConfiguration(boo await app.StartAsync().DefaultTimeout(TestConstants.DefaultOrchestratorTestLongTimeout); var s = app.Services.GetRequiredService(); +#pragma warning disable ASPIRECERTIFICATES001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. var dc = app.Services.GetRequiredService(); +#pragma warning restore ASPIRECERTIFICATES001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. var list = await s.ListAsync().DefaultTimeout(TestConstants.DefaultOrchestratorTestLongTimeout); Assert.Collection(list, diff --git a/tests/Aspire.Hosting.Tests/Utils/TestDeveloperCertificateService.cs b/tests/Aspire.Hosting.Tests/Utils/TestDeveloperCertificateService.cs index 4091ad868a6..6f31b41a506 100644 --- a/tests/Aspire.Hosting.Tests/Utils/TestDeveloperCertificateService.cs +++ b/tests/Aspire.Hosting.Tests/Utils/TestDeveloperCertificateService.cs @@ -6,7 +6,9 @@ namespace Aspire.Hosting.Tests.Utils; +#pragma warning disable ASPIRECERTIFICATES001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. public sealed class TestDeveloperCertificateService(List certificates, bool supportsContainerTrust, bool trustCertificate) : IDeveloperCertificateService +#pragma warning restore ASPIRECERTIFICATES001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. { /// public ImmutableList Certificates { get; } = certificates.ToImmutableList(); diff --git a/tests/Aspire.Hosting.Yarp.Tests/AddYarpTests.cs b/tests/Aspire.Hosting.Yarp.Tests/AddYarpTests.cs index e3b8a3895a2..a3c8b977068 100644 --- a/tests/Aspire.Hosting.Yarp.Tests/AddYarpTests.cs +++ b/tests/Aspire.Hosting.Yarp.Tests/AddYarpTests.cs @@ -30,6 +30,7 @@ public void VerifyYarpResourceWithTargetPort() [InlineData(false)] public async Task VerifyRunEnvVariablesAreSet(bool containerCertificateSupport) { + #pragma warning disable ASPIRECERTIFICATES001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. var builder = TestDistributedApplicationBuilder.Create(DistributedApplicationOperation.Run); // Report that developer certificates won't support container scenarios @@ -57,6 +58,7 @@ public async Task VerifyRunEnvVariablesAreSet(bool containerCertificateSupport) var value = Assert.Contains("YARP_UNSAFE_OLTP_CERT_ACCEPT_ANY_SERVER_CERTIFICATE", env); Assert.Equal("true", value); } + #pragma warning restore ASPIRECERTIFICATES001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. } [Fact] @@ -78,6 +80,7 @@ public async Task VerifyPublishEnvVariablesAreSet() [Fact] public async Task VerifyWithStaticFilesAddsEnvironmentVariable() { + #pragma warning disable ASPIRECERTIFICATES001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. var builder = TestDistributedApplicationBuilder.Create(DistributedApplicationOperation.Run); // Yarp requires an IDeveloperCertificateService in run mode when building it's environment variables. @@ -94,11 +97,13 @@ public async Task VerifyWithStaticFilesAddsEnvironmentVariable() var value = Assert.Contains("YARP_ENABLE_STATIC_FILES", env); Assert.Equal("true", value); + #pragma warning restore ASPIRECERTIFICATES001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. } [Fact] public async Task VerifyWithStaticFilesWorksInPublishOperation() { + #pragma warning disable ASPIRECERTIFICATES001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. var builder = TestDistributedApplicationBuilder.Create(DistributedApplicationOperation.Publish); // Yarp requires an IDeveloperCertificateService in run mode when building it's environment variables. @@ -114,11 +119,13 @@ public async Task VerifyWithStaticFilesWorksInPublishOperation() var value = Assert.Contains("YARP_ENABLE_STATIC_FILES", env); Assert.Equal("true", value); + #pragma warning restore ASPIRECERTIFICATES001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. } [Fact] public async Task VerifyWithStaticFilesBindMountAddsEnvironmentVariable() { + #pragma warning disable ASPIRECERTIFICATES001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. var builder = TestDistributedApplicationBuilder.Create(DistributedApplicationOperation.Run); // Yarp requires an IDeveloperCertificateService in run mode when building it's environment variables. @@ -137,6 +144,7 @@ public async Task VerifyWithStaticFilesBindMountAddsEnvironmentVariable() var value = Assert.Contains("YARP_ENABLE_STATIC_FILES", env); Assert.Equal("true", value); + #pragma warning restore ASPIRECERTIFICATES001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. } [Fact]