-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Caller of an async local function cannot expect any of the callee’s code to execute #64482
Changes from 3 commits
d3ee505
cc83c79
d3416e3
c7fcfb0
8569782
3d34864
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,32 @@ | ||
# This document lists known breaking changes in Roslyn after .NET 6 all the way to .NET 7. | ||
|
||
## Caller of an async local function cannot expect any of the callee�s code to execute. | ||
|
||
***Introduced in Visual Studio 2022 version 17.5*** | ||
|
||
See https://github.com/dotnet/roslyn/issues/43697 for the rational. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. typo: rationale #Closed There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider adding a one sentence summary, maybe something like: Let's send an email as FYI to compat council for new compat break. It would be good to add a note to the spec even though it's an older/incomplete document, and tag Rex on the edit (so that definite assignment rules in standard can reflect this change as appropriate). #Closed |
||
The code below is now going to report a definite assignment error: | ||
```csharp | ||
public async Task M() | ||
{ | ||
bool a; | ||
await M1(); | ||
Console.WriteLine(a); // error CS0165: Use of unassigned local variable 'a' | ||
|
||
async Task M1() | ||
{ | ||
if ("" == String.Empty) | ||
{ | ||
throw new Exception(); | ||
} | ||
else | ||
{ | ||
a = true; | ||
} | ||
} | ||
} | ||
``` | ||
|
||
## Type tests for `ref` structs are not supported. | ||
|
||
***Introduced in Visual Studio 2022 version 17.4*** | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1320,7 +1320,11 @@ protected virtual void VisitLocalFunctionUse( | |
if (isCall) | ||
{ | ||
Join(ref State, ref localFunctionState.StateFromBottom); | ||
Meet(ref State, ref localFunctionState.StateFromTop); | ||
|
||
if (!symbol.IsAsync) | ||
{ | ||
Meet(ref State, ref localFunctionState.StateFromTop); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we have a follow-up issue to track the decision to also perform this Meet when the call is "immediately awaited"? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
That is a language design change that I am not planning to champion at the moment. |
||
} | ||
} | ||
localFunctionState.Visited = true; | ||
} | ||
|
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.
nit: GitHub diff shows some unicode character as the apostrophe for "callee's". Is that intentional? #Closed