Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Several documentation-related checks throw an exception when a field's XML documentation includes other XML documentation #2972

Closed
peteroupc opened this issue Jun 22, 2019 · 1 comment

Comments

@peteroupc
Copy link

peteroupc commented Jun 22, 2019

Currently, when a field contains XML documentation that includes other XML documentation, the analyzer throws several exceptions as follows:

Via msbuild:

  CSC : warning AD0001: Analyzer 'StyleCop.Analyzers.DocumentationRules.SA*' threw an exception of type 'System.ArgumentNullException' with message 'Value cannot be null. [Project.csproj]

Via CSC:

warning AD0001: Analyzer 'StyleCop.Analyzers.DocumentationRules.SA*' threw an exception of type 'System.ArgumentNullException' with message 'Value cannot be null.
Parameter name: s'

(The '*' above is 1625, 1629, 1616, 1612, and other checks relating to XML documentation.) The message doesn't include a stack trace, which made it very hard to investigate the cause of the exception.

Note that this issue applies only to fields, not to methods, constructors, types, or properties, which are generally handled by the analyzer without throwing an exception.

Here is a class which exhibits this issue.

namespace MyNamespace {
  public class MyClass {
    /// <include file='docs.xml'
    /// path='docs/doc[@name="F:MyNamespace.MyClass.Field"]/*'/>
    public const int Field = 0;
  }
}

Note that the include file references a file called docs.xml, which is as follows for the purposes of this report:

<docs><doc name="F:MyNamespace.MyClass.Field">
<summary>A field summary.</summary></doc></docs>
@bjornhellander
Copy link
Contributor

@sharwell: I am unable to reproduce this with versions after 1.2.0-beta.333, which includes the fix for #3150. I suggest closing this as already fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants