Click here to monitor SSC
Av rating:
Total votes: 7
Total comments: 1


Richard Morris
.NET Reflector Saved their Bacon: The Gremlins strike back
24 April 2009

Quite often, .NET Reflector is downloaded in an emergency. Whereas most of the users are developers who use it as a routine to explore objects and methods inside Assemblies, the occasional user is getting it because they are in desperate straits. We've always felt that we, and other NET Reflector users, wanted to hear more about these real-life emergencies, so we sent Richard Morris to investigate.

Not too long ago, Simple-Talk asked seasoned developers for stories about how  .NET Reflector had handed them the technological equivalent of one of Willy Wonka’s golden tickets. In this, the second or our “.NET Reflector Saved My Bacon!” interviews, we take a look at the near-disasters that two developers faced, and managed to dodge. First up, we sat down with Christoph Mueller, a .NET consultant, and got down to business:

"I’ve been working with .NET since January 2002 – about the same time that .NET 1.0 came out. Before that I’d spent a couple of years developing ASP and C++/COM applications. Right now I’m manager of a similar team at the IT consulting firm bridgingIT, and still get to spend part of my time developing SharePoint applications — MOSS applications by now, of course."

"The trouble came when we were implementing a SharePoint Portal Server 2003 application (this was in 2004). One of the features the client wanted was a special web part that let the user define special search alerts (basically, finding a variety of products in certain preset categories). The problem was creating that alert. The call to create the Alert object went well, and the alert fired each time the indexer ran and found documents fitting the search query. Unfortunately, calling up the MyAlerts page caused a crash!"

 "Going into the debugger and having the application break on each exception was a little tedious, but it finally stopped at an exception related to our problem, within one of the Alert class’s methods. The exception told us that the Alert object’s ApplicationData property (a string) did not have the expected value. Naturally, official documentation never tells you what you need. The only documentation that exists for this string, anywhere, is 'Gets or sets persisted data about this alert.' Fabulous."

 "However, the call stack gave us the Alert object’s method and that was when we used .NET Reflector to find out about this method’s source. I could immediately see some manipulation to the ApplicationData property / field. It turned out the correct input for the string was an XML structure of two nodes, with one node containing the length of the query string bumped up by 50. We eventually verified that fact with another alert via the normal SharePoint UI, changed our code accordingly, and things have been working beautifully ever since."

 "I felt great when I finally figured this out, and not solving it would have been embarrassing to say the least! Maybe a call with MS-Support would have helped. After all, we weren’t using undocumented features, just poorly documented ones."

"Is there anything I’d change about .NET Reflector? Hmm, yes… well, maybe. Sometimes when I’m out on the road, and my UMTS/GPRS connection is unstable, it wants to connect and look for updates. If the connection and update don’t work, .NET Reflector will just refuse to start. Or at least that’s what it used to do. I admit I haven’t had it for a while, so maybe this kink’s been fixed."

Our second Troubled Tale is from Dan Vanderboom, who has been developing enterprise mobile software solutions for the past five years, and has been working with .NET since 1999:

"Reflector has saved my bacon quite a few times actually, but the closest call came when I was working for a mobile software development company. I had built a small one-off solution for a client, and six months later had all but forgotten about it; it was a short project, probably only a week's worth of my time went into it. But in the switch over to a new version control system (TFS) and a rebuild of my development machine, I had completely lost the entire solution and all source code." 

"I might have never known anything about it, except that this same customer called us back needing some urgent modifications, and naturally I was in the middle of a much larger project with nearly impossible deadlines. When I discovered we were missing the source code, I nearly panicked!  Luckily, the binaries were installed on one of our in-house mobile devices…"

 "I was already familiar with Reflector from my daily use of investigating and learning from .NET Framework and third party libraries. So, I opened the binaries, used the File Disassembler plugin, incorporated the source files into a new project and got it to build again; it was just fantastic! I’d lost all of my comments, and the code needed a little tweaking to get it compiling again, but it saved me from starting from scratch and looking like a fool in front of our customer. Reflector is like a dear friend, and I wouldn't want to program without having it installed and ready in my quick launch bar!" 

