Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autocomplete Broken for Properties in .ThenInclude in EF Core 3.1 with Visual Studio 2019 #41527

Closed
ghost opened this issue Feb 9, 2020 · 6 comments
Labels
Area-IDE Bug Resolution-Fixed The bug has been fixed and/or the requested behavior has been implemented
Milestone

Comments

@ghost
Copy link

ghost commented Feb 9, 2020

There is a problem with the autocomplete feature in Visual Studio 2019 and EF Core 3.1: For example I have the following entity clases:

class Client {
     public List<ContactClient> Contacts { get; set; }
}

class ContactClient {
   public Contact Contact { get; set; }
}

Then autocomplete of cc.Contact fails in the following statement:

ctx.Clients.Include(c => c.Contacts).ThenInclude(cc => cc.Contact)

I have tested it and actually it has a very inconsistent behaviour. The first time you try to type Contact it doesn't show up. But after the first time that you type it manually and you delete it, it starts appearing in the autocompletion list.

I'm writing this new issue because I was told to do it in this original issue about the same problem that is already closed #8237

@gafter gafter added the Area-IDE label Feb 9, 2020
@dpoeschl
Copy link
Contributor

dpoeschl commented Feb 10, 2020

...very inconsistent behaviour. The first time you try to type Contacto it doesn't show up. But after the first time that you type it manually and you delete it, it starts appearing in the autocompletion list.

That's extraordinarily unexpected. I don't know what could even cause behavior like that.

I took your code and tried to make a full repro out of it, but I'm not seeing the problem. Do you see the failure with the below code?

using Microsoft.EntityFrameworkCore; // From NuGet package Microsoft.EntityFrameworkCore (3.1.1)
using System.Collections.Generic;
using System.Linq;

class C
{
    void M()
    {
        IQueryable<Cliente> clients = default;
        clients.Include(c => c.Contactos).ThenInclude(cc => cc.Contacto);
    }
}

class Cliente
{
    public List<ContactoCliente> Contactos { get; set; }
}

class ContactoCliente
{
    public Contacto Contacto { get; set; }
}

public class Contacto
{
}

@ghost
Copy link
Author

ghost commented Feb 10, 2020

Yes, I'm still experiencing the problem, I had to change a little your code to avoid C#8 null w

I type dot (.) , then 'cont' and nothing shows up. Then I type 'Contact' completely, it gets recognized by intellisense with the rectangle around it . I select something else so the autocomplete list disapears, then I delete the last 'o' and now 'Contact' shows up in the autocomplete-

@dpoeschl
Copy link
Contributor

dpoeschl commented Feb 10, 2020

Thank you for the details! I can also reproduce this using the latest official build (16.4.4). This is probably the same as this one, which was fixed by @ivanbasov as part of https://github.com/dotnet/roslyn/pull/39479, which says it will be available in 16.5 Preview 1.

I've tested in the latest public preview (16.5 Preview 2), and it appears to be fixed there. Feel free to give that preview a try and see if it resolves the issue for you as well.

@ghost
Copy link
Author

ghost commented Feb 10, 2020

Thank you for looking into it. Well, I prefer not to install Preview versions in my machine. The problem itself doesn't bother me too much, I was just trying to help. I'm glad it has been already fixed for future versions.

@dpoeschl
Copy link
Contributor

Okay, no worries. Thank you for the detailed report! We really appreciate it. Can't wait for it to make it into the official release for you. :)

@dpoeschl dpoeschl added Bug Resolution-Fixed The bug has been fixed and/or the requested behavior has been implemented labels Feb 10, 2020
@dpoeschl dpoeschl added this to the 16.5.P1 milestone Feb 10, 2020
@dpoeschl
Copy link
Contributor

@DavidRill No worries at all, I want to make sure we do whatever's needed. I believe I've removed the old @ references. Does that part look good? Does anything else need altered (e.g. code snippets)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE Bug Resolution-Fixed The bug has been fixed and/or the requested behavior has been implemented
Projects
None yet
Development

No branches or pull requests

2 participants