Skip to content
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

[release/9.0-preview7] Fix throwing exception when calling RunClassConstructor on a generic type with a static constructor #105535

Merged

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Jul 26, 2024

Backport of #105513 to release/9.0-preview7

/cc @steveisok

Customer Impact

  • Customer reported
  • Found internally

Customers who use RuntimeHelpers.RunClassConstructor on a generic type with a static constructor are currently getting an exception because the runtime was no longer assuming it was already initialized.

First reported in #103891, but also failed app compat testing in https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2106458. DevExpress also indicated they were hitting this with their WPF controls.

Regression

  • Yes
  • No

#99183 introduced the regression.

Testing

A test was added to invoke the static constructor on a generic type and it did not throw an exception.

Risk

Low - this is a targeted fix

IMPORTANT: If this backport is for a servicing release, please verify that:

  • The PR target branch is release/X.0-staging, not release/X.0.

  • If the change touches code that ships in a NuGet package, you have added the necessary package authoring and gotten it explicitly reviewed.

steveisok and others added 5 commits July 26, 2024 02:26
…type with a static constructor

#99183 seems to have done away with assuming that a generic type's static constructor was
always "initialized". As a result, if you call RunClassConstructor on it, the runtime would throw an exception.

Fixes #103891
Copy link
Contributor

Tagging subscribers to this area: @mangod9
See info in area-owners.md if you want to be subscribed.

@carlossanlop
Copy link
Member

/ba-g failures are unrelated

@carlossanlop carlossanlop merged commit bb63da9 into release/9.0-preview7 Jul 26, 2024
124 of 130 checks passed
@carlossanlop carlossanlop deleted the backport/pr-105513-to-release/9.0-preview7 branch July 26, 2024 19:40
@github-actions github-actions bot locked and limited conversation to collaborators Aug 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-VM-coreclr Servicing-approved Approved for servicing release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants