-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[RuntimeAsync] Remove no longer needed workarounds for Roslyn NYIs #120895
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Tagging subscribers to this area: @mangod9 |
|
/ba-g this is a test-only change in a disabled test area. (verified that it passes when enabled) |
There was a problem hiding this comment.
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 modernizes the async struct test by removing obsolete workarounds. The changes eliminate manual @this variable copies that were previously needed to work around C# compiler limitations in a prototype phase, simplifying the code to use this directly.
Key Changes
- Removed TODO comments and manual
@thisvariable workarounds from async methods - Direct usage of
thisin struct async methodsTest()andInstanceCall()
| AssertEqual(100, this.Value); | ||
| this.Value++; | ||
| await this.InstanceCall(); | ||
| AssertEqual(101, this.Value); | ||
|
|
||
| AssertEqual(100, @this.Value); | ||
| @this.Value++; | ||
| await @this.InstanceCall(); | ||
| AssertEqual(101, @this.Value); | ||
|
|
||
| await @this.TaskButNotAsync(); | ||
| AssertEqual(102, @this.Value); | ||
| await this.TaskButNotAsync(); | ||
| AssertEqual(102, this.Value); |
Copilot
AI
Oct 31, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test expects this.Value to remain 101 after the async operation (line 53), but since structs are value types and this is passed by value to async methods, mutations in InstanceCall() won't affect the caller's copy. After removing the @this workaround, this test logic may be incorrect unless the C# compiler now generates code to properly handle struct mutation across await points with by-ref semantics.
Async methods in structs can compile and work correctly now.
This is a test-only change that removes workarounds.