Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[RuntimeAsync] Use truncating sprintf to make resumption stub names#120698

Merged
VSadov merged 2 commits into
dotnet:mainfrom
VSadov:crtAssert
Oct 15, 2025
Merged

[RuntimeAsync] Use truncating sprintf to make resumption stub names#120698
VSadov merged 2 commits into
dotnet:mainfrom
VSadov:crtAssert

Conversation

@VSadov

@VSadov VSadov commented Oct 14, 2025

Copy link
Copy Markdown
Member

sprintf_s pops a crt assert dialog in checked/debug if the buffer is too short.
_snprintf_s with _TRUNCATE does not have such problem.

We may see some pretty long names here.

An example that was triggering the assert in #119432 was:
System.Collections.Generic.IAsyncEnumerator<System.ValueTuple<Microsoft.CodeAnalysis.Project,System.Collections.Immutable.ImmutableArray<System.ValueTuple<Microsoft.CodeAnalysis.ISymbol,Microsoft.CodeAnalysis.FindSymbols.SymbolGroup>>>>.MoveNextAsync

Copilot AI review requested due to automatic review settings October 14, 2025 15:44

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.

Pull Request Overview

This PR fixes a CRT assert dialog issue in debug/checked builds when creating async resumption stub names. The change replaces sprintf_s with _snprintf_s using the _TRUNCATE option to handle cases where method names are too long for the fixed-size buffer.

Key changes:

  • Switches from sprintf_s to _snprintf_s with _TRUNCATE flag to prevent CRT assertion dialogs
  • Maintains the same buffer size and error checking logic

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @mangod9
See info in area-owners.md if you want to be subscribed.

Comment thread src/coreclr/vm/jitinterface.cpp Outdated
@VSadov VSadov enabled auto-merge (squash) October 15, 2025 15:42
@VSadov

VSadov commented Oct 15, 2025

Copy link
Copy Markdown
Member Author

/ba-g the failures are all #120577

@VSadov VSadov merged commit bc12cc3 into dotnet:main Oct 15, 2025
95 of 97 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 15, 2025
Sign up for free to 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.

3 participants