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

Do not keep cctor for instance fields#96656

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
MichalStrehovsky merged 2 commits intodotnet:mainfromMichalStrehovsky:trimcctor
Jan 9, 2024

Conversation

MichalStrehovsky
Copy link
Member

@MichalStrehovskyMichalStrehovsky commentedJan 9, 2024
edited
Loading

Fixes#96655

PaulusParssinen reacted with eyes emoji
@ghostghost added linkable-frameworkIssues associated with delivering a linker friendly framework area-Tools-ILLink.NET linker development as well as trimming analyzers labelsJan 9, 2024
@ghost
Copy link

Tagging subscribers to 'linkable-framework':@eerhardt,@vitek-karas,@LakshanF,@sbomer,@joperezr,@marek-safar
See info in area-owners.md if you want to be subscribed.

Issue Details

Just want to see if the tests pass. The ILLinker SLN files seem unusable for local testing because they miss projects.

Author:MichalStrehovsky
Assignees:-
Labels:

linkable-framework

Milestone:-

@MichalStrehovsky
Copy link
MemberAuthor

Looks like this is ready to review. I half expected worms to come out of this can but the CI looks reasonable.

sbomer

This comment was marked as resolved.

@MichalStrehovskyMichalStrehovsky merged commit4d4c6a7 intodotnet:mainJan 9, 2024
@MichalStrehovskyMichalStrehovsky deleted the trimcctor branchJanuary 9, 2024 23:05
@hez2010
Copy link
Contributor

hez2010 commentedJan 10, 2024
edited
Loading

Will this also affect the behaviour of cctors without beforefieldinit?

newFoo().X=1;// this should print "1" as the cctor of Foo is not beforefieldinitclassFoo{staticFoo(){}// opt-out beforefieldinitpublicstaticBarbar=new();publicintX;}classBar{publicBar(){Console.WriteLine(1);}}

I believe some applications rely on this behavior to do initialization.

@jkotas
Copy link
Member

The instance constructor is responsible for triggering the cctor in your example. The instance field access (on non-null this pointer) assumes that the cctor was triggered when the instance was created.

hez2010 reacted with thumbs up emoji

tmds pushed a commit to tmds/runtime that referenced this pull requestJan 23, 2024
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsFeb 9, 2024
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@sbomersbomersbomer approved these changes

@marek-safarmarek-safarAwaiting requested review from marek-safarmarek-safar is a code owner

Labels
area-Tools-ILLink.NET linker development as well as trimming analyzerslinkable-frameworkIssues associated with delivering a linker friendly framework
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Unnecessarily preserved cctor if an instance field is touched
4 participants
@MichalStrehovsky@hez2010@jkotas@sbomer

[8]ページ先頭

©2009-2025 Movatter.jp