Error with multiple LoadWith

Discussion of open issues, suggestions and bugs regarding LinqConnect – Devart's LINQ to SQL compatible ORM
Post Reply
[email protected]
Posts: 43
Joined: Wed 17 Sep 2008 11:31

Error with multiple LoadWith

Post by [email protected] » Tue 23 Feb 2010 08:41

Hello

I just installed the new beta version (5.70.97) to test the "Cannot access a disposed object" fix.

Now i get another error with LINQ statements having more than one LoadWith() defined. This worked before with 5.40.44.

Example:
var versionTypes = from vt in PPCustomer.VersionTypes.LoadWith(i => i.VersionTypeTranslations).LoadWith(i => i.VersionOptions.LoadWith(j => j.VersionOptionTranslations))
where vt.Enabled == true
orderby vt.SortOrder
select vt;

The error:
Object reference not set to an instance of an object.

Stack:
at Devart.Data.Linq.Provider.ObjectReader`1.c()
at Devart.Data.Linq.Provider.ObjectReader`1.k()
at Devart.Data.Linq.Provider.ConnectionManager.a(IDbConnection A_0)
at Devart.Data.Linq.Provider.ConnectionManager.GetOpenConnection()
at Devart.Data.Linq.Provider.ConnectionManager.b(IConnectionUser A_0)
at Devart.Data.Linq.Provider.DataProvider.a(b A_0, Object[] A_1, Object[] A_2, Object A_3)
at Devart.Data.Linq.Provider.DataProvider.a(b A_0, Object[] A_1)
at Devart.Data.Linq.Provider.DataProvider.b.a(b A_0, Object[] A_1)
at Devart.Data.Linq.Provider.DeferredQuery`3.a(TKeyQuery A_0)
at Devart.Data.Linq.Provider.DeferredSource`2.b()
at Devart.Data.Linq.Provider.DeferredSource`2.a()
at Devart.Data.Linq.ListEnumerable`1.b()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at System.Data.Linq.EntitySet`1.AddRange(IEnumerable`1 collection)
at Devart.Data.Linq.Mapping.EntitySetValueAccessor`2.a(Object& A_0, Object A_1)
at Devart.Data.Linq.Provider.h.SetLinks[TEntity,TCacheEntity,TKey](TEntity obj, MetaType objMetaType, Object keySource, IList`1 linkMembers, q services, IList`1 queryLoadWith, Dictionary`2 nextLoadWiths, Boolean deferredLoadingEnabled)
at lambda_method(ExecutionScope , f )
at Devart.Data.Linq.Provider.JoinedEntityReader`6.c()
at Devart.Data.Linq.Provider.JoinedEntityReader`6.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)


Thanks for your help
________
Goddess Worship Dicussion
Last edited by [email protected] on Thu 17 Feb 2011 05:24, edited 1 time in total.

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Tue 23 Feb 2010 16:08

Thank you for the report, the error is already fixed.
Look forward for the upcoming build.

[email protected]
Posts: 43
Joined: Wed 17 Sep 2008 11:31

Post by [email protected] » Thu 04 Mar 2010 12:46

Hello

I just updated to the new 5.70.102 Beta.
Now I get another error when loading Data with multiple LoadWith() statements defined.

DataTableReader is invalid for current DataTable ''.

at System.Data.DataTableReader.ValidateState(String caller)
at System.Data.DataTableReader.IsDBNull(Int32 ordinal)
at Devart.Data.Linq.Provider.ObjectReader`1.CaheReader.IsDBNull(Int32 i)
at lambda_method(ExecutionScope , f )
at Devart.Data.Linq.Mapping.l.Accessor`2.a(T A_0)
at System.Data.Linq.Mapping.MetaAccessor`2.GetBoxedValue(Object instance)
at Devart.Data.Linq.Provider.JoinedEntityReader`6.a(f A_0)
at Devart.Data.Linq.Provider.JoinedEntityReader`6.c()
at Devart.Data.Linq.Provider.JoinedEntityReader`6.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
________
MOTORCYCLE TIRES
Last edited by [email protected] on Thu 17 Feb 2011 05:24, edited 1 time in total.

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Tue 09 Mar 2010 10:57

Could you please send me the DDL script of the DB objects causing the problem?
I have just tried to reproduce the error using simple test tables and multiple LoadWith succeeded

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Tue 09 Mar 2010 11:48

We have found the problem. I will let you know as soon as it is fixed.

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Fri 12 Mar 2010 17:36

We have fixed the problem. Look forward to the next build.

[email protected]
Posts: 43
Joined: Wed 17 Sep 2008 11:31

Post by [email protected] » Mon 15 Mar 2010 16:21

Hello

