Don't emit DebuggerStepThroughAttribute for runtime async methods#81035
Merged
Don't emit DebuggerStepThroughAttribute for runtime async methods#81035
Conversation
- Modified SourceMethodSymbol.AddSynthesizedAttributes to check IsRuntimeAsyncEnabledIn before adding DebuggerStepThroughAttribute - Added test AsyncStateMachineAttribute_RuntimeAsync to verify the fix - When runtime async is enabled, no state machine is generated, so the attribute is not needed Co-authored-by: 333fred <2371880+333fred@users.noreply.github.com>
- Updated AsyncStateMachineAttribute_RuntimeAsync test to use local verify function - Follows the pattern used in CodeGenAsyncTests.cs for runtime async tests Co-authored-by: 333fred <2371880+333fred@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Update synthesized attribute generation for runtime async methods
Don't emit DebuggerStepThroughAttribute for runtime async methods
Nov 4, 2025
Member
|
@copilot src/Compilers/CSharp/Test/Emit3/Attributes/AttributeTests_Synthesized.cs:1836-1843 |
- Removed manual parse options and compilation setup - Now using CreateRuntimeAsyncCompilation helper as specified - Helper automatically handles runtime-async feature flag and SYSLIB5007 suppression Co-authored-by: 333fred <2371880+333fred@users.noreply.github.com>
Contributor
Author
333fred
approved these changes
Nov 4, 2025
Member
|
@dotnet/roslyn-compiler for review. |
jcouv
reviewed
Nov 5, 2025
src/Compilers/CSharp/Test/Emit3/Attributes/AttributeTests_Synthesized.cs
Outdated
Show resolved
Hide resolved
jcouv
reviewed
Nov 5, 2025
src/Compilers/CSharp/Test/Emit3/Attributes/AttributeTests_Synthesized.cs
Show resolved
Hide resolved
jcouv
reviewed
Nov 5, 2025
src/Compilers/CSharp/Test/Emit3/Attributes/AttributeTests_Synthesized.cs
Show resolved
Hide resolved
jcouv
reviewed
Nov 5, 2025
src/Compilers/CSharp/Test/Emit3/Attributes/AttributeTests_Synthesized.cs
Outdated
Show resolved
Hide resolved
jcouv
reviewed
Nov 5, 2025
src/Compilers/CSharp/Test/Emit3/Attributes/AttributeTests_Synthesized.cs
Outdated
Show resolved
Hide resolved
jcouv
reviewed
Nov 5, 2025
src/Compilers/CSharp/Test/Emit3/Attributes/AttributeTests_Synthesized.cs
Show resolved
Hide resolved
jcouv
reviewed
Nov 5, 2025
Member
jcouv
left a comment
There was a problem hiding this comment.
Done with review pass (commit 4)
AlekseyTs
reviewed
Nov 5, 2025
src/Compilers/CSharp/Test/Emit3/Attributes/AttributeTests_Synthesized.cs
Outdated
Show resolved
Hide resolved
AlekseyTs
reviewed
Nov 5, 2025
src/Compilers/CSharp/Test/Emit3/Attributes/AttributeTests_Synthesized.cs
Show resolved
Hide resolved
- Added AsyncStateMachineAttribute_RuntimeAsync_Lambda test - Added AsyncStateMachineAttribute_RuntimeAsync_LocalFunction test - Both tests verify no state machine types are generated when runtime async is enabled - All 6 runtime async tests now pass (2 for regular methods, 2 for lambdas, 2 for local functions) Co-authored-by: 333fred <2371880+333fred@users.noreply.github.com>
Member
|
@AlekseyTs @jcouv feedback addressed, please take another look |
jcouv
reviewed
Nov 6, 2025
src/Compilers/CSharp/Test/Emit3/Attributes/AttributeTests_Synthesized.cs
Outdated
Show resolved
Hide resolved
jcouv
reviewed
Nov 6, 2025
Member
jcouv
left a comment
There was a problem hiding this comment.
Done with review pass (commit 8)
AlekseyTs
reviewed
Nov 6, 2025
src/Compilers/CSharp/Test/Emit3/Attributes/AttributeTests_Synthesized.cs
Outdated
Show resolved
Hide resolved
Contributor
|
Done with review pass (commit 9) #Closed |
Member
|
@AlekseyTs for another review pass please |
AlekseyTs
reviewed
Nov 7, 2025
src/Compilers/CSharp/Test/Emit3/Attributes/AttributeTests_Synthesized.cs
Outdated
Show resolved
Hide resolved
333fred
added a commit
to 333fred/roslyn
that referenced
this pull request
Nov 10, 2025
* upstream/main: Simplify sequence point display (dotnet#81104) [main] Update dependencies from dotnet/arcade (dotnet#81129) [main] Update dependencies from dotnet/arcade (dotnet#81105) Target typed conditional expression recovery (dotnet#81025) dotnet#81118: Fix dropdown in "Move static members" dialog (dotnet#81119) Don't emit DebuggerStepThroughAttribute for runtime async methods (dotnet#81035)
Member
|
@333fred Consider trimming the content that goes into merge/squash commit message. I see this in commit history, which doesn't seem very useful: |
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.
✅ Completed: Fix DebuggerStepThroughAttribute for Runtime Async Methods
SourceMethodSymbol.csto NOT emit DebuggerStepThroughAttribute when runtime async is enabledSummary of Changes
Production Code
File:
src/Compilers/CSharp/Portable/Symbols/Source/SourceMethodSymbol.cscompilation.IsRuntimeAsyncEnabledIn(target)before emittingDebuggerStepThroughAttributeTest Code
File:
src/Compilers/CSharp/Test/Emit3/Attributes/AttributeTests_Synthesized.csAsyncStateMachineAttribute_RuntimeAsynctest with Debug and Release variants for regular async methodsAsyncStateMachineAttribute_RuntimeAsync_Lambdatest with Debug and Release variants for async lambdasAsyncStateMachineAttribute_RuntimeAsync_LocalFunctiontest with Debug and Release variants for async local functionsCreateRuntimeAsyncCompilationhelper for proper runtime async compilation setupDebuggerStepThroughAttributeis emitted on async methods, lambdas, or local functionsTest Results
✅ All 6 runtime async attribute tests pass (regular methods, lambdas, local functions - each with Debug and Release)
✅ All broader AsyncStateMachineAttribute tests pass
✅ CodeQL security scan: No issues detected
Key Findings
AsyncStateMachineAttributewere already correctly handled (only added when state machine exists)Relates to test plan #75960
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.