Tech Off Post

Single Post Permalink

View Thread: FxCop advise vs Release Mode Optimisations
  • DavidMKean

    There are a few rules in FxCop that are now redundant due to the optimizations now performed by both the C# compiler and JIT in with optimizations enabled.

    Code such as the following which is flagged by DoNotInitializeUnnecessarily:

    public class Foo
    {
        private int _Value = 0;
        private string _String = null;
    }

    Is now optimized out by both the C# compiler and JIT (if the language doesn't do it). This could be why you can see no discrenable difference between the unmodified version and the modified version.

    We will probably change this rule so that it no longer fires on .NET 2.0+.