This has to qualify as an obscure FxCop feature:
DoNotDeclareReadOnlyMutableReferenceTypes is a rule that checks for visible read-only fields that are mutable reference types (classes). A mutable type is a type whose instance data can be changed once it has been constructed.
A useful rule, but the rule can give false positives if FxCop isn’t aware that one of your classes is immutable. Fortunately, you can tell FxCop about this, but the approach is more than a little obscure.
To make DoNotDeclareReadOnlyMutableReferenceTypes aware of your immutable types, simply do the following:
Using a text editor, create a new text file called ImmutableTypes.txt and place this file alongside your FxCop project file, or within the FxCop installation folder.
Using a new line for each type, enter the fully-qualified name of each class you want to mark as immutable,
From the FxCop FAQ.
Comments
blog comments powered by Disqus