Fix async/await decompilation for Roslyn 3.6 #5

Open
JarLob wants to merge 1 commit from JarLob/async into ilspyv2
JarLob commented 2020-07-20 06:58:42 -05:00 (Migrated from github.com)

Closes https://github.com/0xd4d/dnSpy/issues/1488

Minimal changes to fix the issue, although it seems async/await decompilation logic in ILSpy 6.x is more complex.

Closes https://github.com/0xd4d/dnSpy/issues/1488 Minimal changes to fix the issue, although it seems async/await decompilation logic in ILSpy 6.x is more complex.
JarLob commented 2020-07-28 06:45:18 -05:00 (Migrated from github.com)

I just secretly hope @0xd4d doesn't accept the pull request because he/she has almost finished migration to the newest ILSpy version :)

I just secretly hope @0xd4d doesn't accept the pull request because he/she has almost finished migration to the newest ILSpy version :)
0xd4d commented 2020-07-28 06:58:41 -05:00 (Migrated from github.com)

Thanks for the PR and for pinging me. I'll have a look!

Thanks for the PR and for pinging me. I'll have a look!
0xd4d commented 2020-07-28 07:07:52 -05:00 (Migrated from github.com)

I tried the code, and it works when it's compiled in Debug mode, but when I compile the example in https://github.com/0xd4d/dnSpy/issues/1488 in Release mode, it fails to decompile it because there are only 4 ILAst instructions.

Changing the 5 check in MatchTaskCreationPattern() to 4 instead seems to solve it.

I tried the code, and it works when it's compiled in Debug mode, but when I compile the example in https://github.com/0xd4d/dnSpy/issues/1488 in Release mode, it fails to decompile it because there are only 4 ILAst instructions. Changing the `5` check in `MatchTaskCreationPattern()` to `4` instead seems to solve it.
JarLob commented 2020-07-28 07:10:10 -05:00 (Migrated from github.com)

Thanks, will look into it.

Thanks, will look into it.
0xd4d commented 2020-07-28 07:12:16 -05:00 (Migrated from github.com)

I just noticed that there's a body[pos - 3] that could fail since pos = len-2. We'd need to verify that pos-3 >= 0 first. (line 104)

I just noticed that there's a `body[pos - 3]` that could fail since pos = len-2. We'd need to verify that pos-3 >= 0 first. (line 104)
This pull request is broken due to missing fork information.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'JarLob/async:JarLob/async'
git switch 'JarLob/async'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'ilspyv2'
git merge --no-ff 'JarLob/async'
git switch 'JarLob/async'
git rebase 'ilspyv2'
git switch 'ilspyv2'
git merge --ff-only 'JarLob/async'
git switch 'JarLob/async'
git rebase 'ilspyv2'
git switch 'ilspyv2'
git merge --no-ff 'JarLob/async'
git switch 'ilspyv2'
git merge --squash 'JarLob/async'
git switch 'ilspyv2'
git merge --ff-only 'JarLob/async'
git switch 'ilspyv2'
git merge 'JarLob/async'
git push origin 'ilspyv2'
Sign in to join this conversation.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-dnSpy/ILSpy!5
No description provided.