dotnet / dotnet/roslyn

Override completion broken for Razor documents with code behind

Open
#77,976 1 comment 0 reactions 1 assignee Claimed by @CyrusNajmabadi View on GitHub
Area-IDE
Dominant language
C#
Stars
20.7k
Forks
4.3k
PR merge metrics
PR metrics pending

Description

**Version Used**: Version 17.14.0 Preview 2.0

**Steps to Reproduce**:

1. Create a new Blazor Web App
2. Open Counter.razor
3. Navigate to the `@code` block and run `Extract to code behind`
4. Go back to Counter.razor
5. Add an empty `@code { }` block.
6. Inside the block, type `override ` so override completion comes up
7. Observe yellow bar

Stack trace:
```
System.InvalidOperationException : Unexpected null - file AbstractMemberInsertingCompletionProvider.cs line 162
at Microsoft.CodeAnalysis.Contract.Fail(String message,Int32 lineNumber,String filePath)
at Microsoft.CodeAnalysis.Contract.ThrowIfNull[T](Nullable`1 value,Int32 lineNumber,String filePath)
at Microsoft.CodeAnalysis.Completion.Providers.AbstractMemberInsertingCompletionProvider.ComputeDestinationSpan(SyntaxNode insertionRoot)
at async Microsoft.CodeAnalysis.Completion.Providers.AbstractMemberInsertingCompletionProvider.RemoveDestinationNodeAsync()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at async Microsoft.CodeAnalysis.Completion.Providers.AbstractMemberInsertingCompletionProvider.DetermineNewDocumentAsync()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at async Microsoft.CodeAnalysis.Completion.Providers.AbstractMemberInsertingCompletionProvider.GetChangeAsync()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at async Microsoft.CodeAnalysis.Extensions.IExtensionManagerExtensions.PerformFunctionAsync[T]()
```

From a quick debug it seems like its trying to generated the override method into the code behind file. Perhaps fall out from https://github.com/dotnet/roslyn/pull/76821

/cc @CyrusNajmabadi @arunchndr @phil-allen-msft as this is probably 17.14 worthy

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.