How .NET Reflector saved me hours of work

Take a free trial and find bugs in 3rd party components, libraries, frameworks, and any code where you don’t have the source.

A little while ago, I got an email from Ben, who’d been using .NET Reflector. We’d asked how his trial was going, and he told us about how Reflector let him drill down to a problem in 3rd party code in no time at all. It’s great to learn more about how the tool is being used, so we invited Ben to give us a little more detail:

Debugging 3rd party components with .NET Reflector

We’re developing the GUI for a robotics motion control system, to be used by a component creator that supplies a large chip manufacturer with components. The GUI lets the operator create very precise patterns (in the microns) to dispense goop at high speeds. The GUI design calls for the layout to be customizable in terms of what controls are present, their layout, what size they are, and what colors are used to render the controls. To help accomplish this we were using a mixture of our own components and 3rd party Telerik controls for WPF.

Unfortunately, we were having trouble with a control called RadPane, which is a container control. One section of this 3rd party control was erring out under certain conditions, and would display a very unhelpful “source code unavailable” message upon crashing. I used .NET Reflector to easily decompile the involved dll and run the debugger through the now present source code.

The whole process was mostly automatic, actually. I downloaded the .NET Reflector trial and installed the Visual Studio component. Using the new VS menu option for .NET Reflector, I opened up the Telerik dll that was returning the unhelpful message and then ran the GUI to reproduce the error. The VS2010 debugger highlighted the newly-available source code, and let me know that the issue was with passing in an uninitialized variable. So now I knew what was causing the crash.

I rewound the stack frame to our own call to the dll, and found exactly where the call to the Telerik control was being made and why the variable was uninitialized. As it turned out, we were failing to find an existing control before trying to add it to the pane’s content for one of our newly created user controls. Trying to set layout and color properties for a non-existent control broke the application inside the 3rd party code.

.NET Reflector saved me hours worth of work in trying to guess where the issue was occurring. Without it, I would have had to place breakpoints before and after where I thought the issue might be happening and work through what breakpoints tripped, and what the application conditions were while the program progressed from our code to 3rd party code and back again.

Even then, since the 3rd party code didn’t have any source code I wouldn’t be able to tell where the issues started to become visible. So the whole process would have involved a great deal of guesswork. With .net reflector the whole processes took about ten minutes (which included playing around with the new tool a bit), and let me find out exactly where and what the problem was.

Ben Holtzman

We’re really grateful to Ben for sharing this with us, and as a small token of thanks we’ve sent him a free copy of .NET Reflector VSPro (seeing as the trial saved him so much time already).

This entry was posted in Community, Version 7.5, Visual Studio and tagged , on by .

About Chris

A background in technical publishing; editing articles on Simple-Talk and SQLServerCentral for 3 years now. When I’ve not been editing articles, I’ve been editing or proofing books covering everything from .NET performance testing to Exchange Server, XML Schema Design, and the SQL Server Query Optimizer. I built a few websites to help pay my way through college, but the less said about them, the better.

Leave a Reply

Your email address will not be published. Required fields are marked *