StyleCop Goes Public (finally)

by David 7/30/2008 2:37:00 PM

One of the things I missed most from my days at MS was StyleCop - a simple (internal) tool to make following coding guidelines second nature and end all (read: "most") arguments about whether your constants should be uppercased or not (etc).  In a nutshell StyleCop plugs into VS.Net and gives you build errors if it detects your code is not conforming to the configured coding standards - simple.  A silver bullet for enforcing coding standards across a team.

It's been more than a couple of years since I moved on from MS, but in May they finally released it to the masses (thanks to Howard for the heads up on this).  There seems to have been some confusion over the naming; initially being released as Source Analysis and then reverting back to StyleCop hence URLs still refer to Source Analysis.

More info here:

Why haven't I got Vista SP1?

by David 7/17/2008 11:32:00 AM

I've been reading up on the ADO.NET Entity Framework - the latest preview of which has been released as part of the VS08.Net SP1 & .Net 3.5 SP1 Beta.  As has become expected, ScottGu's done a detailed job of explaining exactly what's in it.  I was going to install it and play around, but Scott notes you should have Vista SP1 installed first:

"If you are running Windows Vista you should make sure you have Vista SP1 installed before trying to install .NET 3.5 SP1 Beta.  There are some setup issues with .NET 3.5 SP1 when running on the Vista RTM release.  These issues will be fixed for the final .NET 3.5 SP1 release - until then please make sure to have Vista SP1 installed before trying to install .NET 3.5 SP1 beta."

I wasn't entirely sure I had SP1 installed.  It was RTM'd in Feb 08 and I have my Windows Update set to download automatically, but I hadn't seen it listed as available to install.  Start > type "WinVer" > Enter will being up the About dialog and give you that answer.  Version 6.0 (Build 6000) if you don't, Version 6.0 (Build 6001: Service Pack 1) if you do.  I didn't.  Pour quoi?

The full story can be found in this KB article - but the headlines are essentially:

  • Vista SP1 will only be offered in Windows Update if all the drivers you have installed are compatible.
    • If Windows Update is displaying optional drivers to install, select them and see if SP1 then appears.
  • There are a number of drivers that aren't compatible, if you have them - you won't see SP1.
    • The KB article lists them; check your manufactures website for an update.

For me; I needed to install an optional display driver via Windows Update and update my soundcard driver via my manufactures website.  SP1 then magically appeared in my Windows Update list.

LINQ to SQL Query Visualizer

by David 7/15/2008 9:25:00 PM

When you start looking at LINQ to SQL you'll no doubt be a little concerned as to what SQL is being generated for your queries - especially when it comes to debugging.  By default when you hit a breakpoint in your code and hover over your return value you'll see the SQL that was generated:

Cool - but when your queries get more than just a little complicated this ain't gonna cut it.  Luckily, if you installed the samples when you installed Visual Studio you'll have a Visualizer in your midst that can make life much easier.  Find the CSharpSample.zip file in C:\Program Files\Microsoft Visual Studio 9.0\Samples\1033\ and extract the LinqSamples\QueryVisualizer directory within it.  Follow the ReadMe.html contained within to get it setup.

Next time you hit a breakpoint and hover over your returned variable you'll get the visualizer magnifying glass, clicking it brings up a new dialog that not only shows the SQL that's been generated but also allows you to execute it - bonza!

 

Powered by BlogEngine.NET 1.3.0.0
Theme by Mads Kristensen