Unable to cast object of type 'Devart.Data.Linq.Engine.DeferredEnumerable

Discussion of open issues, suggestions and bugs regarding LinqConnect – Devart's LINQ to SQL compatible ORM
Post Reply
rmalcomber
Posts: 3
Joined: Thu 05 May 2016 12:36

Unable to cast object of type 'Devart.Data.Linq.Engine.DeferredEnumerable

Post by rmalcomber » Thu 05 May 2016 12:40

Hello,

I'm calling a record from my MySQL database,

Code: Select all

Dim uploadedFile As db.UploadedContent = dc.UploadedContents.FirstOrDefault(Function(a) a.Id = uploadedFileID)
but I keep getting
Unable to cast object of type 'Devart.Data.Linq.Engine.DeferredEnumerable`1[Manager.db.UploadedContent]' to type 'System.Collections.Generic.IEnumerable`1[Devart.Data.Linq.Binary]'.
Sorry I'm not sure what other information to put,

many thanks.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Unable to cast object of type 'Devart.Data.Linq.Engine.DeferredEnumerable

Post by Shalex » Thu 05 May 2016 13:56

1. Is this a compilation or runtime error?
2. Send us a small test project for reproducing the issue in our environment.

rmalcomber
Posts: 3
Joined: Thu 05 May 2016 12:36

Re: Unable to cast object of type 'Devart.Data.Linq.Engine.DeferredEnumerable

Post by rmalcomber » Thu 05 May 2016 14:04

It's a runtime error.

I'll get a test example written up now.

I have managed to track it down to one of the BLOB fields which is not null is set to Delay Loading. If I turn delay loading off, the command works fine.

rmalcomber
Posts: 3
Joined: Thu 05 May 2016 12:36

Re: Unable to cast object of type 'Devart.Data.Linq.Engine.DeferredEnumerable

Post by rmalcomber » Thu 05 May 2016 14:25

I found the problem, one of the fields was set to Binary instead of System.Byte[]. I do not know why.

Sorry for wasting any time.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Unable to cast object of type 'Devart.Data.Linq.Engine.DeferredEnumerable

Post by Shalex » Thu 05 May 2016 15:22

Thank you for letting us know.

Post Reply