Fix #1684 - CompletionProvider null ref
The CompletionProvider will be called in cases where the document doesn't have a FilePath - such as the C# interactive window. This is causing a null ref.
This commit is contained in:
parent
7cca8618ea
commit
e05faf2347
|
|
@ -77,7 +77,9 @@ namespace Microsoft.VisualStudio.LanguageServices.Razor.Editor
|
|||
throw new ArgumentNullException(nameof(context));
|
||||
}
|
||||
|
||||
if (!context.Document.FilePath.EndsWith(".cshtml", StringComparison.OrdinalIgnoreCase))
|
||||
// FilePath will be null when the editor is open for cases where we don't have a file on disk (C# interactive window and others).
|
||||
if (context.Document?.FilePath == null ||
|
||||
!context.Document.FilePath.EndsWith(".cshtml", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
// Not a Razor file.
|
||||
return Task.CompletedTask;
|
||||
|
|
|
|||
Loading…
Reference in New Issue