Skip to content

Handle RunClassConstructor with nonreflectable cctor #62947

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

Merged
merged 2 commits into from
Dec 18, 2021

Conversation

MichalStrehovsky
Copy link
Member

This is now getting hit in #62927, so it's somewhat more urgent. (The feature switches from the SDK put us into the situation that triggers this bug around RunClassConstructor on an otherwise unused type.)

Fixes dotnet/runtimelab#987.

Remember what class constructor contexts we saw during scanning phase and if the owning type is also generated, assume RunClassConstructor could be used and ensure the cctor context is also generated in the compilation phase.

This is somewhat less precise, but introducing a new node type for "a type used with RunClassConstructor" that dataflow analysis could report doesn't seem worth it.

This is now getting hit in dotnet#62927, so it's somewhat more urgent. (The feature switches from the SDK put us into the situation that triggers this bug around RunClassConstructor on an otherwise unused type.)

Fixes dotnet/runtimelab#987.

Remember what class constructor contexts we saw during scanning phase and if the owning type is also generated, assume `RunClassConstructor` could be used and ensure the cctor context is also generated in the compilation phase.

This is somewhat less precise, but introducing a new node type for "a type used with `RunClassConstructor`" that dataflow analysis could report doesn't seem worth it.
@MichalStrehovsky MichalStrehovsky merged commit 118349f into dotnet:main Dec 18, 2021
@MichalStrehovsky MichalStrehovsky deleted the fix987 branch December 18, 2021 04:59
@ghost ghost locked as resolved and limited conversation to collaborators Jan 17, 2022
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.

Infinite recursion in SR.GetResourceString when using debug ILCompiler build
2 participants