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

Add DebuggerDisplayAttribute to CustomResourceSnapshot Collections #7012

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

afscrome
Copy link
Contributor

@afscrome afscrome commented Jan 2, 2025

Description

Adds debugger display attributes to collection types in CustomResourceSnapshot.
This makes it easier to view the resource event snapshots in the debugger.

Before:
before

After:
after

The above screenshots were produces with the following code:

var builder = DistributedApplication.CreateBuilder(args);

var other = builder.AddExecutable("other", "cmd.exe", ".");

var redis = builder.AddRedis("redis")
    .WithDataVolume()
    .WithBindMount("c:\\temp", "/mnt/tmp")
    .WithRelationship(other.Resource, "Relationship Type");

builder.Eventing.Subscribe<ResourceReadyEvent>(redis.Resource, (evt, ct) =>
{
    var _ = Task.Run(async () =>
    {
        await foreach (var resourceEvent in evt.Services.GetRequiredService<ResourceNotificationService>().WatchAsync(ct))
        {
            if (resourceEvent.Resource.Name == "redis")
            {
                // Set Breakpoint Here
            }
        }
    }, ct);

    return Task.CompletedTask;
});

builder.Build().Run();

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No
  • Does the change require an update in our Aspire docs?
Microsoft Reviewers: Open in CodeFlow

Adds debugger display attributes to collection types in `CustomResourceSnapshot`.
This makes it easier to view the resource event snapshots in the debugger.
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Jan 2, 2025
Co-authored-by: James Newton-King <[email protected]>
@afscrome
Copy link
Contributor Author

afscrome commented Jan 6, 2025

Hi @JamesNK is there anything more I need to do to get this mergeable?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants