Click here to monitor SSC

Software Engineer - Red Gate Software

On Her Majesty’s Secret Source Code: .NET Reflector 7 Early Access Builds Now Available

Published 16 December 2010 12:01 pm

Dodgy Bond references aside, I’m extremely happy to be able to tell you that we’ve just released our first .NET Reflector 7 Early Access build. We’re going to make these available over the coming weeks via the main .NET Reflector download page at:

http://reflector.red-gate.com/Download.aspx

Please have a play and tell us what you think in the forum we’ve set up. Also, please let us know if you run into any problems in the same place.

The new version so far comes with numerous decompilation improvements including (after 5 years!) support for iterator blocks – i.e., the yield statement first seen in .NET 2.0. We’ve also done a lot of work to solidify the support for .NET 4.0. Clive’s written about the work he’s done to support iterator blocks in much more detail here, along with the odd problem he’s encountered when dealing with compiler generated code: http://www.simple-talk.com/community/blogs/clivet/96199.aspx.

On the UI front we’ve started what will ultimately be a rewrite of the entire front-end, albeit broken into stages over two or three major releases. The most obvious addition at the moment is tabbed browsing, which you can see in Figure 1.

TabbedDecompilation

Figure 1. .NET Reflector’s new tabbed decompilation feature. Use CTRL+Click on any item in the assembly browser tree, or any link in the source code view, to open it in a new tab.

This isn’t by any means finished. I’ll be tying up loose ends for the next few weeks, with a major focus on performance and resource usage. .NET Reflector has historically been a largely single-threaded application which has been fine up until now but, as you might expect, the addition of browser-style tabbing has pushed this approach somewhat beyond its limit. You can see this if you refresh the assemblies list by hitting F5. This shows up another problem: we really need to make Reflector remember everything you had open before you refreshed the list, rather than just the last item you viewed – I discovered that it’s always done the latter, but it used to hide all panes apart from the treeview after a Refresh, including the decompiler/disassembler window.

Ultimately I’ve got plans to add the whole VS/Chrome/Firefox style ability to drag a tab into the middle of nowhere to spawn a new window, but I need to be mindful of the add-ins, amongst other things, so it’s possible that might slip to a 7.5 or 8.0 release.

You’ll also notice that .NET Reflector 7 now needs .NET 3.5 or later to run. We made this jump because we wanted to offer ourselves a much better chance of adding some really cool functionality to support newer technologies, such as Silverlight and Windows Phone 7.

We’ve also taken the opportunity to start using WPF for UI development, which has frankly been a godsend. The learning curve is practically vertical but, I kid you not, it’s just a far better world. Really. Stop using WinForms. Now. Why are you still using it? I had to go back and work on an old WinForms dialog for an hour or two yesterday and it really made me wince. The point is we’ll be able to move the UI in some exciting new directions that will make Reflector easier to use whilst continuing to develop its functionality without (and this is key) cluttering the interface. The 3.5 language enhancements should also enable us to be much more productive over the longer term.

I know most of you have .NET Fx 3.5 or 4.0 already but, if you do need to install a new version, I’d recommend you jump straight to 4.0 because, for one thing, it’s faster, and if you’re starting afresh there’s really no reason not to.

Despite the Fx version jump the Visual Studio add-in should still work fine in Visual Studio 2005, and obviously will continue to work in Visual Studio 2008 and 2010. If you do run into problems, again, please let us know here. As before, we continue to support every edition of Visual Studio exception the Express Editions.

Speaking of Visual Studio, we’ve also been improving the add-in. You can now open and explore decompiled code for any referenced assembly in any project in your solution. Just right-click on the reference, then click Decompile and Explore on the context menu. Reflector will pop up a progress box whilst it decompiles your assembly (Figure 2) – you can move this out of the way whilst you carry on working.

VSDecompilationProgress

Figure 2. Decompilation progress. This isn’t modal so you can just move it out of the way and carry on working.

Once it’s done you can explore your assembly in the Reflector treeview (Figure 3), also accessible via the .NET Reflector > Explore Decompiled Assemblies main menu item. Double-click on any item to open decompiled source in the Visual Studio source code view. Use right-click and Go To Definition on the source view context menu to navigate through the code.

