Skip to content
This repository has been archived by the owner on Nov 11, 2020. It is now read-only.

Fix async/await decompilation for Roslyn 3.6 #5

Open
wants to merge 1 commit into
base: ilspyv2
Choose a base branch
from

Conversation

JarLob
Copy link

@JarLob JarLob commented Jul 20, 2020

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
Copy link
Author

JarLob commented Jul 28, 2020

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

@0xd4d
Copy link

0xd4d commented Jul 28, 2020

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

@0xd4d
Copy link

0xd4d commented Jul 28, 2020

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
Copy link
Author

JarLob commented Jul 28, 2020

Thanks, will look into it.

@0xd4d
Copy link

0xd4d commented Jul 28, 2020

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)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants