Skip to content

Document CS8103 UserString heap limits and data section resolution (Fixes #37987) - #56666

Merged
BillWagner merged 2 commits into
dotnet:mainfrom
Manish-1kumar:users/manish/issue-37987-cs8103-string-literal-heap-limits
Dec 1, 2026
Merged

BillWagner merged 2 commits into
dotnet:mainfrom
Manish-1kumar:users/manish/issue-37987-cs8103-string-literal-heap-limits

Conversation

@Manish-1kumar

@Manish-1kumar Manish-1kumar commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #37987

Summary of Changes

  • Documents compiler error CS8103 (Combined length of user strings used by the program exceeds allowed limit. Try to decrease use of string literals.) in \docs/csharp/language-reference/compiler-messages/string-literal.md.
  • Explains the CLI metadata UserString heap limit (^{24}$ bytes / ~16.7 MB of UTF-16 characters per compiled assembly).
  • Provides actionable remediation approaches:
    1. Moving large string payloads to embedded resources or external data files loaded at runtime.
    2. Factoring monolithic projects into multiple smaller assemblies.
    3. Enabling the Roslyn experimental data section string literal feature flag: <Features>;experimental-data-section-string-literals.
  • Removes CS8103 from the \sorry-we-don-t-have-specifics-on-this-csharp-error.md\ catch-all list and updates SEO / keyword metadata.

Internal previews

File Preview link
docs/csharp/language-reference/compiler-messages/string-literal.md Learn preview
docs/csharp/misc/sorry-we-don-t-have-specifics-on-this-csharp-error.md Learn preview

Build report

Copilot AI 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.

🟡 Changes recommended

The CS9315 guidance incorrectly ties the diagnostic to the experimental data-section feature instead of explaining UserString heap exhaustion during Edit and Continue, leaving normal debugging sessions unaddressed.

1 open issue
What changed in this PR

Adds CS8103 guidance to the existing C# string-literal diagnostics article, addressing #37987 with explanations and remedies for user-string heap limits.

Changes:

  • Explains the heap limit and common causes of CS8103.
  • Documents resource files, smaller assemblies, and experimental data-section storage as remedies.
  • Moves CS8103 help metadata from the catch-all page to the dedicated article.
File Description
docs/​csharp/​misc/​sorry-we-don-t-have-specifics-on-this-csharp-error.md Removes CS8103 from catch-all help metadata.
docs/​csharp/​language-reference/​compiler-messages/​string-literal.md Adds CS8103 metadata, heap-limit explanations, and resolution guidance.

Review effort: Balanced

@Manish-1kumar
Manish-1kumar force-pushed the users/manish/issue-37987-cs8103-string-literal-heap-limits branch from c331bd4 to 74a2036 Compare November 30, 2026 17:53

@BillWagner BillWagner left a comment

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.

Thanks @Manish-1kumar

This LGTM, and I'll :shipit: now.

@BillWagner
BillWagner merged commit d8f4e33 into dotnet:main Dec 1, 2026
12 checks passed
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.

CS8103 limitation Missing Information

3 participants