提交 c833a5bb 编写于 作者: J Jonathon Marolf

Merge pull request #6343 from jmarolf/VBSpellCrash

Fix VB Spellchecker Crash
Fixes #6338
......@@ -467,6 +467,13 @@ NewLines("Class AwesomeClass \n Sub M() \n Dim foo = New AwesomeClass() \n End S
index:=0)
End Sub
<WorkItem(6338, "https://github.com/dotnet/roslyn/issues/6338")>
<WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsAddImport)>
Public Sub TestMissingName()
TestMissing(
NewLines("<Assembly: Microsoft.CodeAnalysis.[||]>"))
End Sub
Public Class AddImportTestsWithAddImportDiagnosticProvider
Inherits AbstractVisualBasicDiagnosticProviderBasedUserDiagnosticTest
......
......@@ -37,7 +37,7 @@ public override async Task RegisterCodeFixesAsync(CodeFixContext context)
// Only bother with identifiers that are at least 3 characters long.
// We don't want to be too noisy as you're just starting to type something.
var nameText = name.GetFirstToken().ValueText;
if (nameText.Length >= 3)
if (nameText?.Length >= 3)
{
semanticModel = semanticModel ?? await document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(false);
var symbolInfo = semanticModel.GetSymbolInfo(name, cancellationToken);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册