This easy linq query works in LinqPad 5, but not in EF Core. When I run this i get "System.NullReferenceException: Object reference not set to an instance of an object.". But on what ? I have checked the context and all contexts has data.
var query = "kost";
var specialtyPageIds =
(from pageSpecialty in Page_Specialties
join s in Specialties on pageSpecialty.SpecialtyId equals s.Id into ps
from s in ps.DefaultIfEmpty()
join cs in CustomSpecialties on pageSpecialty.CustomSpecialtyId equals cs.Id into pcs
from cs in pcs.DefaultIfEmpty()
where s.Name.Contains(query) || cs.Name.Contains(query)
select pageSpecialty).ToList();