Debug assertion failure in MethodSymbol.AsMember when called from Binder.UnwrapCollectionExpressionIfNullable
Open
Area-Compilers
Bug
- Dominant language
- C#
- Stars
- 20.7k
- Forks
- 4.3k
- PR merge metrics
- PR metrics pending
Description
`MethodSymbol.AsMember` assumes that the `newOwner` is not an error symbol. This can fail (cause a debug assertion) for the following caller:
https://github.com/dotnet/roslyn/blob/3f00cca15312e35225295d6f6ec68f8498538f8c/src/Compilers/CSharp/Portable/Binder/ForEachLoopBinder.cs#L711
It seems like it should be sufficient to modify the following condition to also not take any action when `collectionExprType` is an error type:
https://github.com/dotnet/roslyn/blob/3f00cca15312e35225295d6f6ec68f8498538f8c/src/Compilers/CSharp/Portable/Binder/ForEachLoopBinder.cs#L704
Contributor guide
Assessment
This issue has not been assessed yet.