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

[textanalytics] Add Debug Proxy class for ExtractKeyPhrasesResultCollection #18690

Merged
merged 4 commits into from
Feb 23, 2021

Conversation

a-noyass
Copy link
Contributor

@a-noyass a-noyass commented Feb 11, 2021

fixes #16283

All SDK Contribution checklist:

This checklist is used to make sure that common guidelines for a pull request are followed.

  • Please open PR in Draft mode if it is:
    • Work in progress or not intended to be merged.
    • Encountering multiple pipeline failures and working on fixes.
  • If an SDK is being regenerated based on a new swagger spec, a link to the pull request containing these swagger spec changes has been included above.
  • I have read the contribution guidelines.
  • The pull request does not introduce breaking changes.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

SDK Generation Guidelines

  • The generate.cmd file for the SDK has been updated with the version of AutoRest, as well as the commitid of your swagger spec or link to the swagger spec, used to generate the code. (Track 2 only)
  • The *.csproj and AssemblyInfo.cs files have been updated with the new version of the SDK. Please double check nuget.org current release version.

Additional management plane SDK specific contribution checklist:

Note: Only applies to Microsoft.Azure.Management.[RP] or Azure.ResourceManager.[RP]

  • Include updated management metadata.
  • Update AzureRP.props to add/remove version info to maintain up to date API versions.

Management plane SDK Troubleshooting

  • If this is very first SDK for a services and you are adding new service folders directly under /SDK, please add new service label and/or contact assigned reviewer.
  • If the check fails at the Verify Code Generation step, please ensure:
    • Do not modify any code in generated folders.
    • Do not selectively include/remove generated files in the PR.
    • Do use generate.ps1/cmd to generate this PR instead of calling autorest directly.
      Please pay attention to the @microsoft.csharp version output after running generate.ps1. If it is lower than current released version (2.3.82), please run it again as it should pull down the latest version,

Old outstanding PR cleanup

Please note:
If PRs (including draft) has been out for more than 60 days and there are no responses from our query or followups, they will be closed to maintain a concise list for our reviewers.

@a-noyass
Copy link
Contributor Author

@maririos So this is the only way I could get it to work. Adding a new class that defines how the Collection will look like in the debugger. If this works I can add do it for the other classes as well, or maybe this can be done during generation somehow.
The result looks like this
Screenshot 2021-02-11 100900

/// <summary>
/// Debugger Proxy class for <see cref="ExtractKeyPhrasesResultCollection"/>.
/// </summary>
public class ExtractKeyPhrasesResultCollectionDebugView
Copy link
Member

Choose a reason for hiding this comment

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

we can make this class internal

/// Initializes a new instance of the <see cref="ExtractKeyPhrasesResultCollectionDebugView"/> class.
/// </summary>
/// <param name="collection"></param>
public ExtractKeyPhrasesResultCollectionDebugView(ExtractKeyPhrasesResultCollection collection)
Copy link
Member

Choose a reason for hiding this comment

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

we can follow what https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/core/Azure.Core/src/Internal/ResponseDebugView.cs is doing. We won't need to add the docstrings so no worries about later keeping them up to date

/// Collection of <see cref="ExtractKeyPhrasesResult"/> objects corresponding
/// to a batch of documents.
/// </summary>
public List<ExtractKeyPhrasesResult> Items
Copy link
Member

Choose a reason for hiding this comment

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

my concern with having Items is that the user might see this in the debugger and then they will expect for ExtractKeyPhrasesResultCollection to have a property called Items.

Copy link
Contributor

Choose a reason for hiding this comment

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

Add [DebuggerBrowsable(DebuggerBrowsableState.RootHidden)] on this property.

@maririos
Copy link
Member

@pakrym do you know if there is another way we could achieve showing Model Version and Statistics in the same level as the items of the collection?
something like:
https://user-images.githubusercontent.com/9868623/107310059-7ba82380-6a40-11eb-8d5a-6a830d95c86e.png

@pakrym
Copy link
Contributor

pakrym commented Feb 17, 2021

Yeah, try using [DebuggerBrowsable(DebuggerBrowsableState.RootHidden)] on the Items property.

@a-noyass
Copy link
Contributor Author

a-noyass commented Feb 18, 2021

@maririos I moved the DebugView class inside the original class like we discussed before so it's not forgotten when changes are made to the original class.
I also tried the DebuggerBrowsable attribute and it worked but this way we have two Raw View fields in the debugger one for items and one for the main class which seems a bit confusing but might be okay since all the fields are visible anyway. What do you think?
image

@maririos
Copy link
Member

I like it. I think seeing the Model Version and Statistics there is more important. @suhas92 and @abhahn this address the feedback we got in latest UX Study. What do you think?

@maririos maririos requested a review from abhahn February 22, 2021 16:56
@suhas92
Copy link
Member

suhas92 commented Feb 23, 2021

I like it. I think seeing the Model Version and Statistics there is more important. @suhas92 and @abhahn this address the feedback we got in latest UX Study. What do you think?

@maririos Looks good to me.

@maririos maririos merged commit bc5bd8f into Azure:master Feb 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants