Friday, February 18, 2011

ILSpy and F#

Suddenly a new contender in the post-Reflector age -- ILSpy, emerging from the SharpDevelop stable.

So I decided to give it a whirl with the same F# code as with the simple tests I made last week with Cecil.Decompiler -- a few extension methods for Option

The first thing I notice is that I can't copy and paste code from the decompilation screen -- I have to save it, and which point I get a button to open Explorer in the same directory as I saved. The C# code generated looks sane

Unlike Cecil, this gets the F# branching right in representing the highlighted section

It also handles compiler generated temporaries just fine -- albeit with the same 'C'-style if

And ૼ bonus ૼ while Cecil choked on this C# code

ILSpy comes up with

which leaks some of the internal plumbing -- delegate caching; how extension methods are actually handled -- but does at least deliver.

Post a Comment