Internal Microsoft Tools Available to the Public

One of the coolest resources that Microsoft employees have is an internal website filled with hundreds and hundreds of small but useful apps and utilities, many of which were written by Microsoft employees.  Sadly, few of the tools are made available outside of Microsoft, but here are a bunch that have made it out and places to look for more.

Fiddler: In the author’s own words: “Fiddler is a HTTP Debugging Proxy which logs all HTTP traffic between your computer and the Internet. Fiddler allows you to inspect all HTTP Traffic, set breakpoints, and “fiddle” with incoming or outgoing data. Fiddler is designed to be much simpler than using NetMon or Achilles, and includes a simple but powerful JScript.NET event-based scripting subsystem.”

Sandcastle: This is the actual tool that Microsoft uses to generate the .NET Framework’s MSDN-style documentation.  NDoc works fairly well, but Sandcastle is the new tool of choice for building help files.

FxCop: The same tool behind “Code Analysis” functionality in select Visual Studio 2005 Editions, this is one of the most important tools for .NET software developers. This outstanding tool analyzes managed code assemblies for over 200 types of defects, and will point out all kinds of “gotchas” that you never would have noticed on your own.

LogParser: A truly amazing tool, LogParser allows you to write SQL queries against data stored in random files in all kinds of different formats, including XML, CSV and various IIS log formats, and it can write the results to lots of different formats — all without loading the data into a database! If it doesn’t support the format you need, you can write an extension for it.

WiX: One of the first, if not the first, internal Microsoft tool to go open-source.  A set of command-line utilities that build MSI/MSM files from XML command files.  Great for building installers in an automated build process.

RoboCopy and much more: RoboCopy is a very powerful and reliable file copy/move tool that also includes directory synchronization.  It is packaged with dozens of other great tools in the Windows Server 2003 Resource Kit Tools package.  (Many of the tools do not require Windows Server 2003.)

One of the newest and fastest-growing places to find Microsoft-created tools is CodePlex, Microsoft’s newest “community development” website. There is no good way to determine exactly which projects originate from Microsoft, but some are clearly stated. One of the tools you will find here is the Team Foundation Server Administration Tool.

Some tools turn up on the official Microsoft website as unsupported downloads.  For example, Lookout, released in early 2005, is an Outlook add-in that lets you quickly search all types of Outlook and file system data.  Not very useful, perhaps, in this age of Windows Desktop Search and Google Desktop, but it’s an example of what you can find if you dig around in Microsoft Downloads.

Browse the GotDotNet User Samples area — look for the Microsoft logo next to the sample title.  XML tools and Web Service tools are also available on GotDotNet.

Know of more useful tools that originated inside Microsoft?  Please share them!

Two Down: Exam 70-536 – .NET 2.0 App Development Foundation

While the blog has been silent over the last couple of months, I’ve been preparing for and taking more certification exams.  That amidst never-ending yard and house work in this unusually dry, hot summer.

A couple of weeks back, I took the 70-536 exam and walked away with a score of 895.  Disappointing (yes, all things are relative) because I got 100% on the sections that should have been the hardest for me and missed questions on “easier” sections.  However, a lot always depends on how they phrase the questions and how much you read into them.  This was no better than any of the past MS exams in that regard.

I’m now certified as an MCTS: .NET Framework 2.0 Distributed Applications.  Could they make these titles any longer?  My end goal is MCPD, which requires three more exams (argh).

The majority of the 45-question, 2-hr max test was code questions where you have four or five code samples from which to choose.  There were also “choose and order” questions where you have 6-7 actions and you have to pick just the ones you need and put them in the right order.

None of the exam prep books were available when I prepared for this test, and the scope of this exam is so large that I resorted to simply reading the MSDN class library documentation.  I went through each class in the exam prep list, looked it up and read the docs.  Yes, it was every bit as painful as it sounds.  I used the MeasureUp practice test after I had read through everything.

The official MS Press prep book is finally available, with another non-Microsoft book supposedly coming soon.  Here’s the exam prep guide.

Use MSBuild with .NET 1.1

As most of you probably know, MSBuild is the new XML-driven build tool provided with .NET Framework 2.0.  You do not need to install Visual Studio 2005 to get and use MSBuild.  I’ll never understand why Microsoft went away from nmake and make files when they moved to Visual Studio .NET from the old C/C++ compilers.  It was a big design mistake and one that has made it difficult to create automated builds or build scripts of any significant complexity.  Thankfully they finally decided to clone nAnt and give us a real build tool again.

In any case, the real point of this post is that .NET 1.1 projects have just as much, if not more, to gain from MSBuild as .NET 2.0 projects do, and that has just become much easier.  The “MSBuild Extras – Toolkit for .NET 1.1” is now available.  If you’ve been using nAnt, this is a great way to prepare for .NET 2.0 and take advantage of MSBuild’s power today.

Also of interest, you’ll find that the download for this toolkit is on a Microsoft site called CodePlex, stated to be “Microsoft’s community development” site.  I’m not quite what this means to GotDotNet, which has filled exactly that role for many years now.  Perhaps Microsoft is hoping to create their own SourceForge in CodePlex.  It will be interesting to see how it is ultimately used, but it seems to be picking up a bunch of interesting projects.

One Down: Exam 70-529 – .NET 2.0 Distributed App Development

It’s been quite some time (C++/MFC/COM era) since I’ve updated my Microsoft certifications, so with the brand-new .NET 2.0 exams trickling out, now seemed like a good time to renew.  The goal this time around: MCPD Enterprise Applications, or Microsoft Certified Professional Developer: Enterprise Applications Developer.  (If you hadn’t heard, Microsoft revamped the certification program yet again.)

I started off by taking 70–529 – .NET 2.0 Distributed Application Development about a week ago.  This is a 40 question, 2 hour (maximum) test that covers Web services, WSE 3.0, Remoting, MSMQ, “serviced components” (i.e. COM+) and asynchronous calling patterns and Remoting events.  The interesting things about this test are that 1) Remoting is an almost-dead technology and 2) WSE 3.0 is not even part of the .NET Framework.

Remoting still exists in .NET 2.0, but no one at Microsoft will recommend writing any new code with it.  It’s really only there for backward compatibility.  You should have heard of Windows Communication Framework (formerly Indigo) by now, and Remoting will truly be dead when it arrives.  Remoting should have had little or no presence in this brand-new test, but it’s there, so you need to know it.

Aside from that, the rest of the topics are quite relevant to any .NET developer writing distributed applications today.  The questions are multiple-choice style, with choose-one, choose-two, and choose-all variants.

Final result: Pass, score 953 (passing is 700).

Get the Consolas Font for Visual Studio 2005 from Microsoft

Every now and then Microsoft releases an update for Visual Studio that arrives with little or no fanfare, and the latest example is the Consolas font package.  According to Microsoft, “Consolas is intended for use in programming environments and other circumstances where a monospaced font is specified.”

Consolas is specifically designed for ClearType, Microsoft’s advanced font-smoothing/anti-aliasing technology found in Windows XP and Windows Server 2003.  According to the licensing terms, Consolas is only available to licensed users of Visual Studio 2005.  Of course, the font would be useful in many other environments.  When you install the package, it changes the default text editor font in Visual Studio 2005 to Consolas.

I’ve only spent a day with Consolas, but so far I like it.  You will probably need to adjust your ClearType settings with the ClearType Tuner to avoid having the font appear either too light or too dark.  ClearType is mainly intended for LCD screens, but I’m using it on a CRT with good results too.

To Throw or Not to Throw?

You may have noticed inconsistencies in the .NET Framework BCL (Base Class Library) since 1.0 with regards to the behavior of Get/Indexer methods when the requested value does not exist.  For instance, the indexer on the 1.1 System.Collections.Hashtable class returns null/Nothing if the requested value does not exist.  However, the indexer on System.Data.DataRow, which you often use to retrieve column values from a DataTable, throws an exception if the requested column does not exist.  In yet another twist, System.Reflection.Assembly’s GetType() method has two overloads that accept boolean parameters indicating whether or not to throw an exception if the type is not found.

These differences are the result of various Microsoft BCL development teams and individuals with differing opinions on “throw on missing” vs. “don’t throw on missing.”  This has been a long-running debate inside Microsoft, and it’s something that you should also consider carefully when designing your classes.  While working at Microsoft several years ago, I had the opportunity to monitor some of these debates on several of the internal technical discussion groups (which carry massive amounts of emails).

The first question you might ask is: in an average execution flow, would I expect to encounter missing values, or does that represent an exceptional circumstance?  In a general purpose class when you don’t know how it will be used, there’s no way to answer this question.  This, of course, is the problem that Microsoft faces.

Fortunately, it appears that a consensus has finally formed within the BCL team.  I believe that it is a reasonable compromise between the two approaches and introduces a pattern that is easily recognizable by developers while maximizing flexibility.  This pattern includes a pair of methods: Try<Operation>() and <Operation>().  For example, TryGet() and Get().  It’s a very simple idea — the Try version of the method returns a boolean indicating whether the operation will succeed or fail, and the non-Try version throws an exception if the operation fails.  The biggest downside of this approach, in my opinion, comes down to the additional clutter it brings to a class – namely, doubling the method count for certain types of methods.

It’s important to be aware of this pattern, because you will find it in many places in the .NET Framework 2.0 BCL.  The new classes in System.Collections.Generic might be the ones you encounter most often, but you will also find this pattern on the common types, like Int32.TryParse() and Int32.Parse().  It’s interesting to note that this pattern existed in 1.0/1.1, but only on the Double class!

One potential gotcha, which represents a big difference between 1.0/1.1 and 2.0, is that the indexer on 2.0’s Dictionary (hashtable) throws KeyNotFoundException when the key is missing, and in 1.1’s Hashtable, the indexer does not throw an exception in that case.  Be careful of this difference when you’re used to 1.1 and working in 2.0, or vice versa.

When you’re designing classes, I encourage you to take advantage of this pattern (where appropriate) to make the behavior of your classes more predictable and consistent with the rest of the Framework.

%d bloggers like this: