File tree Expand file tree Collapse file tree
StyleCop.Analyzers.Test/DocumentationRules
StyleCop.Analyzers/Helpers Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -244,6 +244,43 @@ public class ClassName
244244 await this . VerifyCSharpFixAsync ( testCode , fixedCode , cancellationToken : CancellationToken . None ) . ConfigureAwait ( false ) ;
245245 }
246246
247+ /// <summary>
248+ /// Regression test for DotNetAnalyzers/StyleCopAnalyzers#1942.
249+ /// </summary>
250+ /// <returns>A <see cref="Task"/> representing the asynchronous unit test.</returns>
251+ [ Fact ]
252+ public async Task TestPropertyWithEmptySummaryAsync ( )
253+ {
254+ var testCode = @"
255+ public class ClassName
256+ {
257+ /// <summary>
258+ /// </summary>
259+ public int Property
260+ {
261+ get;
262+ }
263+ }" ;
264+
265+ var fixedCode = @"
266+ public class ClassName
267+ {
268+ /// <summary>
269+ /// </summary>
270+ /// <value>
271+ ///
272+ /// </value>
273+ public int Property
274+ {
275+ get;
276+ }
277+ }" ;
278+
279+ DiagnosticResult expected = this . CSharpDiagnostic ( ) . WithLocation ( 6 , 16 ) ;
280+ await this . VerifyCSharpDiagnosticAsync ( testCode , expected , CancellationToken . None ) . ConfigureAwait ( false ) ;
281+ await this . VerifyCSharpFixAsync ( testCode , fixedCode , cancellationToken : CancellationToken . None ) . ConfigureAwait ( false ) ;
282+ }
283+
247284 protected override IEnumerable < DiagnosticAnalyzer > GetCSharpDiagnosticAnalyzers ( )
248285 {
249286 yield return new SA1609PropertyDocumentationMustHaveValue ( ) ;
Original file line number Diff line number Diff line change @@ -152,6 +152,11 @@ public static SyntaxList<XmlNodeSyntax> WithoutFirstAndLastNewlines(this SyntaxL
152152
153153 for ( int i = 0 ; i < removeFromEnd ; i ++ )
154154 {
155+ if ( ! lastSyntaxTokens . Any ( ) )
156+ {
157+ break ;
158+ }
159+
155160 lastSyntaxTokens = lastSyntaxTokens . RemoveAt ( lastSyntaxTokens . Count - 1 ) ;
156161 }
157162
You can’t perform that action at this time.
0 commit comments