Skip to content

Add debugging attributes to System.Security.Claims types #86424

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

Merged
merged 5 commits into from
May 19, 2023

Conversation

JamesNK
Copy link
Member

@JamesNK JamesNK commented May 18, 2023

Fixes #86421

After changes:

image

I have a question about DebuggerDisplayAttribute and ref assemblies. I added them to the implementation classes and ran the ref update command - dotnet msbuild /t:GenerateReferenceAssemblySource - but they weren't added to the reference file. I had to do it manually. What should I do here?

Extra work: It's worth adding debugger proxy views for ClaimsPrincipal and ClaimsIdentity. The proxy can remove the private/internal fields and display the counts from the claims collections. Proxies are more work so I'll hold off on that for now.

Thoughts so far?

Update:

With type proxies:

ClaimsPrincipal:

image

ClaimsIdentity:

image

@ghost
Copy link

ghost commented May 18, 2023

Note regarding the new-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

@ghost ghost assigned JamesNK May 18, 2023
@ghost
Copy link

ghost commented May 18, 2023

Tagging subscribers to this area: @dotnet/area-system-security, @bartonjs, @vcsjones
See info in area-owners.md if you want to be subscribed.

Issue Details

Fixes #86421

After changes:

image

I think it might be worth adding debugger proxy views for ClaimsPrincipal and ClaimsIdentity. The proxy can remove the private/internal fields and display the counts from the claims collections.

Thoughts do far?

Author: JamesNK
Assignees: JamesNK
Labels:

area-System.Security, new-api-needs-documentation

Milestone: -

@adamsitnik
Copy link
Member

I have a question about DebuggerDisplayAttribute and ref assemblies. I added them to the implementation classes and ran the ref update command - dotnet msbuild /t:GenerateReferenceAssemblySource - but they weren't added to the reference file. I had to do it manually. What should I do here?

cc @ViktorHofer

Copy link
Member

@adamsitnik adamsitnik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall it LGTM, I just need a confirmation from @ViktorHofer about how [DebuggerDisplayAttribute] should be used in ref files.

Thank you @JamesNK !

@adamsitnik adamsitnik added this to the 8.0.0 milestone May 18, 2023
@stephentoub
Copy link
Member

I have a question about DebuggerDisplayAttribute and ref assemblies. I added them to the implementation classes and ran the ref update command - dotnet msbuild /t:GenerateReferenceAssemblySource - but they weren't added to the reference file. I had to do it manually. What should I do here?

DebuggerDisplay is not part of the API contract. It's an implementation detail found via reflection by tools at execution time, and thus they're only relevant to the implementation assemblies. The genapi tool is told not to add them to ref assemblies:

T:System.Diagnostics.DebuggerDisplayAttribute

@JamesNK
Copy link
Member Author

JamesNK commented May 18, 2023

Thanks. Yes, I just tested removing them, and for some reason now the attributes work without being in the ref. I'm not sure what I did wrong before.

@JamesNK
Copy link
Member Author

JamesNK commented May 18, 2023

I just added type proxies. Original issue updated with screenshots.

@JamesNK
Copy link
Member Author

JamesNK commented May 19, 2023

"runtime (Build ios-arm64 Release AllSubsets_Mono)" is failing. It seems unrelated.

Can I merge? Should I rebase to try to get a green build?

@stephentoub stephentoub merged commit cb98949 into dotnet:main May 19, 2023
@stephentoub
Copy link
Member

It's unrelated. Merging. Thanks.

@ghost ghost locked as resolved and limited conversation to collaborators Jun 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve debugging experience of ClaimsPrincipal
3 participants