Skip to content

Ensure static constructor is reflection-callable when NonPublicConstructors were kept#103946

Merged
jkotas merged 1 commit intodotnet:mainfrom
MichalStrehovsky:keepcctor
Jun 26, 2024
Merged

Ensure static constructor is reflection-callable when NonPublicConstructors were kept#103946
jkotas merged 1 commit intodotnet:mainfrom
MichalStrehovsky:keepcctor

Conversation

@MichalStrehovsky
Copy link
Member

This ensures that whenever we've seen the static constructor was reflection-accessed, we make sure it's runnable with RunClassConstructor.

This previously required some acrobatics because the static constructor itself could be reflection blocked and we might have still needed to RunClassConstructor the type with such constructor (notably the SR class preinitializes random ResourceManager related types to avoid recursion). Redoing everything to simply use the reflectable static constructor method as a marker.

Cc @dotnet/ilc-contrib

…uctors were kept

This ensures that whenever we've seen the static constructor was reflection-accessed, we make sure it's runnable with RunClassConstructor.

This previously required some acrobatics because the static constructor itself could be reflection blocked and we might have still needed to RunClassConstructor the type with such constructor (notably the SR class preinitializes random ResourceManager related types to avoid recursion). Redo everything to simply use the reflectable static constructor method as a marker.
@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas
See info in area-owners.md if you want to be subscribed.

Copy link
Member

@jkotas jkotas left a comment

Choose a reason for hiding this comment

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

Thanks

@jkotas jkotas merged commit aeb07f7 into dotnet:main Jun 26, 2024
@MichalStrehovsky MichalStrehovsky deleted the keepcctor branch June 26, 2024 04:07
@github-actions github-actions bot locked and limited conversation to collaborators Jul 26, 2024
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.

2 participants