Skip to content

Pre-initialize InvariantCulture such that it can be safely used when creating stack traces - #129189

Merged
eduardo-vp merged 6 commits into
dotnet:mainfrom
eduardo-vp:fix-129159
Jun 18, 2026
Merged

Pre-initialize InvariantCulture such that it can be safely used when creating stack traces#129189
eduardo-vp merged 6 commits into
dotnet:mainfrom
eduardo-vp:fix-129159

Conversation

@eduardo-vp

Copy link
Copy Markdown
Member

The following assert is being hit when creating the stack trace in the test.

publicstaticCultureInfoInvariantCulture
{
get
{
Debug.Assert(s_InvariantCultureInfo!=null,"[CultureInfo.InvariantCulture] s_InvariantCultureInfo is null");
returns_InvariantCultureInfo;
}
}

Fixes#129159.

CopilotAI review requested due to automatic review settings June 9, 2026 20:19

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR changes CoreCLR startup to proactively run System.Globalization.CultureInfo’s class initializer during AppDomain::SetupSharedStatics(), so CultureInfo.InvariantCulture is initialized before stack trace generation paths might try to use it under extreme memory pressure (avoiding the checked-build assert observed in #129159).

Changes:

  • During default AppDomain startup, force CultureInfo class initialization via CheckRunClassInitThrowing().
  • Add a targeted comment documenting the motivation (stack trace creation under high memory pressure).

@eduardo-vp

Copy link
Copy Markdown
MemberAuthor

/azp list

@azure-pipelines

Copy link
Copy Markdown
CI/CD Pipelines for this repository:

@eduardo-vp

Copy link
Copy Markdown
MemberAuthor

/azp run runtime-coreclr outerloop

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@eduardo-vp

Copy link
Copy Markdown
MemberAuthor

/azp run runtime-coreclr outerloop

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

CopilotAI review requested due to automatic review settings June 10, 2026 18:38

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@eduardo-vp

Copy link
Copy Markdown
MemberAuthor

/azp run runtime-coreclr outerloop

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

Comment threadsrc/coreclr/vm/corhost.cpp Outdated
CopilotAI review requested due to automatic review settings June 17, 2026 02:56

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
CopilotAI review requested due to automatic review settings June 17, 2026 19:12

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

@eduardo-vp

Copy link
Copy Markdown
MemberAuthor

/azp run runtime-coreclr outerloop

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@eduardo-vp

Copy link
Copy Markdown
MemberAuthor

/ba-g timeouts only

@eduardo-vp
eduardo-vp merged commit d50582a into dotnet:mainJun 18, 2026
204 of 211 checks passed
@dotnet-milestone-botdotnet-milestone-botBot added this to the 11.0-preview6 milestone Jun 18, 2026
eiriktsarpalis pushed a commit that referenced this pull request Jul 15, 2026
…creating stack traces (#129189)
The following assert is being hit when creating the stack trace in the test.
https://github.com/dotnet/runtime/blob/89cd18abdedc793529c655f4d15cd8fad30927a6/src/libraries/System.Private.CoreLib/src/System/Globalization/CultureInfo.cs#L444-L451Fixes#129159.
---------
Co-authored-by: Eduardo Velarde <evelardepola@microsoft.com>
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
@github-actionsgithub-actionsBot locked and limited conversation to collaborators Jul 19, 2026
Sign up for freeto 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.

Test failure: baseservices/exceptions/OutOfMemoryException/OutOfMemoryException/OutOfMemoryException.cmd

3 participants

@eduardo-vp@jkotas