Roslyn: CSharpReplaceDocCommentTextWithTagCodeRefactoringProvider

Created on 17 Sep 2018  路  13Comments  路  Source: dotnet/roslyn

I was typing inside <summary> tags when the CSharpReplaceDocCommentTextWithTagCodeRefactoringProvider error was displayed. Do not have a repro.

 Roslyn error: Extension_Exception CSharpReplaceDocCommentTextWithTagCodeRefactoringProvider : Object reference not set to an instance of an object
  at Microsoft.CodeAnalysis.CSharp.Binder.BindBase (Microsoft.CodeAnalysis.CSharp.Syntax.BaseExpressionSyntax node, Microsoft.CodeAnalysis.DiagnosticBag diagnostics) [0x0004d] in /_/src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs:1850 
  at Microsoft.CodeAnalysis.CSharp.Binder.BindExpressionInternal (Microsoft.CodeAnalysis.CSharp.Syntax.ExpressionSyntax node, Microsoft.CodeAnalysis.DiagnosticBag diagnostics, System.Boolean invoked, System.Boolean indexed) [0x00307] in /_/src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs:382 
  at Microsoft.CodeAnalysis.CSharp.Binder.BindExpression (Microsoft.CodeAnalysis.CSharp.Syntax.ExpressionSyntax node, Microsoft.CodeAnalysis.DiagnosticBag diagnostics, System.Boolean invoked, System.Boolean indexed) [0x00000] in /_/src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs:329 
  at Microsoft.CodeAnalysis.CSharp.Binder.BindExpression (Microsoft.CodeAnalysis.CSharp.Syntax.ExpressionSyntax node, Microsoft.CodeAnalysis.DiagnosticBag diagnostics) [0x00000] in /_/src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs:324 
  at Microsoft.CodeAnalysis.CSharp.CSharpSemanticModel.GetSpeculativelyBoundExpressionHelper (Microsoft.CodeAnalysis.CSharp.Binder binder, Microsoft.CodeAnalysis.CSharp.Syntax.ExpressionSyntax expression, Microsoft.CodeAnalysis.SpeculativeBindingOption bindingOption, Microsoft.CodeAnalysis.DiagnosticBag diagnostics) [0x00021] in /_/src/Compilers/CSharp/Portable/Compilation/CSharpSemanticModel.cs:249 
  at Microsoft.CodeAnalysis.CSharp.CSharpSemanticModel.GetSpeculativelyBoundExpression (System.Int32 position, Microsoft.CodeAnalysis.CSharp.Syntax.ExpressionSyntax expression, Microsoft.CodeAnalysis.SpeculativeBindingOption bindingOption, Microsoft.CodeAnalysis.CSharp.Binder& binder, System.Collections.Immutable.ImmutableArray`1[Microsoft.CodeAnalysis.CSharp.Symbol]& crefSymbols) [0x000f0] in /_/src/Compilers/CSharp/Portable/Compilation/CSharpSemanticModel.cs:306 
  at Microsoft.CodeAnalysis.CSharp.CSharpSemanticModel.GetSpeculativeSymbolInfo (System.Int32 position, Microsoft.CodeAnalysis.CSharp.Syntax.ExpressionSyntax expression, Microsoft.CodeAnalysis.SpeculativeBindingOption bindingOption) [0x00010] in /_/src/Compilers/CSharp/Portable/Compilation/CSharpSemanticModel.cs:687 
  at Microsoft.CodeAnalysis.CSharp.CSharpSemanticModel.GetSpeculativeSymbolInfoCore (System.Int32 position, Microsoft.CodeAnalysis.SyntaxNode node, Microsoft.CodeAnalysis.SpeculativeBindingOption bindingOption) [0x00033] in /_/src/Compilers/CSharp/Portable/Compilation/CSharpSemanticModel.cs:4595 
  at Microsoft.CodeAnalysis.SemanticModel.GetSpeculativeSymbolInfo (System.Int32 position, Microsoft.CodeAnalysis.SyntaxNode expression, Microsoft.CodeAnalysis.SpeculativeBindingOption bindingOption) [0x00000] in /_/src/Compilers/Core/Portable/Compilation/SemanticModel.cs:139 
  at Microsoft.CodeAnalysis.ModelExtensions.GetSpeculativeSymbolInfo (Microsoft.CodeAnalysis.SemanticModel semanticModel, System.Int32 position, Microsoft.CodeAnalysis.SyntaxNode expression, Microsoft.CodeAnalysis.SpeculativeBindingOption bindingOption) [0x00000] in /_/src/Compilers/Core/Portable/Compilation/Extensions.cs:48 
  at Microsoft.CodeAnalysis.ReplaceDocCommentTextWithTag.AbstractReplaceDocCommentTextWithTagCodeRefactoringProvider.TryRegisterSeeCrefTagIfSymbol (Microsoft.CodeAnalysis.CodeRefactorings.CodeRefactoringContext context, Microsoft.CodeAnalysis.SemanticModel semanticModel, Microsoft.CodeAnalysis.SyntaxToken token, Microsoft.CodeAnalysis.Text.TextSpan replacementSpan, System.Threading.CancellationToken cancellationToken) [0x0001d] in /_/src/Features/Core/Portable/ReplaceDocCommentTextWithTag/AbstractReplaceDocCommentTextWithTagCodeRefactoringProvider.cs:129 
  at Microsoft.CodeAnalysis.ReplaceDocCommentTextWithTag.AbstractReplaceDocCommentTextWithTagCodeRefactoringProvider+<ComputeRefactoringsAsync>d__4.MoveNext () [0x0043d] in /_/src/Features/Core/Portable/ReplaceDocCommentTextWithTag/AbstractReplaceDocCommentTextWithTagCodeRefactoringProvider.cs:118 
--- End of stack trace from previous location where exception was thrown ---
  at Microsoft.CodeAnalysis.CodeRefactorings.CodeRefactoringService+<GetRefactoringFromProviderAsync>d__8.MoveNext () [0x000a0] in /_/src/Features/Core/Portable/CodeRefactorings/CodeRefactoringService.cs:143 

See https://github.com/mono/monodevelop/issues/5972

[jcouv update:] Also tracked by https://devdiv.visualstudio.com/DevDiv/_workitems/edit/902391

Area-Compilers Bug Developer Community

Most helpful comment

@StingyJack Thanks. The DC links show this issue occurring in 15.8, 15.9, 16.0 and 16.1.

I just tested with 15.9.9p1 and was able to repro:

  1. Type an xml doc <summary> comment on a method
  2. Type base inside the xml tag
  3. Gold bar appears

The issue still reproes on 16.2p2.

All 13 comments

also reported here

I just had the same problem occur for a second time. Its annoying but not blocking.

@jinujoseph - please dont close devcomm items in a way that prevents the OP from even commenting. Not only is it frustrating for the OP, but I've now opened a second devcomm issue for this because I cant comment on the first one to report a second occurrence..

@StingyJack sorry for the inconvenience but the idea is to followup on the bug that has been referred there so right team get to hear your concern.

@StingyJack do you have a repro for this? We've looked at the code involved and it's not easy to see how we could null reference here. A repro would help us track this down (probably fairly easy to fix once we know what the issue is).

@jaredpar - Here is the second issue I posted recently. @jinujoseph linked the first report above.

There isnt a consistent repro. I do seem to have lots of editor related problems. Some with the conventional editor (goes "not responding") and some with the merge and compare windows (page up/down causes VS to error, text in one of the panes jumps when typing), I've logged a bunch issue reports for those along with mem dumps, perhaps there is something useful there if not in the issues linked above.

also reported at DC

also reported at DC

also reported at DC

@mkrueger @StingyJack I looked at the code to find potential sources of NullRefException and played around in the IDE to try and repro. So far, I didn't have any luck :-(

Might you be able to provide some more hints?

  • can you confirm the version of VS where you're seeing this issue? (I tried on 16.2p1)
  • was the xml tag being edited on a type, a method, ...?
  • when this happens the next time, can you copy and share the text of the xml tag you ended up typing?

@jcouv - you will have to get the diag stuffs from the devcomm issue attachments. This was reported long back - definitely not on 16.x.

@StingyJack Thanks. The DC links show this issue occurring in 15.8, 15.9, 16.0 and 16.1.

I just tested with 15.9.9p1 and was able to repro:

  1. Type an xml doc <summary> comment on a method
  2. Type base inside the xml tag
  3. Gold bar appears

The issue still reproes on 16.2p2.

Found the problem:
image

Merged fix for 16.2p3. Thanks for reporting this!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vbcodec picture vbcodec  路  3Comments

MadsTorgersen picture MadsTorgersen  路  3Comments

AdamSpeight2008 picture AdamSpeight2008  路  3Comments

binki picture binki  路  3Comments

asvishnyakov picture asvishnyakov  路  3Comments