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

RC2: NullReferenceException in SA1606 #1937

Closed
qmfrederik opened this issue Dec 8, 2015 · 7 comments
Closed

RC2: NullReferenceException in SA1606 #1937

qmfrederik opened this issue Dec 8, 2015 · 7 comments
Assignees
Milestone

Comments

@qmfrederik
Copy link

After upgrading to RC2 from Beta15, I'm seeing the following exception occur frequently:

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

If there's anything I can do to capture & provide additional information, let me know

@pdelvo
Copy link
Member

pdelvo commented Dec 8, 2015

Hi!

Thanks for reporting this 🐛!
The analyzer that is crashing here is (relatively) complicated. In the error dialog there is a small arrow next to the exception. If you expand this visual studio will show the stack trace. You can copy & paste that.

Also some code that reproduces this problem would be great.

@qmfrederik
Copy link
Author

Here's the stack trace:

'System.ArgumentNullException: Value cannot be null.
Parameter name: s
   at System.IO.StringReader..ctor(String s)
   at System.Xml.Linq.XElement.Parse(String text, LoadOptions options)
   at StyleCop.Analyzers.DocumentationRules.ElementDocumentationSummaryBase.HandleDeclaration(SyntaxNodeAnalysisContext context, SyntaxNode node, Location[] locations)
   at StyleCop.Analyzers.DocumentationRules.ElementDocumentationSummaryBase.HandleFieldDeclaration(SyntaxNodeAnalysisContext context)
   at StyleCop.Analyzers.AnalyzerExtensions.<>c__DisplayClass8_0`1.<RegisterSyntaxNodeActionHonorExclusions>b__0(SyntaxNodeAnalysisContext c)
   at Microsoft.CodeAnalysis.Diagnostics.AnalyzerExecutor.<>c__DisplayClass38_1`1.<ExecuteSyntaxNodeAction>b__1()
   at Microsoft.CodeAnalysis.Diagnostics.AnalyzerExecutor.ExecuteAndCatchIfThrows_NoLock(DiagnosticAnalyzer analyzer, Action analyze)'.

Visual Studio doesn't indicate the path to a source file, and the projects are relatively large, so I can't easily provide you with a piece of code that reproduces this issue (yet).

Hope the stack trace helps!

@sharwell
Copy link
Member

sharwell commented Dec 9, 2015

Thanks for the additional information @qmfrederik. I'm believe this will be enough to reproduce and correct the issue, but I'll let you know if we run into trouble. 😄

I can say from a quick look at the code that this issue can only occur in cases where an <include> element appears in the documentation. Since this is relatively infrequent, I'm thinking we can address this for the next (post-1.0) release.

@sharwell sharwell added this to the Backlog milestone Dec 9, 2015
@qmfrederik
Copy link
Author

Hi @sharwell

Thanks for the feedback. Yes, this code uses <include> statements.

Since it's causing a crash, would you consider removing the support for <include> statements alltogether then?

@sharwell
Copy link
Member

sharwell commented Dec 9, 2015

@qmfrederik We're definitely going to get this fixed, and I expect it to be included in the "1.1.0 Beta 1" release, possibly even before 1.0.0 stable is released. The question was just whether or not to include it in 1.0 stable, which would require a new RC release and reset the 30-day clock counting down to the 1.0 release.

@sharwell sharwell modified the milestones: Backlog, 1.0.0 Dec 10, 2015
Noryoko added a commit to Noryoko/StyleCopAnalyzers that referenced this issue Dec 11, 2015
Noryoko added a commit to Noryoko/StyleCopAnalyzers that referenced this issue Dec 11, 2015
Noryoko added a commit to Noryoko/StyleCopAnalyzers that referenced this issue Dec 12, 2015
@AArnott
Copy link
Contributor

AArnott commented Dec 12, 2015

I'm seeing NREs thrown from lots of analyers in a new project I just installed it to. I'll be happy to verify the fix for this against that repro when it's ready.

@sharwell
Copy link
Member

@AArnott The handling for <include> elements was only added to SA1604, SA1606, and SA1615. If you are seeing the crashes only in those analyzers then it could be related. Otherwise you should probably file a new issue.

@sharwell sharwell modified the milestones: 1.0.0, 1.0.0 RC 3, 1.1.0 Beta 1 Dec 19, 2015
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

5 participants