Error in Linq execution

Discussion of issues, suggestions and bugs of LINQ Insight, Visual Studio add-in for design-time executing LINQ statements, that simplifies debugging LINQ
Post Reply
dqrest
Posts: 32
Joined: Tue 15 Sep 2015 06:01

Error in Linq execution

Post by dqrest » Tue 15 Sep 2015 06:23

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!

dqrest
Posts: 32
Joined: Tue 15 Sep 2015 06:01

Re: Error in Linq execution

Post by dqrest » Tue 15 Sep 2015 10:18

Does anybody have any ideas?

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: Error in Linq execution

Post by MariiaI » Tue 15 Sep 2015 12:05

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.

dqrest
Posts: 32
Joined: Tue 15 Sep 2015 06:01

Re: Error in Linq execution

Post by dqrest » Fri 18 Sep 2015 12:42

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]'"

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: Error in Linq execution

Post by MariiaI » Mon 21 Sep 2015 10:07

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.

Post Reply