File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
src/Compilers/CSharp/Test/Syntax/Parsing Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -11132,5 +11132,28 @@ public void Class_IncompleteArgumentList_06(bool @struct)
1113211132 }
1113311133 EOF ( ) ;
1113411134 }
11135+
11136+ [ Fact , WorkItem ( "https://github.com/dotnet/roslyn/issues/23877" ) ]
11137+ public void TestParseAttributeArgumentListWithInvalidString ( )
11138+ {
11139+ // Regression test for issue where ParseAttributeArgumentList would throw NullReferenceException
11140+ // when given an invalid string without parentheses
11141+ var result = SyntaxFactory . ParseAttributeArgumentList ( "somethingWithoutBrackets" ) ;
11142+
11143+ Assert . NotNull ( result ) ;
11144+ result . GetDiagnostics ( ) . Verify (
11145+ // (1,1): error CS1073: Unexpected token 'somethingWithoutBrackets'
11146+ // somethingWithoutBrackets
11147+ Diagnostic ( ErrorCode . ERR_UnexpectedToken , "" ) . WithArguments ( "somethingWithoutBrackets" ) . WithLocation ( 1 , 1 ) ) ;
11148+
11149+ UsingNode ( result ) ;
11150+
11151+ M ( SyntaxKind . AttributeArgumentList ) ;
11152+ {
11153+ M ( SyntaxKind . OpenParenToken ) ;
11154+ M ( SyntaxKind . CloseParenToken ) ;
11155+ }
11156+ EOF ( ) ;
11157+ }
1113511158 }
1113611159}
You can’t perform that action at this time.
0 commit comments