"As great as it is, there are a few things I’d change about Reflector. When decompiling C# 3.0 code that uses lambda expressions and anonymous methods, I‘d like to see that code as anonymous methods or lambdas, and not as compiler-generated identifiers for compiler-generated classes. I’d make the code look as similar as possible to how it was written. It would also be nice to have some code generation options: should using statements appear inside the namespace block or outside?  Should every property or method in a class be preceded with "this." or not…"

 "Also, because I often switch between CF 2.0, CF 3.5, and full framework 2.0, 3.0, and 3.5, and now Silverlight versions, the only way I know to get Reflector to switch over is by clearing out all the assemblies in the list, closing out, and restarting.  I'd love to be able to switch on the fly, and have it remember my favourite list of assemblies in each mode."



This article has been viewed 4737 times.
Richard Morris

Author profile: Richard Morris

Richard Morris is a journalist, author and public relations/public affairs consultant. He has written for a number of UK and US newspapers and magazines and has offered strategic advice to numerous tech companies including Digital Island, Sony and several ISPs. He now specialises in social enterprise and is, among other things, a member of the Big Issue Invest advisory board. Big Issue Invest is the leading provider to high-performing social enterprises & has a strong brand name based on its parent company The Big Issue, described by McKinsey & Co as the most well known and trusted social brand in the UK.

Search for other articles by Richard Morris

Rate this article:   Avg rating: from a total of 7 votes.


Poor

OK

Good

Great

Must read
 
Have Your Say
Do you have an opinion on this article? Then add your comment below:
You must be logged in to post to this forum

Click here to log in.


Subject: grammar
Posted by: Anonymous (not signed in)
Posted on: Monday, April 27, 2009 at 3:10 PM
Message:
when you have multiple paragraphs of quotation from the same person, only the last paragraph should have an end quote. (They all should have begin quotes. it's not balanced quote marks but it is proper English.) Google "quoting multiple paragraphs".


 






recommended site pinvoke

PInvoke.net is a user-driven wiki which provides .NET developers with native method signatures, so they don't have to spend time writing them from scratch.




TortoiseSVN and Subversion Cookbook Part 3: In, Out, and Around
 Subversion doesn't have to be difficult, especially if you have Michael Sorens's guide at hand. After... Read more...

Feature Usage Reporting in Early Access Programs
 After doing Web development, you can get very used to the luxury of having basic information about your... Read more...

Feature Usage Reporting in Early Access Programs
 After doing Web development, you can get very used to the luxury of having basic information about your... Read more...

TLS/SSL and .NET Framework 4.0
 The Secure Socket Layer is now essential for the secure exchange of digital data, and is most generally... Read more...

SmartAssembly: Eating Our Own Dogfood
 Quite often at Red Gate, we are some of our own most enthusiastic software-users. SmartAssembly is a... Read more...

A Complete URL Rewriting Solution for ASP.NET 2.0
 Ever wondered whether it's possible to create neater URLS, free of bulky Query String parameters?... Read more...

Visual Studio Setup - projects and custom actions
 This article describes the kinds of custom actions that can be used in your Visual Studio setup project. Read more...

.NET Application Architecture: the Data Access Layer
 Find out how to design a robust data access layer for your .NET applications. Read more...

Web Parts in ASP.NET 2.0
 Most Web Parts implementations allow users to create a single portal page where they can personalize... Read more...

Configuring Forms Authentication in SharePoint 2007
 Damon Armstrong provides a step-by-step guide to the processes, quirks and pitfalls of setting up... Read more...

Over 400,000 Microsoft professionals subscribe to the Simple-Talk technical journal. Join today, it's fast, simple, free and secure.

Join Simple Talk