InvalidCastException in latest Beta version

InvalidCastException in latest Beta version

Postby crazypit » Mon 15 Nov 2010 14:57

Hello,

I tried the latest 6.0.46 beta version and when my code tries to evaluate a compiled query i get an InvalidCastException with the following info:

Unable to cast object of type 'Devart.Data.Linq.Mapping.ar' to type 'Devart.Data.Linq.Mapping.MetaTypeBase'.

at Devart.Data.Linq.Provider.Query.ag.b(SqlExpression A_0, MetaType A_1, List`1& A_2, List`1& A_3, SqlExpression& A_4, IList`1 A_5)
at Devart.Data.Linq.Provider.Query.ag.a(x A_0, String A_1, IEnumerable`1 A_2)
at Devart.Data.Linq.Provider.Query.w.b(MethodCallExpression A_0)
at Devart.Data.Linq.Provider.Query.w.j(Expression A_0)
at Devart.Data.Linq.Provider.Query.w.b(LambdaExpression A_0)
at Devart.Data.Linq.Provider.Query.w.j(Expression A_0)
at Devart.Data.Linq.Provider.Query.w.i(Expression A_0)
at Devart.Data.Linq.Provider.DataProvider.BuildQuery(Expression query)
at Devart.Data.Linq.Provider.DataProvider.Devart.Data.Linq.Provider.IProvider.Compile(Expression query)
at Devart.Data.Linq.CompiledQuery.a(IProvider A_0)
at Devart.Data.Linq.CompiledQuery.a(DataContext A_0, Object[] A_1)
at Devart.Data.Linq.CompiledQuery.Invoke[a,b,c](a A_0, b A_1)
................
crazypit
 
Posts: 163
Joined: Wed 15 Apr 2009 08:43

Postby StanislavK » Tue 16 Nov 2010 15:36

Could you please describe the compiled query you are using? We couldn't reproduce the problem with simple queries.

I will send you a sample in a letter, please check that it was not blocked by your mail filter. Please specify what should be changed in the sample to reproduce the problem, or, if possible, send us a complete test project.
StanislavK
Devart Team
 
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Postby crazypit » Thu 18 Nov 2010 08:00

I tried the latest beta version in order to solve an other problem described by me at : http://www.devart.com/forums/viewtopic.php?p=63278. It seems that i cannot put the beta version in production environment if it has backward compatibility or breaking changes issues. I will wait for a more stable release and at that time, if the problem with the invalid cast still persists, i will let you know. For now, i don't have the resources to create a proper test project that replicates the problem. I thought that the solution would be rather obvious because i get the exception on a large number of compiled queries of my system and not only one.
crazypit
 
Posts: 163
Joined: Wed 15 Apr 2009 08:43

Postby StanislavK » Tue 23 Nov 2010 14:44

We couldn't reproduce this issue. Most probably, the problem is that by some reason an assembly of an older version persisted in the GAC or Bin folder of your application. You can check this in the following way:
- when this exception is thrown, copy the exception details to clipboard to check the assembly where the error occurred;
- in the Debug -> Windows -> Modules window check the version number of this assembly.
E.g., for Devart.Data.Linq and Devart.Data.Linq.Oracle the version number should be 2.0.7.

Otherwise, you can perform the following to ensure that all old assemblies were replaced by the newer versions:
- uninstall dotConnect for Oracle;
- remove all Devart.* and policy.*.Devart.* files from the GAC;
- clear the Program Files\Devart\dotConnect and Program Files\Common Files\Devart\dotConnect folders;
- delete Devart assemblies from the Bin folder of your application;
- re-install dotConnect for Oracle Beta 6.0.46.

Please tell us if this helps.
StanislavK
Devart Team
 
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Postby crazypit » Wed 24 Nov 2010 09:15

It seems that the problem has to do with the compiled queries where the Query method is used. e.g

