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

Make inherited protected internal instance members accessible in class scope.#25245

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 5 commits intoPowerShell:masterfrommawosoft:fix-24898
May 12, 2025

Conversation

mawosoft
Copy link
Contributor

@mawosoftmawosoft commentedMar 27, 2025
edited
Loading

PR Summary

This PR enables PowerShell classes to access inheritedprotected internal instance members in addition toprotected ones. It expands the existing scope checks forIsFamily to check for bothIsFamily andIsFamilyOrAssembly.

Fixes#24898.

PR Context

After switching to .NET 9 in Powershell 7.5, PowerShell classes can no longer call$this.MemberwiseClone() because the API signature of the method in the .NET SDK was changed fromprotected toprotected internal. Other APIs may be affected as well, but this is the most notable problem, causing abreaking change when existing scripts switch from PowerShell 7.4 to 7.5 or newer.

To speed up the review process, this PR makes only minimal changes adressing access to inheritedinstance members. These changes should be backported to 7.5 immediately (bugfix). A backport to 7.4 should also be considered (enhancement).

Future considerations for inherited static members

At the moment, PowerShell classes can only access public inherited static members. If it is desirable to allow access toprotected andprotected internal static members as well, I already have a separate PR ready to submit, after this one has been merged.

PR Checklist

mklement0 reacted with thumbs up emoji
@mawosoft

This comment was marked as outdated.

@iSazonoviSazonov added the CL-GeneralIndicates that a PR should be marked as a general cmdlet change in the Change Log labelMar 27, 2025
@iSazonov
Copy link
Collaborator

@mawosoft Please look CI failures. I see only 8 failed tests.

@mawosoft

This comment was marked as outdated.

@iSazonov
Copy link
Collaborator

@mawosoft Let's wait MSFT team member's review. It can take a long time.

@microsoft-github-policy-servicemicrosoft-github-policy-servicebot added the Review - NeededThe PR is being reviewed labelApr 4, 2025
- Remove tests for static members because this PR is limited to instance members.- Add tests for accessing instance members dynamically.- Clean up code and clarify test descriptions.
@mawosoftmawosoft changed the titleWIP: Make protected internal base class members accessible in class scope.Make inherited protected internal instance members accessible in class scope.Apr 7, 2025
@mawosoft
Copy link
ContributorAuthor

@iSazonov,@SeeminglyScience,@daxian-dbw

To speed up the review process, this PR makes only minimal changes adressing access to inheritedinstance members. These changes should be backported to 7.5 immediately (bugfix). A backport to 7.4 should also be considered (enhancement).

Future considerations for inherited static members

At the moment, PowerShell classes can only access public inherited static members. If it is desirable to allow access toprotected andprotected internal static members as well, I already have a separate PR ready to submit, after this one has been merged.

See PR description.

@iSazonov
Copy link
Collaborator

After switching to .NET 9 in Powershell 7.5, PowerShell classes can no longer call $this.MemberwiseClone()

Can we have a test to ensure this now works?

@microsoft-github-policy-servicemicrosoft-github-policy-servicebot removed the Review - NeededThe PR is being reviewed labelApr 8, 2025
@mawosoft
Copy link
ContributorAuthor

mawosoft commentedApr 8, 2025
edited
Loading

Can we have a test to ensure this now works?

@iSazonov Done.

iSazonov reacted with thumbs up emoji

@microsoft-github-policy-servicemicrosoft-github-policy-servicebot added the Review - NeededThe PR is being reviewed labelApr 15, 2025
@FabienTschanz
Copy link

Any chance we can get this PR reviewed? Thank you!

@daxian-dbw
Copy link
Member

Sorry for the long delay! I will make sure review this PR next Monday.

Copy link
Member

@daxian-dbwdaxian-dbw left a comment
edited
Loading

Choose a reason for hiding this comment

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

@mawosoft Again, sorry for the long delay! The product changes look good to me, but I left 2 comments in the test changes. Please take a look, thanks!

@microsoft-github-policy-servicemicrosoft-github-policy-servicebot added Waiting on AuthorThe PR was reviewed and requires changes or comments from the author before being accept and removed Waiting on AuthorThe PR was reviewed and requires changes or comments from the author before being accept labelsMay 12, 2025
@daxian-dbw
Copy link
Member

/azp run PowerShell-CI-linux-packaging PowerShell-Windows-Packaging-CI

@azure-pipelinesAzure Pipelines
Copy link

No pipelines are associated with this pull request.

@daxian-dbwdaxian-dbw merged commiteb1cc6d intoPowerShell:masterMay 12, 2025
38 checks passed
@microsoft-github-policy-serviceMicrosoft GitHub Policy Service
Copy link
Contributor

microsoft-github-policy-servicebot commentedMay 12, 2025
edited by unfurl-linksbot
Loading

📣 Hey @@mawosoft, how did we do? We would love to hear your feedback with the link below! 🗣️

🔗https://aka.ms/PSRepoFeedback

@mawosoft
Copy link
ContributorAuthor

@daxian-dbw What are your thoughts on doing this for static members as well? See "future considerations" in the PR Context at the top.

Also, don't forget to backport to 7.5 :) Not sure how that selection process works here.

@daxian-dbw
Copy link
Member

I agree to support the same for static members for the sake of consistency. Please submit a new PR for that. Thank you!

pwshBot pushed a commit to pwshBot/PowerShell that referenced this pull requestMay 12, 2025
mawosoft added a commit to mawosoft/PowerShell that referenced this pull requestMay 13, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@iSazonoviSazonoviSazonov left review comments

@daxian-dbwdaxian-dbwdaxian-dbw approved these changes

@SeeminglyScienceSeeminglyScienceAwaiting requested review from SeeminglyScience

Assignees

@daxian-dbwdaxian-dbw

Labels
Backport-7.4.x-MigratedCL-GeneralIndicates that a PR should be marked as a general cmdlet change in the Change Log
Projects
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

MemberwiseClone is missing after upgrade to powershell 7.5.0
5 participants
@mawosoft@iSazonov@FabienTschanz@daxian-dbw@TravisEz13

[8]ページ先頭

©2009-2025 Movatter.jp