Skip to content

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
@ghost ghost added the area-VM-coreclr label Jul 26, 2024
Copy link
Contributor

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

@carlossanlop
Copy link
Contributor

/ba-g failures are unrelated

@carlossanlop carlossanlop merged commit bb63da9 into release/9.0-preview7 Jul 26, 2024
@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