Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add MethodInvocation trace for overload tracing#21320

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
daxian-dbw merged 3 commits intoPowerShell:masterfromjborean93:method-invocation
Jul 14, 2025

Conversation

jborean93
Copy link
Collaborator

@jborean93jborean93 commentedMar 8, 2024
edited
Loading

PR Summary

Adds a new trace source called MethodInvocation which can be used to trace what .NET methods PowerShell invokes. This is useful for both seeing what .NET methods the code is calling but also for seeing what overload PowerShell has selected based on the arguments provided.

This only applies to .NET methods, ETS members are not covered by this trace source but could potentially be added in the future.

PR Context

To be able to debug PowerShell behaviour like why" ".Split(" ") has changed across .NET versions. Also provides an analogue ofParameterBinding but for .NET methods.

For example

Trace-Command-PSHost-NameMethodInvocation-Expression {"abcdefghi".Split("", 2)}

Shows

DEBUG: 2024-03-08 12:05:54.6860 MethodInvocation Information: 0 : Invoking method: string[] Split(string separator, int count, System.StringSplitOptions options = System.StringSplitOptions.None)

PR Checklist

ninmonkey, trackd, Tadas, and mklement0 reacted with thumbs up emoji
@pull-request-quantifier-deprecatedPull Request Quantifier (deprecated)

This PR has111 quantified lines of changes. In general, a change size of upto200 lines is ideal for the best PR experience!


Quantification details

Label      : MediumSize       : +111 -0Percentile : 42.2%Total files changed: 3Change summary by file extension:.cs : +16 -0.ps1 : +95 -0

Change counts above are quantified counts, based on thePullRequestQuantifier customizations.

Why proper sizing of changes matters

Optimal pull request sizes drive a better predictable PR flow as they strike a
balance between between PR complexity and PR review overhead. PRs within the
optimal size (typical small, or medium sized PRs) mean:

  • Fast and predictable releases to production:
    • Optimal size changes are more likely to be reviewed faster with fewer
      iterations.
    • Similarity in low PR complexity drives similar review times.
  • Review quality is likely higher as complexity is lower:
    • Bugs are more likely to be detected.
    • Code inconsistencies are more likely to be detected.
  • Knowledge sharing is improved within the participants:
    • Small portions can be assimilated better.
  • Better engineering practices are exercised:
    • Solving big problems by dividing them in well contained, smaller problems.
    • Exercising separation of concerns within the code changes.

What can I do to optimize my changes

  • Use the PullRequestQuantifier to quantify your PR accurately
    • Create a context profile for your repo using thecontext generator
    • Exclude files that are not necessary to be reviewed or do not increase the review complexity. Example: Autogenerated code, docs, project IDE setting files, binaries, etc. Check out theExcluded section from yourprquantifier.yaml context profile.
    • Understand your typical change complexity, drive towards the desired complexity by adjusting the label mapping in yourprquantifier.yaml context profile.
    • Only use the labels that matter to you,see context specification to customize yourprquantifier.yaml context profile.
  • Change your engineering behaviors
    • For PRs that fall outside of the desired spectrum, review the details and check if:
      • Your PR could be split in smaller, self-contained PRs instead
      • Your PR only solves one particular issue. (For example, don't refactor and code new features in the same PR).

How to interpret the change counts in git diff output

  • One line was added:+1 -0
  • One line was deleted:+0 -1
  • One line was modified:+1 -1 (git diff doesn't know about modified, it will
    interpret that line like one addition plus one deletion)
  • Change percentiles: Change characteristics (addition, deletion, modification)
    of this PR in relation to all other PRs within the repository.


Was this comment helpful?👍 :ok_hand: :thumbsdown: (Email)
Customize PullRequestQuantifier for this repository.

@pull-request-quantifier-deprecatedPull Request Quantifier (deprecated)

This PR has113 quantified lines of changes. In general, a change size of upto200 lines is ideal for the best PR experience!


Quantification details

Label      : MediumSize       : +113 -0Percentile : 42.6%Total files changed: 3Change summary by file extension:.cs : +16 -0.ps1 : +97 -0

Change counts above are quantified counts, based on thePullRequestQuantifier customizations.

Why proper sizing of changes matters

Optimal pull request sizes drive a better predictable PR flow as they strike a
balance between between PR complexity and PR review overhead. PRs within the
optimal size (typical small, or medium sized PRs) mean:

  • Fast and predictable releases to production:
    • Optimal size changes are more likely to be reviewed faster with fewer
      iterations.
    • Similarity in low PR complexity drives similar review times.
  • Review quality is likely higher as complexity is lower:
    • Bugs are more likely to be detected.
    • Code inconsistencies are more likely to be detected.
  • Knowledge sharing is improved within the participants:
    • Small portions can be assimilated better.
  • Better engineering practices are exercised:
    • Solving big problems by dividing them in well contained, smaller problems.
    • Exercising separation of concerns within the code changes.

What can I do to optimize my changes

  • Use the PullRequestQuantifier to quantify your PR accurately
    • Create a context profile for your repo using thecontext generator
    • Exclude files that are not necessary to be reviewed or do not increase the review complexity. Example: Autogenerated code, docs, project IDE setting files, binaries, etc. Check out theExcluded section from yourprquantifier.yaml context profile.
    • Understand your typical change complexity, drive towards the desired complexity by adjusting the label mapping in yourprquantifier.yaml context profile.
    • Only use the labels that matter to you,see context specification to customize yourprquantifier.yaml context profile.
  • Change your engineering behaviors
    • For PRs that fall outside of the desired spectrum, review the details and check if:
      • Your PR could be split in smaller, self-contained PRs instead
      • Your PR only solves one particular issue. (For example, don't refactor and code new features in the same PR).

How to interpret the change counts in git diff output

  • One line was added:+1 -0
  • One line was deleted:+0 -1
  • One line was modified:+1 -1 (git diff doesn't know about modified, it will
    interpret that line like one addition plus one deletion)
  • Change percentiles: Change characteristics (addition, deletion, modification)
    of this PR in relation to all other PRs within the repository.


Was this comment helpful?👍 :ok_hand: :thumbsdown: (Email)
Customize PullRequestQuantifier for this repository.

@microsoft-github-policy-servicemicrosoft-github-policy-servicebot added the Review - NeededThe PR is being reviewed labelMar 15, 2024
@kilasuitkilasuit added WG-Interactive-Debuggingdebugging PowerShell script WG-Cmdlets-Utilitycmdlets in the Microsoft.PowerShell.Utility module WG-NeedsReviewNeeds a review by the labeled Working Group labelsJul 26, 2024
Copy link
Collaborator

@kilasuitkilasuit left a comment

Choose a reason for hiding this comment

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

I think this looks good and would be a great help in script debugging & would be good to get this merged in!

mklement0 reacted with thumbs up emoji
@SteveL-MSFT
Copy link
Member

The @PowerShell/wg-powershell-cmdlets discussed this, we are in favor of adding more diagnosability to PowerShell, but defer to the Engine WG to review.

@SteveL-MSFTSteveL-MSFT added WG-Enginecore PowerShell engine, interpreter, and runtime and removed WG-Interactive-Debuggingdebugging PowerShell script WG-Cmdlets-Utilitycmdlets in the Microsoft.PowerShell.Utility module labelsAug 21, 2024
@microsoft-github-policy-servicemicrosoft-github-policy-servicebot removed the Review - NeededThe PR is being reviewed labelAug 21, 2024
@microsoft-github-policy-servicemicrosoft-github-policy-servicebot added the Review - NeededThe PR is being reviewed labelAug 28, 2024
@IISResetMeIISResetMe self-assigned thisFeb 10, 2025
@IISResetMeIISResetMe added WG-ReviewedA Working Group has reviewed this and made a recommendation and removed WG-NeedsReviewNeeds a review by the labeled Working Group labelsFeb 10, 2025
@IISResetMe
Copy link
Collaborator

WG-Engine reviewed this PR, and we endorse the proposed new trace source.

@IISResetMeIISResetMe removed their assignmentFeb 10, 2025
@powercodepowercode removed the Review - NeededThe PR is being reviewed labelFeb 12, 2025
@microsoft-github-policy-servicemicrosoft-github-policy-servicebot added the Review - NeededThe PR is being reviewed labelFeb 19, 2025
@iSazonoviSazonov added PowerShell-Docs neededThe PR was reviewed and a PowerShell Docs update is needed and removed PowerShell-Docs neededThe PR was reviewed and a PowerShell Docs update is needed labelsFeb 20, 2025
@microsoft-github-policy-servicemicrosoft-github-policy-servicebot removed the Review - NeededThe PR is being reviewed labelFeb 20, 2025
@microsoft-github-policy-servicemicrosoft-github-policy-servicebot added the Review - NeededThe PR is being reviewed labelFeb 27, 2025
Adds a new trace source called MethodInvocation which can be used totrace what .NET methods PowerShell invokes. This is useful for bothseeing what .NET methods the code is calling but also for seeing whatoverload PowerShell has selected based on the arguments provided.This only applies to .NET methods, ETS members are not covered by thistrace source but could potentially be added in the future.
@iSazonoviSazonov added the CL-GeneralIndicates that a PR should be marked as a general cmdlet change in the Change Log labelApr 14, 2025
Copy link
Member

@daxian-dbwdaxian-dbw left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you,@jborean93!

jborean93 and 8ee9627a76dab2c8a7 reacted with heart emoji
Copy link
Collaborator

@SeeminglyScienceSeeminglyScience left a comment

Choose a reason for hiding this comment

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

LGTM!

jborean93 and 8ee9627a76dab2c8a7 reacted with heart emoji
@daxian-dbwdaxian-dbw merged commitc6329dd intoPowerShell:masterJul 14, 2025
34 checks passed
@daxian-dbwdaxian-dbw removed Review - NeededThe PR is being reviewed Medium labelsJul 14, 2025
@daxian-dbwdaxian-dbw self-assigned thisJul 14, 2025
@jborean93jborean93 deleted the method-invocation branchJuly 14, 2025 22:45
@jborean93
Copy link
CollaboratorAuthor

Thanks for the review and merge, I've opened a PR to document this new featureMicrosoftDocs/PowerShell-Docs#12226. Up to the docs gods to make it prettier and more presentable.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@daxian-dbwdaxian-dbwdaxian-dbw approved these changes

@kilasuitkilasuitkilasuit approved these changes

@iSazonoviSazonoviSazonov approved these changes

@SeeminglyScienceSeeminglyScienceSeeminglyScience approved these changes

Assignees

@daxian-dbwdaxian-dbw

Labels
CL-GeneralIndicates that a PR should be marked as a general cmdlet change in the Change LogWG-Enginecore PowerShell engine, interpreter, and runtimeWG-ReviewedA Working Group has reviewed this and made a recommendation
Projects
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

8 participants
@jborean93@SteveL-MSFT@IISResetMe@daxian-dbw@kilasuit@iSazonov@SeeminglyScience@powercode

[8]ページ先頭

©2009-2025 Movatter.jp