Jan Schreuder on .Net

.Net code samples, experiences, observations

View my professional profile on LinkedIn

Recent Posts

Tags

News

  • Inappropriate comments will be deleted at my discretion.

    The information and code samples in this weblog is provided "AS IS" without warranty of any kind, either expressed or implied, including but not limited to the merchantability and/or fitness for a particular purpose.

Community

Email Notifications

Tool suppliers

Tools

General

Microsoft

Favorite blogs

Archives


August 2008 - Posts

Thank you, Lutz Roeder

I just received an email from Lutz Roeder informing the users of Reflector that he decided to explore new opportunities. He has reached an agreement with RedGate software to continue work on Reflector. From his email:

I have reached an agreement to have Red Gate Software continue the development of .NET Reflector. Red Gate has a lot of experience creating development tools for both .NET and SQL Server. They have the resources necessary to work on new features, and Reflector fits nicely with other .NET tools the company offers.

Red Gate will continue to provide the free community version and is looking for your feedback and ideas for future versions.

For news and updates on Reflector, sign up for the .NET Developer’s Newsletter from Red Gate. To find out more about the agreement, see the interview on Simple Talk.

I really want to thank Lutz for all the great work he's done with Reflector, allowing us to explore the code inside .Net assemblies. He brought an excellent tool to our community and literally opened up .Net code for all to see

StyleCop - QuickStart tips

After using StyleCop for some weeks, there are some things I think that might be useful to others when they want to start using the tool. So here are some tips.

Tip 1 - Also download the documentation

The documentation for StyleCop is available as a separate download. It explains why the rules are introduced and how you can fix violations. Without this documentation, you may think some of the rules are useless or annoying.

Tip 2 - Do not run the tool on an entire solution

At least, not untill you're satisfied that your code complies with the rules. You get so many warnings in a project or solution where the tool hasn't been used before, that you may think to stop using it immediately.

Tip 3 - Running the tool on one class file

Could have been in tip 2 as well, but I wanted to make a distinction here. When you right-click in the code, you will see the item Run StyleCop. Select this, and the tool will only check that particular class file. The number of warnings is signicantly less than when you run the tool on an entire project or solution, so the results are more obvious and motivate you more to keep using the tool.

Tip 4 - Disable rules you really disagree to

Rules you really don't want to check can be disabled using the StyleCopSettingsEditor. How this can be done is explained in this blog post. I disabled a number of them. I also included a number of overrides to the check for hungarian notation. For example, I have boolean variable names like isValid and isCompliant. StyleCop used to warn me about using hungarian notation in these cases, whereas I'm not. You can add the 'is' part in the Hungarian tab of the StyleCopSettingsEditor and it will no longer warn you about this.

Tip 5 - Re-Align the source before you start

Select all the code using Ctrl-A, then press Ctrl-K followed by F. Visual Studio will re-align much of the code. This automatically eliminates a number of errors found by StyleCop.

 

Version 4.3 of Microsoft StyleCop available

A new version of StyleCop was made available only a few days ago, so I downloaded it and installed it. One thing I had to correct after installation was the Settings.SourceAnalysis file. Because of the name change to StyleCop, the extension of the settings file was also changed. But after that, I was back in business. One of the first things you notice is that the results are now shown as warnings in the standard errors and warnings list. And there are more changes:

  • A separate help file is available that explains the rules and shows how violations can be solved
  • A number of bug have been fixed
  • New rules, including a rule to check if Using directives are sorted, in line with the Visual Studio 2008 Organize Usings functionality

Another announcement on the StyleCop Teamblog suggested that they will be releasing SDK documentation to allow you to add your own rules to the tool. This is of course interesting if you have additional rules on top of the ones already available.

I've been using the tool for some weeks now and I really like the consistency in code style which is now slowly emerging in my projects. Where I thought I was using a consistent style in my own code, I was pointed out by StyleCop that in fact I wasn't. But that's all changing now.

You can download the new version of StyleCop here.

Sandcastle now on CodePlex

The Sandcastle project, Microsoft's tools to generate documentation from your well-documented code, is now available on CodePlex. That was already the case, but until about 2 month's ago, that was without the source code. You can now download Sandcastle including the source code from CodePlex.

You can find the related information about this decision here. And you can find the project in Codeplex here.