VSReflectorAssemblyBrowser

Figure 3. Using the .NET Reflector treeview within Visual Studio. Double-click on any item to open decompiled source in the source code view.

There are loads of other changes and fixes that have gone in, often under the hood, which I don’t have room to talk about here, and plenty more to come over the next few weeks. I’ll try to keep you abreast of new functionality and changes as they go in.

There are a couple of smaller things worth mentioning now though.

Firstly, we’ve reorganised the menus and toolbar in Reflector itself to more closely mirror what you might be used to in other applications.

Secondly, we’ve tried to make some of the functionality more discoverable. For example, you can now switch decompilation target framework version directly from the toolbar – and the default is now .NET 4.0.

I think that about covers it for the moment. As I said, please use the new version, and send us your feedback. Here’s that download URL again: http://reflector.red-gate.com/Download.aspx.

Until next time!

(Remember, you can also follow .NET Reflector’s progress and updates on Twitter.)

6 Responses to “On Her Majesty’s Secret Source Code: .NET Reflector 7 Early Access Builds Now Available”

  1. odalet says:

    As always, wonderful tool getting better and better with age!

    Would it be possible to add middle-button click for opening a new tab (and closing it) in addition to ctrl-click?

    PS: I could jnot post this as a reply on the forum for the “announcment” post is locked.

  2. Bart Read says:

    Hi Olivier,

    Sorry, I meant to reply to you last night, but the office Christmas party intervened.

    Firstly thanks for the feedback, and the kind comments – both Clive and I are glad to see you like that changes.

    I’m spending some time on the middle-click support at the moment. This has been trivial to implement for the treeview, and likewise for closing the tabs, however not so much for the source code view itself. My current approach is to add a message filter to handle middle-clicks, which would work fine except I still need to find a way to get the HWND, which is normally easy but in this case less so (I won’t bore you with why, or why I need to do this – gotta love COM interop). Anyway, fun times.

    Regarding the forum I did double-check with our IS team that it’s unlocked. They seemed to think it is, and in fact I’ve just noticed that somebody’s posted a couple of new threads in there.

    Hope that helps,

    Bart

  3. odalet says:

    Oups! Totally my mistake. It’s not the forum that is locked, but the announcement post… I was trying to post a reply to this post instead of a new topic… Sorry for having you waste your time.

    I sincerely hope you’ll succeed in your battle against COM interop; I suppose this is somehow related to the underlying IE control the source view embeds… if not, you’re definitely right, I don’t need no gory details… I usually try to stay as far as possible from COM. If I loved COM, I’d code native C++ only and wouldn’t need Reflector at all eh?

    I also wish you (& the whole Reflector team) the usual greetings: Merry Christmas & Happy New Year!

  4. balalakshmi says:

    Bart,
    Is it possible to load assemblies with the same name at the same time
    In my work, hourly builds have assembly numbering on a per day basis
    so, it becomes difficult to compare 2 assemblies which were built on the same day
    thanks,
    Lakshmi

  5. Bart Read says:

    No problem Olivier. Don’t think it would have been the first time something like that had happened.

    Regarding middle-click navigation: I’m going to put out a build later this week that supports it. I’ve got it working fine now but unfortunately there is a price to pay: middle click then mouse move to scroll no longer works. In theory I can probably fix this by walking the HTML document tree and finding out which element is underneath the mouse and adding some conditional handling depending upon what it is – there may also be some equally filthy alternative solution – but the point is it’s a lot of work and I’ve regrettably got other priorities so it’s not going to happen.

    I’d rather replace the control wholesale than spend any more massaging it to my will, which is probably what will happen come v8. Don’t get me wrong: using the IE window has been a great solution up until now, but it just doesn’t give us enough control any more (and there are alternatives that would), so it’s going to have to be retired. That’ll be a big job for us, but worth it to allow us to do more with the source view, I think.

  6. Bart Read says:

    Hi balalakshmi,

    I believe so. Open up .NET Reflector and then open Tools > Options from the main menu (if you’re using a pre-v7 release it’ll be View > Options). Then on the Browser pane, check “Side-by-side versioning”, the click OK. You should then be able to load assemblies with the same name side by side.

    HTH!

Leave a Reply