Tag: Code Analysis

  • How to Write Bad C# Code

    In case you’re afraid Microsoft might help you write some good C# code, here’s a list of the top tips to make sure you still write bad C# code. Now I’m sure that’s not the objective, but when you read this post you’ll frankly wonder why it is that we still see so much bad…

  • SmtpClient.Dispose() Bummer

    Headline: You will need to put in some try/catch logic when you call dispose on the SmtpClient. I was working on getting rid of some of my code analysis warnings – “Warning    10    CA2000 : Microsoft.Reliability : In method ‘AccountMembershipService.SendActivationEmail(HttpContextBase, string, Guid, string, string)’, object ‘client’ is not disposed along all exception paths. Call System.IDisposable.Dispose…

  • MVC – The Start

    Technorati Tags: ASP.NET,MVC,Code Analysis,Unit Testing This shows my initial setup of an MVC 2 RC 2 application. Using Visual Studio 2010 RC I selected File –> New –> Project… then under Visual C#, Web, I selected the ASP.NET MVC 2 Web Application. Then when I click OK I get the following dialog. Since I’m a…

  • EF and Code Analysis

    Headline: I sure wish that Code Analysis would recognize Entity Framework (EF) files as auto generated. This morning I was up early and thought I’d get rid of some of the warning in my code from Code Analysis… There is a tab in the project properties that allows you to “Suppress results from generated code”.…