Share via


CA0001

An exception was raised within managed code analysis tool that does not indicate an expected error condition.

This error is generated in the following cases:

  • A defect in a custom rule

    In this case, the error will report the rule and the target. A sample error looks similar to the following:

    Internal Error CA0001: Rule=Microsoft.Usage#CA2214, Target=B..ctor() : Object reference not set to an instance of an object.

    For more diagnostic information, view the CodeAnalysisReport.xml in the \obj folder. The report lists the exception type, stack, type, message, and stack of all inner exceptions. A sample CodeAnalysisReport.xml report for the previous exception looks similar to the following:

    <Exception Keyword="CA0001" Kind="Rule" TypeName="DoNotCallOverridableMethodsInConstructors" Category="Microsoft.Usage" CheckId="CA2214" Target="B..ctor()">
      <Type>System.NullReferenceException</Type>
      <ExceptionMessage>Object reference not set to an instance of an object.</ExceptionMessage>
      <StackTrace>   at Microsoft.FxCop.Rules.Usage.DoNotCallOverridableMethodsInConstructors.CheckCallees(Method method, Boolean isCallVirt) in d:\rules\DoNotCallOverridableMethodsInConstructors.cs:line 107 at Microsoft.FxCop.Rules.Usage.DoNotCallOverridableMethodsInConstructors.CheckCallees(Method method, Boolean isCallVirt) in d:\rules\DoNotCallOverridableMethodsInConstructors.cs:line 128 at Microsoft.FxCop.Rules.Usage.DoNotCallOverridableMethodsInConstructors.Check(Member member) in d:\rules\DoNotCallOverridableMethodsInConstructors.cs:line 58 at Microsoft.FxCop.Engines.Introspection.AnalysisVisitor.CheckMember(Member member, NodeBase target) in d:\Engines\Introspection\AnalysisVisitor.cs:line 743</StackTrace>
    </Exception>
    

    In the previous report, an exception occurred at line 107 of DoNotCallOverridableMethodsInConstructors.cs file. All other stack traces show the execution path that lead to the exception.

  • An unknown defect in the managed code analysis tool

    In this case, the error appears without the Rule, TypeName, or Category attributes in CodeAnalysisReport.xml, and the following message appears on the console:

    Internal Error CA0001: Object reference not set to an instance of an object.

    Try rewriting the line where the error is reported, or several lines of code surrounding that line. If that does not work, contact Microsoft Product Support Services.

See Also