question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

VS fails to show proper intellisense when using multiple ThenIncludes

See original GitHub issue

See this SO post.

I was trying another .Include(blah).ThenInclude(blah), and while intellisense worked for the first, the second only showed IEnumberable functions/methods which lead me to believe I had mistyped something or it wasn’t supported somehow.

For example…

var reg =  _context.Registrations
  .Where(r => r.User.UserName == userName)
  .Include(r => r.Activities).ThenInclude(a => a.Task)
  .Include(r => r.Activities).ThenInclude(a => a.Responses)
  .FirstOrDefault();

The second a in the second ThenInclude did not show this as being a valid property. Thanks to the contributor to my SO post I tried building and running it anyways and it worked fine. VS lead me astray! 😉 Is this the proper place to report this?

VS Info…

Microsoft Visual Studio Professional 2015 Version 14.0.24720.00 Update 1 Microsoft .NET Framework Version 4.6.01055 Installed Version: Professional

EF info (as per project.json & “References” tree control in VS)…

EntityFramework.Core (7.0.0-rc1-final)

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:2
  • Comments:14 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
smitpatelcommented, Nov 20, 2019

@powermetal63 - Please file an issue on roslyn repo.

0reactions
powermetal63commented, Nov 20, 2019

This issue has been resolved in upcoming release of VS 16.1

I’m with VS 16.3.9 and still see it.

The difference with the example from Roslyn issue is that there the collection overload is defined as

this IIncludableQueryable<TEntity, ICollection<TPreviousProperty>> source

while in EF Core it is

this IIncludableQueryable<TEntity, IEnumerable<TPreviousProperty>> source

So when the navigation property type is ICollection<T> (or some other enumerable derived interface), the Intellisense does not offer T members initially. If the navigation property type is IEnumerable<T>, it works.

Read more comments on GitHub >

github_iconTop Results From Across the Web

VS fails to show proper intellisense when using multiple ...
I was trying another .Include(blah).ThenInclude(blah), and while intellisense worked for the first, the second only showed IEnumberable ...
Read more >
EF Core Second level ThenInclude missworks
This is a known Intellisense issue with the ThenInclude overload for collection type navigation properties, tracked by the Completion ...
Read more >
Building a REST API in NET Core - Include & ThenInclude
This is the third series in a course with five series about building 2 Tier Web Applications. All previous series in this full...
Read more >
Eager Loading of Related Data - EF Core
You can drill down through relationships to include multiple levels of related data using the ThenInclude method. The following example loads ...
Read more >
Python testing in Visual Studio Code
After a test run, VS Code displays results directly in the editor as gutter decorations. Failed tests will also be highlighted in the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found