Print Page | Close Window

Devforce SL Linq Query issue

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2009
Forum Discription: For .NET 3.5
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=1127
Printed Date: 22-Sep-2025 at 4:11pm


Topic: Devforce SL Linq Query issue
Posted By: amit007
Subject: Devforce SL Linq Query issue
Date Posted: 10-Mar-2009 at 12:51pm
Does anyone know why i can't run LINQ query on DevForce SL Doman model in my silverlight app?
 
The below query works fine; however it doesn't seems to work when i use LINQ sysntax to query the collection.
manager.ExecuteQueryAsync(manager.Resources, OnQueryComplete, null);
 
Here is the error message i get while trying to execute the LINQ query
"Expression of type 'IdeaBlade.EntityModel.v4.EntityGroupProxy`1[ProModel.Eps.ObjectModel.Devforce.Resource]' cannot be used for parameter of type 'System.Linq.IQueryable`1[ProModel.Eps.ObjectModel.Devforce.Resource]' of method 'System.Linq.IQueryable`1[ProModel.Eps.ObjectModel.Devforce.Resource] Where[Resource](System.Linq.IQueryable`1[ProModel.Eps.ObjectModel.Devforce.Resource], System.Linq.Expr
 
EntityQuery<Resource> q = manager.Resources.Where(r => r.Name.StartsWith("D")).With(QueryStrategy.Normal);manager.ExecuteQueryAsync(manager.Resources, OnQueryComplete, null);
 
 



Replies:
Posted By: smi-mark
Date Posted: 10-Mar-2009 at 5:11pm
try changing
manager
.ExecuteQueryAsync(manager.Resources, OnQueryComplete, null);
to
manager.ExecuteQueryAsync(q, OnQueryComplete, null);


Posted By: DapperDanH
Date Posted: 10-Mar-2009 at 7:52pm

We have tried manager.ExecuteQueryAsync(q, OnQueryComplete, null);  as well.

In fact, we tried running SilverlightPIAppWeb in Program Files\Ideablade DevForce EF\Learning Units\300 Advanced\Property Interceptors in Silverlight\03 Code Samples\CS\SilverlightWithPropertyInterceptors\SilverlightPIApp

 

Received the same error when running any of the queries that use LINQ:

 

Expression of type 'IdeaBlade.EntityModel.v4.EntityGroupProxy`1[DomainModel.Customer]' cannot be used for parameter of type 'System.Linq.IQueryable`1[DomainModel.Customer]' of method 'System.Linq.IQueryable`1[DomainModel.Customer] Where[Customer](System.Linq.IQueryable`1[DomainModel.Customer], System.Linq.Expressions.Expression`1[System.Func`2[DomainModel.Customer,System.Boolean]])'

 

-ProModel



Posted By: amit007
Date Posted: 11-Mar-2009 at 6:46am
I had tried that, but that won't work either.  I forgot to change the line prior to posting on the forum.
 
manager.ExecuteQueryAsync(manager.Resources, OnQueryComplete, null);
manager.ExecuteQueryAsync(q, OnQueryComplete, null);


Posted By: DapperDanH
Date Posted: 11-Mar-2009 at 7:39am
We have identified the issue i think.  Machines that had a prior version of DevForceEF will not allow LINQ queries to be executed. 
 
On machines that have never had DevForceEF installed prior to installed DevForceSL 4.3.0.1, LINQ queries work fine.
 
Prior to installing DevForceSL 4.3.0.1, we had installed DevForceEF 4.2.2.  We uninstalled DevForceEF 4.2.2 prior to installing DevForceSL 4.3.0.1. 
 
So, somewhere, perhaps the GAC, perhaps there are some leftover 4.2.2 assemblies?  How can clean up our machine?  Any advice?
 
Thanks,
Dan
 
 


Posted By: DapperDanH
Date Posted: 11-Mar-2009 at 2:01pm

I thought i would summarize:

 
The error we get is:

Expression of type 'IdeaBlade.EntityModel.v4.EntityGroupProxy`1[DomainModel.Customer]' cannot be used for parameter of type 'System.Linq.IQueryable`1[DomainModel.Customer]' of method 'System.Linq.IQueryable`1[DomainModel.Customer] Where[Customer](System.Linq.IQueryable`1[DomainModel.Customer], System.Linq.Expressions.Expression`1[System.Func`2[DomainModel.Customer,System.Boolean]])'

 
1.  We no longer feel the issue is related having a previous version of DevForceEF installed.
2.  All machines can run a DevForceEF LINQ query when not using Silverlight.
3.  SL query with LINQ against the entity manager cache works just fine.
4.  3 out of 10 ProModel machines can’t run Silverlight with LINQ that makes calls to the BOS.
We think it has something to do with how types are being communicated in the WCF layer.


