Quantcast
Channel: .NET Framework Class Libraries forum
Viewing all articles
Browse latest Browse all 8156

VS2013 linq FirstOrDefault bug getting Index out of range

$
0
0

I'm attempting to join 2 dbsets (Transactions, Departments) as a way to filter for a specific entity (Transaction) such as:

var result = (from x in context.Transactions
                           from y in context.Departments
                           where x.Location == y.Location&& x.Location == Location &&
                           x.Department == y.DeptId &&
                           y.Org == OrgId &&
                           y.DeptInactiveDate == null &&
                           x.InactiveDate == null
                           select x).FirstOrDefault();

I've tested the SQL generated by this code and it returns the proper data (and I can see it executed successfully via the context in the output window), however;  FirstOrDefault() always triggers a System.ArgumentOutOfRangeException in mscorlib.dll specifically:

A first chance exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll

'w3wp.exe' (CLR v4.0.30319: /LM/W3SVC/1/ROOT/FS.GeneralLiability-1-130791215147908666): Loaded 'C:\windows\assembly\GAC_MSIL\Microsoft.VisualStudio.Debugger.Runtime\12.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Debugger.Runtime.dll'.

This code previously worked in VS2010 + EF4.1 but doesn't work in VS2013 + EF6


Viewing all articles
Browse latest Browse all 8156

Trending Articles