Browse by Tags

Tagged Content List
  • Blog Post: Static analysis of "is"

    Before I get into the subject of today's fabulous adventure, I want to congratulate the whole rest of Developer Division on the tremendously exciting product that we are formally launching today . (I've done very little actual coding on Visual Studio 2012 and C# 5.0, being busy with the long-lead Roslyn...
  • Blog Post: Should C# warn on null dereference?

    As you probably know, the C# compiler does flow analysis on constants for the purposes of finding unreachable code. In this method the statement with the calls is known to be unreachable, and the compiler warns about it. const object x = null; void Foo() { if (x != null) { Console.WriteLine(x.GetHashCode...
  • Blog Post: Danger, Will Robinson!

    As long-time readers of this blog know, I am often asked why a particular hunk of bad-smelling code does not produce a compiler warning. "Why not?" questions are inherently hard to answer because they turn causation on its head; normally we ask what caused a particular thing to happen, not what caused...
  • Blog Post: Bit twiddling: What does warning CS0675 mean?

    From the sublime level of continuation passing style we go back to the mundane level of twiddling individual bits. int i = SomeBagOfBits(); ulong u = SomeOtherBagOfBits(); ulong result = u | i; // combine them together Whoops, that's an error. "Operator | cannot be applied to operands of type int and...
  • Blog Post: Why are unused using directives not a warning?

    As I’ve discussed before, we try to reserve warnings for only those situations where we can say with almost certainty that the code is broken, misleading or useless. One reason for trying to ensure that warnings are not “false positives” is that we don’t ever want to encourage someone to take working...
  • Blog Post: Should we produce warnings for unused/uninitialized internal fields?

    You may have noticed as you've been developing C# applications that if you have an internal field of an internal type which you never use, we give you a warning about it. In fact, there are a number of warnings that we give for such fields, depending upon whether the field was never read or written,...
  • Blog Post: Write-only variables considered harmful? Or beneficial?

    I haven't forgotten that I promised to describe one more place where we insert an explicit conversion automatically. But before that, a quick digression. Reader Phil Haack has written some good tips for writing clear code and quotes an old post of mine . However I thought that I would talk a bit about...
Page 1 of 1 (7 items)