Posted By: smi-mark
Date Posted: 11-Mar-2009 at 3:48pm
All machines have the latest silverlight version installed? There is no way the old build is still cached? I know in Firefox it doesn't seem to cache it but I have noticed IExplore does, so try completely cleaning your cache and see if it makes a difference...


Posted By: ken.nelson
Date Posted: 12-Mar-2009 at 6:19am
I'm running Silverlight version 2.0.40115.0 which appears to be the latest.  I just tried cleaning my IE cache, unfortunately that did not fix the issue.


Posted By: smi-mark
Date Posted: 12-Mar-2009 at 8:20am
Hmm that's very strange. Does the debuglog.xml on the BOS side show anything else? If anything, it should have a detailed stack trace. I do not believe any SL assemblies will be put into the GAC, the normal assemblies do but if this was a problem on your BOS side none of the clients would function.


Posted By: kimj
Date Posted: 12-Mar-2009 at 2:30pm
For anyone else who might run into this problem, the issue turned out to be that the Silverlight version of System.Core.dll was installed into the GAC.  Silverlight assemblies should not (must not) be installed in the GAC.  In this case both the Silverlight and standard .NET versions of System.Core were in the GAC, with very surprising and unpredictable results.


Posted By: pjj326
Date Posted: 13-Mar-2009 at 5:45am

Some details about why System.Core.dll for Silverlight was in the GAC:

Our development team had been trying to add SilverlightControlToolkit controls to the Toolbox in Visual Studio. Every time we would Choose Items on the toolbox and click the Silverlight Components tab, Visual Studio would crash. This led to the following forum post:
 
http://silverlight.net/forums/t/52119.aspx - http://silverlight.net/forums/t/52119.aspx
 
The post led us to register System.Core.dll, System.Windows.dll, and System.dll from C:\Program Files\Microsoft SDKs\Silverlight\2.0 to the GAC. This allowed us to browse and select Silverlight components to add to the Toolbox in Visual Studio. It solved our immediate problem, but clearly caused a conflict with System.Core.dll and created some strange errors. We will be removing the above assemblies from the GAC.


Posted By: kimj
Date Posted: 13-Mar-2009 at 9:38am

Maybe this will help with the toolkit issue:

http://www.carlosfemmer.com/post/2009/02/How-to-add-Silverlight-Toolkit-Controls-to-Visual-Studio-2008-and-Blend-ToolBox.aspx - http://www.carlosfemmer.com/post/2009/02/How-to-add-Silverlight-Toolkit-Controls-to-Visual-Studio-2008-and-Blend-ToolBox.aspx
 


Posted By: pjj326
Date Posted: 13-Mar-2009 at 10:31am

The issue occurs when we click on the Silverlight Components tab. If I were to follow the exact instructions from that link:

- Open Toolbox
- Choose Items
- Dialogue Opens
- Click Silverlight Components and wait
 
Visual Studio hangs and crashes. The following error gets put in the Application event log:
 
EventType clr20r3, P1 devenv.exe, P2 9.0.30729.1, P3 488f2b50, P4 microsoft.windows.design.silverlight, P5 3.5.0.0, P6 48febcc8, P7 3, P8 6, P9 exception, P10 NIL.
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp - http://go.microsoft.com/fwlink/events.asp .
 
In the article I referenced in the previous post adding system.core.dll, system.dll, and system.windows.dll for Silverlight to the GAC prevents Visual Studio from crashing. I can tell you that removing system.core.dll for silverlight fromt the GAC resolved the Devforce SL LINQ Query issue and I can also click on Silverlight Components when choosing items for the Toolbox. But that is with system.dll and system.windows.dll for Silverlight still in the GAC. If I were to test this more, I would bet that system.windows.dll in the GAC is resolving the Visual Studio issue. I've also verified that another 3rd party component vendor has added their Silverlight assembly to the GAC. I guess I would ask the question: Are Silverlight assemblies ever supposed to be in the GAC? Are there still some issues with Silverlight and Visual Studio integration? I guess I'm not really looking for an answer... just some thoughts.



Print Page | Close Window