• October 2024
    M T W T F S S
     123456
    78910111213
    14151617181920
    21222324252627
    28293031  
  • Latest Posts

  • Latest Comments

  • Archives

Posts Tagged ‘Code Analysis’


Static Code Analysis with .NET Core 2.1

Headline: I prefer Microsoft.CodeAnalysis.FxCopAnalyzers over StyleCop.Analyzers. Why? Here are the two primary reasons: I can use rulesets I’ve used in the past I can share a ruleset across many projects for consistency Ok… 3. And there are tons of overly restrictive, or at the very least –very different, rules in StyleCop.Analyzeers. Conventions I’ll just refer […]

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”. […]