Skip to content
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

(maybe) await in catch/finally -- new language feature (test case available) #14

Open
goojal opened this issue Mar 7, 2024 · 0 comments

Comments

@goojal
Copy link
Collaborator

goojal commented Mar 7, 2024

When there is await in catch or finally clauses, in IL we can see compiler takes await out of catch clause and skips it if we never been in catch. And the flag is just a local variable so we don't see this block as a candidate of state controller block.
The reason we might not want to look for this pattern is the test shown below will result in exact same IL. So there is more than one way to generate same state machine.

        private static async Task AwaitInCatchV2()
        {
            int num = 0;
            try
            {
                Console.WriteLine("asd");
            }
            catch
            {
                num = 1;
            }
            if (num == 1)
            {
                await Task.Delay(5);
            }
        }
@atdimitrov atdimitrov transferred this issue from codemerx/CodemerxDecompile Mar 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant