| File: SupportsDebuggingAnnotation.cs | Web Access |
| Project: src\src\Aspire.Hosting\Aspire.Hosting.csproj (Aspire.Hosting) |
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using Aspire.Hosting.Dcp.Model; namespace Aspire.Hosting.ApplicationModel; /// <summary> /// Represents an annotation that specifies that the resource can be debugged by the Aspire Extension. /// </summary> [DebuggerDisplay("Type = {GetType().Name,nq}, RequiredExtensionId = {LaunchConfigurationType,nq}")] [Experimental("ASPIREEXTENSION001", UrlFormat = "https://aka.ms/aspire/diagnostics/{0}")] internal sealed class SupportsDebuggingAnnotation : IResourceAnnotation { private SupportsDebuggingAnnotation(string launchConfigurationType, Action<Executable, string> launchConfigurationAnnotator) { LaunchConfigurationType = launchConfigurationType; LaunchConfigurationAnnotator = launchConfigurationAnnotator; } public string LaunchConfigurationType { get; } public Action<Executable, string> LaunchConfigurationAnnotator { get; } internal static SupportsDebuggingAnnotation Create<T>(string launchConfigurationType, Func<string, T> launchProfileProducer) { return new SupportsDebuggingAnnotation(launchConfigurationType, (exe, mode) => { exe.AnnotateAsObjectList(Executable.LaunchConfigurationsAnnotation, launchProfileProducer(mode)); }); } }