Skip to content

Document new threading settings#47575

Open
MichalStrehovsky wants to merge 7 commits intomainfrom
MichalStrehovsky-patch-1
Open

Document new threading settings#47575
MichalStrehovsky wants to merge 7 commits intomainfrom
MichalStrehovsky-patch-1

Conversation

@MichalStrehovsky
Copy link
Copy Markdown
Member

@MichalStrehovsky MichalStrehovsky commented Jul 25, 2025


- The default size of stack is dictated by VM and OS policies.
- This setting allows overriding the default.
- The specified size should be between 64 kB and 2 GB and a multiple of the natural allocation granularity of the OS.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

a multiple of the natural allocation granularity of the OS

Can we align the size up in the implementation so that this does not need to be documented? I think it is only a problem on Windows. This should behave just like the stackSize argument for System.Threading.Thread constructor where we do the same.

@BillWagner BillWagner modified the milestones: July 2025, August 2025 Aug 6, 2025
jkotas and others added 3 commits August 15, 2025 10:12
Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com>
Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com>
@learn-build-service-prod
Copy link
Copy Markdown
Contributor

PoliCheck Scan Report

The following report lists PoliCheck issues in PR files. Before you merge the PR, you must fix all severity-1 issues. Other issues are also a high priority. The AI Review Details column lists suggestions for either removing or replacing the terms. If you find a false positive result, mention it in a PR comment and include this text: #policheck-false-positive. This feedback helps reduce false positives in future scans.

✅ No issues found

More information about PoliCheck

Information: PoliCheck | Severity Guidance | Term
For any questions: Try searching the learn.microsoft.com contributor guides or post your question in the Learn support channel.

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
Copilot AI review requested due to automatic review settings March 11, 2026 00:43
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds documentation for a new .NET 10 runtime configuration option that controls the default stack size for threads created by the .NET runtime, expanding the existing threading runtime-config reference.

Changes:

  • Documented a new “DefaultStackSize” threading configuration setting.
  • Added a new section describing default behavior, constraints, and configuration surfaces (runtimeconfig.json + environment variable).

You can also share your feedback on Copilot code review. Take the survey.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

| | Setting name | Values | Version introduced |
| - | - | - | - |
| **runtimeconfig.json** | `System.Threading.DefaultStackSize` | A decimal integer that specifies the stack size, in bytes, for threads created by the .NET runtime | .NET 10 |
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

is it really decimal here but hex for the env var? that seems quite confusing

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yep, the COMPlus_/DOTNET_ variables have been hex for 25+ years. And yep, people expect decimal most of the time and we had bugs around that even in our products.

See e.g. the GC settings: https://learn.microsoft.com/en-us/dotnet/core/runtime-config/garbage-collector#ways-to-specify-the-configuration

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

oh dear 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants