Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 7, 2025

Adds documentation for the new DOTNET_Thread_DefaultStackSize environment variable introduced in .NET 9, which configures the default stack size (in bytes) for VM threads.

Changes

  • Added new section "Default stack size for new threads" to threading.md
  • Included configuration table with environment variable details
  • Added usage examples for Windows, Linux, and macOS
  • Added C# code reference showing thread creation behavior
  • Noted that threads created with explicit stack size remain unaffected
  • Fixed markdown linting issues (blank lines around headings and code blocks)

Example Usage

export DOTNET_Thread_DefaultStackSize=2097152  # 2 MB
dotnet myapp.dll

This setting affects threads created via System.Threading.Thread and similar APIs that don't explicitly specify stack size. If unset, the system or runtime default applies.

Original prompt

Update docs/core/runtime-config/threading.md to include documentation for the new environment variable DOTNET_Thread_DefaultStackSize=val, which sets the stack size, in bytes, for new VM threads created with the default stack size. Add a section describing what it does, a configuration table, usage examples for several platforms, and a note that threads created with an explicit stack size are unaffected. Include this in the appropriate section following the style of the current threading configuration documentation. Make sure to add the frontmatter ai-usage: ai-assisted.

Example table entry:

Setting name Values Version introduced
Environment variable DOTNET_Thread_DefaultStackSize An integer value (bytes). Example: 1048576 for 1 MB .NET 9

This pull request was created as a result of the following prompt from Copilot chat.

Update docs/core/runtime-config/threading.md to include documentation for the new environment variable DOTNET_Thread_DefaultStackSize=val, which sets the stack size, in bytes, for new VM threads created with the default stack size. Add a section describing what it does, a configuration table, usage examples for several platforms, and a note that threads created with an explicit stack size are unaffected. Include this in the appropriate section following the style of the current threading configuration documentation. Make sure to add the frontmatter ai-usage: ai-assisted.

Example table entry:

Setting name Values Version introduced
Environment variable DOTNET_Thread_DefaultStackSize An integer value (bytes). Example: 1048576 for 1 MB .NET 9

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Update threading documentation for new environment variable Document DOTNET_Thread_DefaultStackSize environment variable for .NET 9 Nov 7, 2025
Copilot finished work on behalf of agocke November 7, 2025 00:48
Copilot AI requested a review from agocke November 7, 2025 00:48
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.

2 participants