dotnet / interactive

.NET Interactive combines the power of .NET with many other languages to create notebooks, REPLs, and embedded coding experiences. Share code, explore data, write, and learn across your apps in ways you couldn't before.
MIT License
2.8k stars 371 forks source link

C# - Autocompletion suggestion has immediate errors #3550

Open philipmat opened 1 month ago

philipmat commented 1 month ago

Describe the bug

in "csharp - C# Script" the auto-completions suggestions are causing immediate errors. For example, in the screenshots/code below, the variables are of type IPagedList<T> : IList<T>.

Auto-completion suggests Select<> as a method. Screenshot 2024-05-10 at 8 58 21 PM

Using that, completing the expression, and filling in the type yields errors:

'IPagedList' does not contain a definition for 'Select' and no accessible extension method 'Select' accepting a first argument of type 'IPagedList' could be found (are you missing a using directive or an assembly reference?)

Screenshot 2024-05-10 at 8 58 43 PM

Except it should because System.Linq is part of the usings, and the simpler/type-inferred Select() method works just fine.

Screenshot 2024-05-10 at 9 09 41 PM

Or rather: why is Autocomplete suggesting something that wouldn't work?

Please complete the following:

Which version of .NET Interactive are you using? (In a notebook, run the #!about magic command. ):

.NET Interactive © 2020 Microsoft Corporation Version: 1.0.522904+cdfa48b2ea1a27dfe0f545c42a34fd3ec7119074 Library version: 1.0.0-beta.24229.4+cdfa48b2ea1a27dfe0f545c42a34fd3ec7119074 Build date: 2024-05-03T08:36:36.1584577Z https://github.com/dotnet/interactive

Screenshots

If applicable, add screenshots to help explain your problem.