Decompiling the ASP.NET Ajax Library

So in an attempt to look deep into the bowels of the UpdatePanel of ASP.NET Ajax, I decided to employ one of my favorite geek tools, Reflector. Reflector has a nice interface, but Visual Studio’s is a little better, so I tried out one of the addins that actually dumps the decompiled dll into text files. I ended up using this one. It actually creates the class library and pulled the javascript files out of the Microsoft.Web.Extensions library. Pretty cool.

But it didn’t work perfectly. If you want to do the same, be prepared to deal with some issues.

  1. Private classes aren’t handled well. This is actually a problem with Reflector, not with the plugin. Only two classes (that I could find) used them, so those had to be manually fixed.
  2. Enums were decompiled as their integer values. C# will not implicitly cast an int to an enum, so all of those ints had to be cast.
  3. Properties where not properly decompiled, but that’s not a surprise. As you .NET geeks surely know, properties are syntactic sugar, and are compiled in IL to get_ and set_ methods. These showed up in the decompiled C# code, and had to be changed to properties manually.
  4. Ref and out were often switched.

After fixing a little over four hundred syntax errors, everything was fine :). It actually went pretty quickly, since most things fell into the above four categories, and those are easy to fix.

Now I have the MS ASP.NET Ajax library in code files. So the plugin works pretty well, though things could be improved.