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
922 stars 118 forks source link

Bug generating generic event. #21

Closed ghost closed 7 years ago

ghost commented 7 years ago
    public event EventHandler<NotifyRelationChangedEventArgs<Guid>> RelationChanged;

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 Quoter.Parse(String sourceText, NodeKind nodeKind) at QuoterService.Controllers.QuoterController.Get(String sourceText, NodeKind nodeKind, Boolean openCurlyOnNewLine, Boolean closeCurlyOnNewLine, Boolean preserveOriginalWhitespace, Boolean keepRedundantApiCalls, Boolean avoidUsingStatic)

ghost commented 7 years ago

Actually, not a bug. I had the settings for a 'Statement' and this needs to be compiled as part of a file.

KirillOsenkov commented 7 years ago

It is actually still a bug. A NullReferenceException is always a bug, no matter what.

This one is in Roslyn though: https://github.com/dotnet/roslyn/issues/17458

Once they fix that you should be able to generate statement level for this code as well.