Skip to content

c# SyntaxFactory.ParseAttributeArgumentList throws NullReferenceException with invalid string #23877

@AdmiralSnyder

Description

@AdmiralSnyder

Version Used:
typeof(SyntaxFactory).Assembly.ImageRuntimeVersion = v4.0.30319

Steps to Reproduce:
in c# interactive:

  1. #r "Microsoft.CodeAnalysis.CSharp.dll"
  2. using Microsoft.CodeAnalysis.CSharp;
  3. SyntaxFactory.ParseAttributeArgumentList("somethingWithoutBrackets")
  4. Then this exception is being thrown:
    Object reference not set to an instance of an object.
  • Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.SyntaxParser.AddError(TNode, Microsoft.CodeAnalysis.CSharp.ErrorCode, object[])
  • Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LanguageParser.ConsumeUnexpectedTokens(TNode)
  • Microsoft.CodeAnalysis.CSharp.SyntaxFactory.ParseAttributeArgumentList(string, int, Microsoft.CodeAnalysis.ParseOptions, bool)

Expected Behavior:
some kind of ParseException, e.g. UnexpectedTokenException
Actual Behavior:
NullReferenceException with stacktrace.

Metadata

Metadata

Assignees

Labels

Area-InteractiveConcept-APIThis issue involves adding, removing, clarification, or modification of an API.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions