ORMQueryConstructionException on new machine

Posts   
 
    
TomDog
User
Posts: 618
Joined: 25-Oct-2005
# Posted on: 15-Oct-2015 10:47:07   

This week I have my Windows 7 machine rebuilt and now some queries no longer work! Specifically generic filters such as the one mentioned in: https://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=22914

    public static IQueryable<T> FilterByDiscontinued<T>(this IQueryable<T> products, bool? discontinued) where T : class, IProduct
    {
      if (discontinued.HasValue)
        return discontinued.Value ? products.Where(r => r.Discontinued) : products.Where(r => r.Discontinued);
      return products;
    }

now give the same ORMQueryConstructionException,The binary expression '(Convert(Entity(ProductEntity)).Discontinued == True)' can't be converted to a predicate expression, as in that thread even if the class filter is ON in the method as shown. See the above thread for the stack trace. But the same filter works fine on every other machine.

My first guess is that it is because I installed VS2015 and hence .NET4.6 on it before VS2013.

Any ideas?

LLBL Version:4.2.15.1006 .NET info

<32Bit>
2.0.50727.5485
  ->C:\Windows\Microsoft.NET\Framework\v2.0.50727
4.6.100.0
  ->C:\Windows\Microsoft.NET\Framework\v4.0.30319

<64Bit>
2.0.50727.5485
  ->C:\Windows\Microsoft.NET\Framework64\v2.0.50727
4.6.100.0
  ->C:\Windows\Microsoft.NET\Framework64\v4.0.30319

< Installed .NET Frameworks >
.NET FW 2.0 SP 2  (CLR:2.0)
.NET FW 3.0 SP 2  (CLR:2.0)
.NET FW 3.5 SP 1  (CLR:2.0)
.NET FW 4.6  (CLR:4.0)

< Installed Updates >
Microsoft .NET Framework 4 Client Profile 
 KB2468871
 KB2468871v2
 KB2478063
 KB2533523
 KB2544514
 KB2600211
 KB2600217
Microsoft .NET Framework 4 Extended 
 KB2468871
 KB2468871v2
 KB2478063
 KB2533523
 KB2544514
 KB2600211
 KB2600217
 KB2468871
 KB2468871v2
 KB2478063
 KB2533523
 KB2544514
 KB2600211
 KB2600217
Microsoft .NET Framework 4 Multi-Targeting Pack 
 KB2504637 Update for  (KB2504637)
Microsoft .NET Framework 4.5 
 KB2729460
 KB2737083
 KB2742613
 KB2745582
 KB2748645
 KB2750147
 KB2756203
 KB2759112
 KB2783808
 KB2789648
 KB2794055
 KB2803754
 KB2804582
 KB2805221
 KB2805226
 KB2805290
 KB2822218
 KB2823493
 KB2828841
 KB2835622
 KB2858725
 KB2861193
 KB2861208
 KB2862063
 KB2872778
 KB2885201
 KB2889889
 KB2894849
 KB2894854
 KB2898864
 KB2898869
 KB2901118
 KB2901126
 KB2901983
 KB2908383
 KB2925382
 KB2931368
 KB2936388
 KB2937676
 KB2938782
 KB2954853
 KB2969355
 KB3006566
 KB3033093
 KB3045561
Microsoft .NET Framework 4.5.1 
 KB2898869 Security Update for Microsoft .NET Framework 4.5.1 (KB2898869)
 KB2901126 Security Update for Microsoft .NET Framework 4.5.1 (KB2901126)
 KB2898869 Security Update for Microsoft .NET Framework 4.5.1 (KB2898869)
 KB2901126 Security Update for Microsoft .NET Framework 4.5.1 (KB2901126)
Microsoft .NET Framework 4.6 
 KB3074233 Security Update for Microsoft .NET Framework 4.6 (KB3074233)
 KB3074554 Security Update for Microsoft .NET Framework 4.6 (KB3074554)
 KB3083186 Security Update for Microsoft .NET Framework 4.6 (KB3083186)

< Installed Languages 3.0>
English - United States
< Installed Languages 3.5.x>
English - United States
< Installed Languages 4.x>
English - United States

Jeremy Thomas
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39590
Joined: 17-Aug-2003
# Posted on: 15-Oct-2015 17:40:29   

On the v4.x development VMs we have 2015 installed as well as 2013, but installed it after 2013 of course.

I can't reproduce it. Works fine:


[Test]
public void AnyOnInterface2()
{
    using(var adapter = new DataAccessAdapter())
    {
        var metaData = new LinqMetaData(adapter);
        Assert.IsTrue(metaData.Product.FilterByDiscontinued2(true).Any());
    }
}

// ...
public static IQueryable<T> FilterByDiscontinued2<T>(this IQueryable<T> products, bool? discontinued)
    where T : class, IProduct
{
    if(discontinued.HasValue)
    {
        return discontinued.Value ? products.Where(r => r.Discontinued) : products.Where(r => r.Discontinued);
    }
    return products;
}


The test which uses the method without the class filter doesn't work. I ran this in 2013. Will now try in 2015.

(edit). In 2015, everything succeeds as well. So I have no idea what causes this. Could it be you're working with an outdated dll somehow?

Frans Bouma | Lead developer LLBLGen Pro
TomDog
User
Posts: 618
Joined: 25-Oct-2005
# Posted on: 16-Oct-2015 11:03:10   

I'm pretty sure what caused the problem was installing http://blogs.msdn.com/b/visualstudio/archive/2015/10/08/visual-studio-2015-update-1-ctp.aspx yesterday so I uninstalled it completely AND removed .NET 4.6 but to no avail. With nothing left to try I ended up repaving my machine for a second time this week.frowning None the wiser.

Jeremy Thomas
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39590
Joined: 17-Aug-2003
# Posted on: 16-Oct-2015 11:57:49   

Sorry to hear that disappointed Hopefully the second repave works out properly.

Frans Bouma | Lead developer LLBLGen Pro
TomDog
User
Posts: 618
Joined: 25-Oct-2005
# Posted on: 20-Oct-2015 12:03:11   

Otis wrote:

Sorry to hear that disappointed Hopefully the second repave works out properly.

Yeah all good, It's definitely visual-studio-2015-update-1-ctp that's doing it, I installed it on a Windows 10 machine - same result.

Don't know if you want to give it a go to see what the problem is.

Jeremy Thomas
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39590
Joined: 17-Aug-2003
# Posted on: 21-Oct-2015 10:24:23   

I never install Microsoft ctp's as it's in general a waste of time (buggy code, unfinished features) and no go-live license.

I checked what the changes were in the fix which made the error go away and it's nothing special, just a different GetFactory method is called (a generic one, instead of a non-generic one). I have no idea why this would fail with any CTP, other than that the CTP is buggy (which is no surprise).

Frans Bouma | Lead developer LLBLGen Pro
TomDog
User
Posts: 618
Joined: 25-Oct-2005
# Posted on: 12-Nov-2015 09:42:18   

Otis wrote:

I never install Microsoft ctp's as it's in general a waste of time (buggy code, unfinished features) and no go-live license.

I have no idea why this would fail with any CTP, other than that the CTP is buggy (which is no surprise).

VS 2015 update 1 RC fixed it, so I guess you were right, dodgy CTP.

Jeremy Thomas
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39590
Joined: 17-Aug-2003
# Posted on: 12-Nov-2015 12:05:29   

Thanks for the feedback!

Frans Bouma | Lead developer LLBLGen Pro