New Posts New Posts RSS Feed: Devforce SL Linq Query issue
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Devforce SL Linq Query issue

 Post Reply Post Reply
Author
amit007 View Drop Down
Newbie
Newbie
Avatar

Joined: 10-Mar-2009
Posts: 10
Post Options Post Options   Quote amit007 Quote  Post ReplyReply Direct Link To This Post Topic: Devforce SL Linq Query issue
    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);
 
 
Back to Top
smi-mark View Drop Down
DevForce MVP
DevForce MVP
Avatar

Joined: 24-Feb-2009
Location: Dallas, Texas
Posts: 343
Post Options Post Options   Quote smi-mark Quote  Post ReplyReply Direct Link To This Post Posted: 10-Mar-2009 at 5:11pm
try changing
manager
.ExecuteQueryAsync(manager.Resources, OnQueryComplete, null);
to
manager.ExecuteQueryAsync(q, OnQueryComplete, null);
Back to Top
DapperDanH View Drop Down
Newbie
Newbie
Avatar

Joined: 24-Apr-2008
Location: United States
Posts: 10
Post Options Post Options   Quote DapperDanH Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
amit007 View Drop Down
Newbie
Newbie
Avatar

Joined: 10-Mar-2009
Posts: 10
Post Options Post Options   Quote amit007 Quote  Post ReplyReply Direct Link To This Post 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);
Back to Top
DapperDanH View Drop Down
Newbie
Newbie
Avatar

Joined: 24-Apr-2008
Location: United States
Posts: 10
Post Options Post Options   Quote DapperDanH Quote  Post ReplyReply Direct Link To This Post 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
 
 
Back to Top
DapperDanH View Drop Down
Newbie
Newbie
Avatar

Joined: 24-Apr-2008
Location: United States
Posts: 10
Post Options Post Options   Quote DapperDanH Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
smi-mark View Drop Down
DevForce MVP
DevForce MVP
Avatar

Joined: 24-Feb-2009
Location: Dallas, Texas
Posts: 343
Post Options Post Options   Quote smi-mark Quote  Post ReplyReply Direct Link To This Post 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...
Back to Top
ken.nelson View Drop Down
Groupie
Groupie


Joined: 03-Mar-2009
Location: Ann Arbor, MI
Posts: 54
Post Options Post Options   Quote ken.nelson Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
smi-mark View Drop Down
DevForce MVP
DevForce MVP
Avatar

Joined: 24-Feb-2009
Location: Dallas, Texas
Posts: 343
Post Options Post Options   Quote smi-mark Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
pjj326 View Drop Down
Newbie
Newbie
Avatar

Joined: 24-Apr-2008
Posts: 9
Post Options Post Options   Quote pjj326 Quote  Post ReplyReply Direct Link To This Post 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:
 
 
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.
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 13-Mar-2009 at 9:38am
Back to Top
pjj326 View Drop Down
Newbie
Newbie
Avatar

Joined: 24-Apr-2008
Posts: 9
Post Options Post Options   Quote pjj326 Quote  Post ReplyReply Direct Link To This Post 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.
 
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.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down