Is it possible to deliver us an immediate build with this fix? This is a very urgent problem for us. There was already another LINQ2SQL issue which caused a delay on our side. Therefore we'd be very happy to get the new fix as fast as possible. Thank you very much.

Kind regards
________
Angelina jolie pictures
Last edited by [email protected] on Thu 17 Feb 2011 05:24, edited 1 time in total.

[email protected]
Posts: 43
Joined: Wed 17 Sep 2008 11:31

Post by [email protected] » Wed 17 Mar 2010 07:03

Hi

When do you plan to release your current build? We need it as soon as possible.

Thank you very much and best regards
________
G Engine
Last edited by [email protected] on Thu 17 Feb 2011 05:24, edited 1 time in total.

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Wed 17 Mar 2010 11:50

We plan to release the new build in several days.

[email protected]
Posts: 43
Joined: Wed 17 Sep 2008 11:31

Post by [email protected] » Thu 18 Mar 2010 14:50

Hi. Could you send me a pre-release of your build in order to be able to test the fixed feature? In case we detect other issues we could quickly report you other problems before you release this build. This will save some time.

Thank you and best regards
________
Motorcycle tires
Last edited by [email protected] on Thu 17 Feb 2011 05:24, edited 1 time in total.

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

Post by Shalex » Mon 22 Mar 2010 13:15

Please contact us via our contact form, tell us your license number (or e-mail you used for registration). We will send our internal build to this e-mail. Also make sure that your e-mail box can receive attachments up to 10 Mb.

[email protected]
Posts: 43
Joined: Wed 17 Sep 2008 11:31

Post by [email protected] » Thu 25 Mar 2010 16:36

Hello

Thank you for the pre-release build. The problem with multiple LoadWith() is now fixed.
But I have now two other problems.

The following statement gives an error:

Code: Select all

var recordSet = from m in PPCustomer.Movies
							where m.AssetId == AssetId
							orderby m.MovieId
							select m;

			foreach (var movie in recordSet)
			{
			...
			}
With local VS debugging session:

Object reference not set to an instance of an object.

at Devart.Data.Linq.Provider.ObjectReader`1.e()
at Devart.Data.Linq.Provider.ObjectReader`1.MoveNext()

Deployed on Server:

Object reference not set to an instance of an object.

at Devart.Data.Linq.Provider.ObjectReader`1.e()
at Devart.Data.Linq.Provider.ObjectReader`1.Dispose()


If I change the statement and call ToList() it is working.

Code: Select all

var recordSet = (from m in PPCustomer.Movies
							where m.AssetId == AssetId
							orderby m.MovieId
							select m).ToList();


The other problem seems to be a multi-threading issue:

Cannot access a disposed object. Object name: 'DataContext accessed after Dispose.'.

at Devart.Data.Linq.DataContext.b()
at Devart.Data.Linq.DataContext.e()
at Devart.Data.Linq.Provider.DeferredQuery`3.a(TKeyQuery A_0)
at Devart.Data.Linq.Provider.DeferredSource`2.b()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at lambda_method(ExecutionScope , f )
at Devart.Data.Linq.Provider.ObjectReader`1.g()
at Devart.Data.Linq.Provider.ObjectReader`1.b()
at Devart.Data.Linq.Provider.ObjectReader`1.MoveNext()

Here is the example code. This exception happens only a few times.

Code: Select all

var recordSet = (from m in PPCustomer.Mailings.LoadWith(m => m.User).LoadWith(u => u.MailingRecipients)
				 join u in PPCustomer.Users on m.CreatedByUserId equals u.UserId
				 join mr in PPCustomer.MailingRecipients on m.MailingId equals mr.MailingId
				 join sq in PPCustomer.Users on mr.UserId equals sq.UserId into lj
				 from u2 in lj.DefaultIfEmpty()
				 select new
				 {
					 MailingId = m.MailingId,
					 CreationDate = m.CreationDate,
					 EmailAddress = u.EmailAddress,
					 RecipientEmailAddresses = m.MailingRecipients.Where(mrts => mrts.MailingId == m.MailingId),
					 Subject = m.Subject,
					 State = m.Deleted ? (int)MailingState.Deleted : (m.ExpirationDate  mailingListItem = new List();
foreach (var record in recordSet)
{
...
}
Thanks for your help
________
Bond Insurance Dicussion
Last edited by [email protected] on Thu 17 Feb 2011 05:24, edited 1 time in total.

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Fri 26 Mar 2010 13:18

I'm unable to reproduce the first problem, although I have the same build that was sent to you.
Could you please send me (supprt * devart * com, subject "LINQ foreach")
a small test project illustrating the problems?
Please attach the DDL script of the objects you are using.
As for the multithreading issue, the Devart.Data.DataContext class isn't thread safe, like the Microsoft System.Data.DataContext one.

Post Reply