Page 1 of 1

Error in Linq execution

Posted: Tue 15 Sep 2015 06:23
by dqrest
Hi!

I faced to some problems in Linq execution. I have Devart.Data.Linq 4.4.697.0 and Devart.Data.Oracle.Linq 4.4.697.0 and Devart.Data.Oracle. 8.4.359.0.

------------------------------------------------------------------------
Part A.
I represent the code which work right:

var dataC = from c in All.SysFilterCriterions
where c.FilterNo == filterNo
orderby c.OrderNo
select c;
var listC = dataC.ToList();
------------------------------------------------------------------------


------------------------------------------------------------------------
Part B.
But in the following code I have some errors:
var crits = (from c in All.SysFilterCriterions
where c.FilterNo == filterNo
orderby c.OrderNo
select
new MyCriterion()
{
No = c.No,
FieldNo = c.FieldNo,
Caption = c.Caption
});
var dataQ = crits.ToList();

private class MyCriterion
{
public long No { get; set;}
public long? FieldNo{ get; set;}
public string Caption{ get; set;}
}

I have the following error: "Object of type 'Devart.Data.Linq.Engine.ObjectReader`1[Core_Pages_FlatHandbookFilter+MyCriterion]' cannot be converted to type 'System.Collections.Generic.IEnumerator`1[Core_Pages_FlatHandbookFilter+MyCriterion]'."
------------------------------------------------------------------------

I have not see any difference between Part A and Part B.
What happends? Please, help me!

Re: Error in Linq execution

Posted: Tue 15 Sep 2015 10:18
by dqrest
Does anybody have any ideas?

Re: Error in Linq execution

Posted: Tue 15 Sep 2015 12:05
by MariiaI
We couldn't reproduced this issue in our environment.
Could you please create and send us a small test project, with which this issue is reproducible, so that we are able to investigate it more celarly. This will significantly speed up the process of determining the cause of the error and finding the solution for you.

Please also specify:
- the version and edition of Visual Studio;
- the version and edition of LINQ Insight you are working with;
- the full stack trace of the exception, etc.

Re: Error in Linq execution

Posted: Fri 18 Sep 2015 12:42
by dqrest
I use MS VS 2013 Ultimate.

This error happends in the following situation:

I launch WebSite by pushing button "Start Debugging" (Menu => Debug => Start Debugging).

The linq code is working right. But when I add some code in Debugging Mode of MS VS 2013, for example int k = 0;, and refresh the site in browser, I have the following error:

"Object of type 'Devart.Data.Linq.Engine.ObjectReader`1[Core_Pages_FlatHandbookFilter+MyCriterion]' cannot be converted to type 'System.Collections.Generic.IEnumerator`1[Core_Pages_FlatHandbookFilter+MyCriterion]'"

Re: Error in Linq execution

Posted: Mon 21 Sep 2015 10:07
by MariiaI
Thank you for the additional information. If we understood you correctly, you are facing problem with LinqConnect, not with LINQ Insight (this forum thread is related to LINQ Insight product).
Most likely, the issue is not related to LinqConnect, but related to the aspect of changing code in the debug mode. Please refer to: https://msdn.microsoft.com/en-us/librar ... s.80).aspx

If this information doesn't help, please send us a test project and describe the exact steps to reproduce the issue. This will significantly speed up the process of determining the cause of the error and finding the solution for it.

Looking forward to your reply.