Multiple Problems in Same Class?

Hi,

I have a rule where I want to return multiple Problems for the same class.

Adding new Problem instances to the Problem collection is allowed, however only ONE problem is ever reported.

For example, given the following rule:

public override ProblemCollection Check(Class c)

{

Problems.Add(new Problem(GetResolution("Problem 1")));

Problems.Add(new Problem(GetResolution("Problem 2")));

Problems.Add(new Problem(GetResolution("Problem 3")));

return Problems;

}

The output is only ever "Problem 1" for each class.

Is this a known issue

Thanks,

Duncan



Answer this question

Multiple Problems in Same Class?

  • QbProg

    Duncan,

    FxCop groups all problems with the same message id (Problem.Id property) under the one message.

    If you double-click the message in FxCop standalone, you will notice that all the problems are listed in the issues tab. To have them seen as distinct messages, simply assign a unique id to Problem.Id.

    For example, IdentifiersShouldBeSpelledCorrectly will set the Problem.Id property to the incorrectly spelled word, this way, the user will only see one message in the Active messages tab per misspelled word, even if it is misspelled more than once within a member name.

    Regards

    David



  • R.Tutus

    Thanks, that's everything sorted now.
  • Multiple Problems in Same Class?