public static Func> ClientsService_GetCustomerHierarchy
=
CompiledQuery.Compile(
(ExrayDataContext dataContext, string CustomerInfoId) =>
dataContext.Query(
"select b.CI_PAR_ID PARENT_CUST_ID, b.CU_ID || '^' || a.CU_CODE || ' - ' || b.CI_ACC_NAME STRING " +
"from customers a, CUSTOMER_INFO b " +
"where a.CU_ID = b.CU_ID and b.CI_DATT is null " +
"connect by prior b.CU_ID = b.CI_PAR_ID and b.CI_DATT is null start with b.CI_ID = {0}" +
" and b.CI_DATT is null order by level, b.CI_ACC_NAME", CustomerInfoId)
);


public static Func>
ClientsService_GetAddCustomerInfo =
CompiledQuery.Compile(
(ExrayDataContext dataContext) =>
dataContext.Query(
@"select v.id validationRuleId, v.Notes notes ,v.severity validationRuleSeverity, v.if_cnd_id ifConditionId, v.then_cnd_id thenConditionId, e.value exprValue, null ifCondition, null thenCondition from validation_rules v, (select connect_by_root c.id RootId, c.id ParentId, level Hierarchy_Level " +
"from conditions c " +
"start with c.expr_id in (select a.id " +
"from expressions a " +
"where a.type = 1) " +
"connect by prior c.id = c.left_cnd_id " +
"or prior c.id = c.right_cnd_id) L ," +
"expressions e, " +
"conditions c " +
"where v.then_cnd_id = L.ParentId and v.status = 1 and v.ref_type = 1 " +
"and e.id = c.expr_id and c.id = L.RootId"));

Is this more helpful? Please, i'm in a hurry...
crazypit
 
Posts: 163
Joined: Wed 15 Apr 2009 08:43

Postby StanislavK » Wed 24 Nov 2010 14:36

We will prepare for you a build based on the 5.70.190 version with the fix for the exception in GCHandle.get_Target(). Please send us a letter with your license number specified so that we can check your subscription status.

As for the problem with compiled queries, we couldn't reproduce it. If possible, please specify the definitions of the database objects used in the queries you've listed above. Also, I will send you another test project where simple compiled queries with dataContext.Query are executed.
StanislavK
Devart Team
 
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Postby crazypit » Thu 25 Nov 2010 10:10

License information sent yesterday.
crazypit
 
Posts: 163
Joined: Wed 15 Apr 2009 08:43

Postby bmarotta » Fri 26 Nov 2010 11:28

I want this build too. I don't want to migrate now and discover thousands of new bugs in thousand different points in the code.
bmarotta
 
Posts: 34
Joined: Wed 29 Sep 2010 11:27

Postby crazypit » Fri 26 Nov 2010 11:34

I sent you a test project that replicates the problem along with the SQL DDL statement that create the 3 Tables for the relevant compiled query. Nevetheless, i'm still eager to get the customized 5.70.190 build.
crazypit
 
Posts: 163
Joined: Wed 15 Apr 2009 08:43

Postby StanislavK » Fri 26 Nov 2010 13:55

We have answered you by mail concerning the build with the fix.

As for the problem with compiled queries, we've reproduced it in the case when TResult type of DataContext.Query is a custom class (not an entity type defined in the data context). We will investigate it and inform you about the results as soon as possible.
StanislavK
Devart Team
 
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Postby crazypit » Tue 30 Nov 2010 09:57

Does the latest 6.00.58 version, fix the issue?
crazypit
 
Posts: 163
Joined: Wed 15 Apr 2009 08:43

Postby StanislavK » Tue 30 Nov 2010 14:41

Both fixes (for this problem with compiled queries and for the issue with the GCHandle.get_Target() method) are included into the 6.0.58 version. Please try the latest version and specify if you still need the build based on the 5.70.190 version.

The 6.0.58 version can be downloaded from Registered Users' Area
http://secure.devart.com/
The trial is available at
http://www.devart.com/dotconnect/oracle/download.html
The trial period is renewed, meaning that users with expired trial for previous versions can now evaluate dotConnect for Oracle 6.0.58.
StanislavK
Devart Team
 
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Postby crazypit » Thu 09 Dec 2010 13:42

It seems to work ok now. Thanks.
crazypit
 
Posts: 163
Joined: Wed 15 Apr 2009 08:43


Return to dotConnect for Oracle