hazzik / DelegateDecompiler

A library which is able to decompile a delegate or a method body to its lambda representation
MIT License
522 stars 62 forks source link

Fix issue135 #143

Closed magicmoux closed 4 years ago

magicmoux commented 5 years ago

hi @hazzik

I had a look on this one. I think the issue comes from overlooking the Processor's OpCodes.Brtrue/Brtrue_S where the instruction is a LambdaExpression returning a bool.

Here is just a PR to show the solution I found for issue #135, but I'm not sure it is exhaustive or not. Anyway it does not seem to introduce tests regression so far.

The first test's failure is expected due to difference between both expressions' debugView

hazzik commented 4 years ago

The duplication ( x=>x.Active??x=>x.Active) happens because the decompiled lambda is changed after the decompilation. I've fixed this problem by caching them.