.NetCore 3.1 migration LINQ debugging using LINQPad
I am new to LINQ and LINQPad. When upgrading a .NetCore 2.2 Asp.NetCore 2.2 application to .NetCore 3.1, I now get the below exception. I do understand that .NetCore 3.x has LINQ breaking changes (https://docs.microsoft.com/en-us/ef/core/what-is-new/ef-core-3.x/breaking-changes). Is there a way to debug LINQ migration issues using LINQPad 6 (which supports .NetCore 3.1) My full application gives the below exception but when I test the LINQ query in LINQPad it simply returns no records (no errors are shown either), when connecting to the same data source. I don't see any equivalent SQL query shown in the SQL tab, either. I was hoping to test updated LINQ statements in LINQPad (for quicker turnaround), and once debugged, copy them to my full .NetCore project.
{"error":"The LINQ expression 'DbSet
.Join(\r\n outer: DbSet,
inner: a => a.ApplicationSettingTypeId,
outerKeySelector: a0 => a0.ApplicationSettingTypeId,
innerKeySelector: (a, a0) => new TransparentIdentifier<ApplicationSettings, ApplicationSettingsType>(
Outer = a,
Inner = a0
))
.Where(ti => ti.Outer.ApplicationObjectId == __objectID_0 && (int)ti.Inner.ObjectType == (int)__objectType_1 && ti.Outer.ApplicationSettingTypeId == __settingTypeIdFromEnum_2)' could not be translated. Either rewrite the query in a form that can be translated, or switch to client evaluation explicitly by inserting a call to either AsEnumerable(), AsAsyncEnumerable(), ToList(), or ToListAsync(). See https://go.microsoft.com/fwlink/?linkid=2101038 for more information."}
Comments
Version=5.0.0.0, Culture=neutral, PublicKeyToken=xxxxxxxxxxxxxxxx', which has a higher version than referenced assembly 'System.Linq.Expressions' with identity 'System.Linq.Expressions,
Version 4.2.2.20, Culture=neutral, PublicKeyToken=xxxxxxxxxxxxxxxx' . A test to the connection passes OK. Is there something else that I need to do in LINQPad if this error occurs?
Press F4 to view Query Properties / Additional References. Is there anything in that list?
Today when I started LinqPad 6, I was shown "(?) To fully support .Net Core, you need the reference assembly packages for .NetCore 3.1.17 and WindowsDesktop 3.1.17. Download now? [Yes] [No]". I clicked "Yes" and it downloaded (via Nuget manager). After restarting LINQPad 6 (x86), I can now get further. I get the following error at the top of the edit window when I try to run the "C# Statement(s)" query: "InvalidOperationException: The child/dependent side could not be determined for the one-to-one relationship between 'AspNetUsers.AspNetUsersEntity' and 'AspNetUsers.Child'. To identify the child/dependent side of the relationship, configure the foreign key property. If these navigations should not be part of the same relationship configure them without specifying the inverse. See http://go.microsoft.com/fwlink/?LinkId=724062 for more details." In the results window, I get "InvalidOperationException **** The child/dependent side could not be determined for he one-to-one relationship between 'AspNetUsers.AspNetUsersEntity' and 'AspNetUsers.Child' to i..." Pressing [F4] did not list anything in the Query Properties / Additional Resources tab. I'll continue to do more research. Thanks for replying to my questions.