Migrate IIS in-process handler from DEFAULT_STACK_SIZE to System.Threading.DefaultStackSize#65737
Merged
MichalStrehovsky merged 4 commits intomainfrom Mar 16, 2026
Merged
Conversation
…host config option Co-authored-by: MichalStrehovsky <13110571+MichalStrehovsky@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Update host configuration for default stack size
Migrate IIS in-process handler from DEFAULT_STACK_SIZE to System.Threading.DefaultStackSize
Mar 11, 2026
src/Servers/IIS/AspNetCoreModuleV2/InProcessRequestHandler/InProcessOptions.cpp
Outdated
Show resolved
Hide resolved
…behavior Co-authored-by: MichalStrehovsky <13110571+MichalStrehovsky@users.noreply.github.com>
src/Servers/IIS/AspNetCoreModuleV2/InProcessRequestHandler/InProcessOptions.cpp
Outdated
Show resolved
Hide resolved
Contributor
There was a problem hiding this comment.
Pull request overview
Migrates the IIS in-process handler from the deprecated DEFAULT_STACK_SIZE runtime config to System.Threading.DefaultStackSize, converting configured hex stack-size values into the decimal string required by the new runtime property.
Changes:
- Updated the runtime property name used for stack-size configuration.
- Updated in-process options parsing to convert hex stack-size strings to decimal and adjusted the default to a decimal value.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/Servers/IIS/AspNetCoreModuleV2/CommonLib/HostFxr.h | Switches stack-size host property name to System.Threading.DefaultStackSize. |
| src/Servers/IIS/AspNetCoreModuleV2/InProcessRequestHandler/InProcessOptions.cpp | Converts configured stack size from hex to decimal string; updates default to decimal. |
You can also share your feedback on Copilot code review. Take the survey.
src/Servers/IIS/AspNetCoreModuleV2/InProcessRequestHandler/InProcessOptions.cpp
Show resolved
Hide resolved
src/Servers/IIS/AspNetCoreModuleV2/InProcessRequestHandler/InProcessOptions.cpp
Show resolved
Hide resolved
src/Servers/IIS/AspNetCoreModuleV2/InProcessRequestHandler/InProcessOptions.cpp
Show resolved
Hide resolved
2 tasks
BrennanConroy
approved these changes
Mar 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
DEFAULT_STACK_SIZEhost configuration option is being removed in dotnet/runtime#118057. Migrates the IIS in-process request handler to the replacementSystem.Threading.DefaultStackSizeproperty, which requires a decimal string instead of hex.Description
HostFxr.h: UpdateDOTNETCORE_STACK_SIZEmacro value fromL"DEFAULT_STACK_SIZE"→L"System.Threading.DefaultStackSize"InProcessOptions.cpp: Parse the configured stack size (hex with or without0xprefix, preserving backward compat) viawcstoul(..., 16)and store as decimal string. Default changes fromL"0x100000"→L"1048576"(both 1 MB). For invalid or out-of-range values, the raw configured string is passed through as-is so the runtime handles it the same way as before.No changes needed at the call site in
inprocessapplication.cpp.Original prompt
Background
The
DEFAULT_STACK_SIZEhost configuration option (used via theDOTNETCORE_STACK_SIZEmacro) is being deleted in dotnet/runtime#118057. We need to migrate to the replacementSystem.Threading.DefaultStackSizehost configuration option, which is documented in dotnet/docs#47575.What needs to change
There are three files involved across the IIS in-process request handler:
1.
src/Servers/IIS/AspNetCoreModuleV2/CommonLib/HostFxr.hCurrent:
Change to:
2.
src/Servers/IIS/AspNetCoreModuleV2/InProcessRequestHandler/InProcessOptions.cppThe stack size value is currently stored as a hex string (with optional
0xprefix) — matching whatDEFAULT_STACK_SIZEexpected. The newSystem.Threading.DefaultStackSizeproperty requires a decimal number string.Current (line 68):
The default
0x100000hex =1048576decimal (1 MB).Change to: Parse the configured value (which may be hex with or without
0xprefix, as before) and convert it to a decimal string. The default should becomeL"1048576"(decimal equivalent of0x100000).The logic should be:
CS_ASPNETCORE_HANDLER_STACK_SIZE).0xor0X, parse it as hexadecimal (usingwcstoulwith base 16) and convert to a decimal wide string.0xprefix but is a valid hex string (the old format allowed hex without the prefix), try parsing it as hexadecimal first (base 16), then convert to decimal.DEFAULT_STACK_SIZEaccepted hex with or without0xprefix. Then format the result as decimal.m_strStackSize.L"1048576"(1 MB in decimal).Here's a concrete implementation approach:
3.
src/Servers/IIS/AspNetCoreModuleV2/InProcessRequestHandler/InProcessOptions.hThe
QueryStackSize()return type and storage can remainstd::wstring— no changes needed here. However, if there are any comments referencing hex or the old format, update them for clarity.Summary of the change
HostFxr.hmacroL"DEFAULT_STACK_SIZE"L"System.Threading.DefaultStackSize"InProcessOptions.cppdefault valueL"0x100000"(hex string)L"1048576"(decimal string)InProcessOptions.cppvalue parsingThe
inprocessapplication.cppcall site (context->m_hostFxr.SetRuntimePropertyValue(DOTNETCORE_STACK_SIZE, m_pConfig->QueryStackSize().c_str())) does not need to change — it will automatically pick up the new property name via the updated macro and receive the correctly formatted decimal value fromQueryStackSize().The following is the prior conversation context from the user's chat exploration (may be truncated):
User: we currently set the
DEFAULT_STACK_SIZEhost configuration option to set the stack size. theDEFAULT_STACK_SIZEhost configuration option is going to be deleted in @dotnet/runtime/pull/118057We need to switch to the documented
System.Threading.DefaultStackSizehost configuration option (docs at @dotnet/docs/pull/47575). These settings are largely equivalent, we just need to swap the DEFAULT_STACK_SIZE string for System.Threading.DefaultStackSize string. Note however that System.Threading.DefaultStackSize accepts the setting as a decimal number. DEFAULT_STACK_SIZE accepted a hexadecimal number with or wi...This pull request was created from Copilot chat.
💡 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.