KirillOsenkov / RoslynQuoter

Roslyn tool that for a given C# program shows syntax tree API calls to construct its syntax tree
http://roslynquoter.azurewebsites.net
Apache License 2.0
918 stars 118 forks source link

System.NullReferenceException on FieldDeclarationSyntax #31

Closed sievajetnamdar closed 7 years ago

sievajetnamdar commented 7 years ago

Statement:

private readonly string _leaseofferte = CarWise.Resources.GetString( "1" ); Stacktrace:

System.NullReferenceException: Object reference not set to an instance of an object.
   at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.SyntaxParser.AddError[TNode](TNode node, ErrorCode code, Object[] args)
   at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LanguageParser.ConsumeUnexpectedTokens[TNode](TNode node)
   at Microsoft.CodeAnalysis.CSharp.SyntaxFactory.ParseStatement(String text, Int32 offset, ParseOptions options, Boolean consumeFullText)
   at QuoterService.Controllers.QuoterController.Get(String sourceText, NodeKind nodeKind, Boolean openCurlyOnNewLine, Boolean closeCurlyOnNewLine, Boolean preserveOriginalWhitespace, Boolean keepRedundantApiCalls, Boolean avoidUsingStatic)
sievajetnamdar commented 7 years ago

This can be parsed as a 'File' though

KirillOsenkov commented 7 years ago

Thanks, it's a known Roslyn bug. I should update soon.

KirillOsenkov commented 7 years ago

Fixed.