ArgumentOutOfRangeException when calling PrefetchPath.Add (self-service classes)

Posts   
 
    
alekat
User
Posts: 4
Joined: 22-Jun-2005
# Posted on: 22-Jun-2005 13:01:43   

Hi All

I'm trying to work through the LLBLGen pro documentation step by step and get

I get ArgumentOutOfRangeException when calling PrefetchPath.Add (using the self-service classes)

Using self service general scenario, vs.net 2003 + C# templates for SqlServer

I have the following two tables in my sql database:

BusinessGroup int, Id (PK) int, BusinessStreamId (fk) string, Name

BusinessStream int, Id (pk) string, Name

This is the code I'm using: copied from "Using the generated code -> SelfServicing -> Prefetch paths" in the LLBLGen pro documentation

            BusinessStreamDTO[] streamsDTO;
            BusinessStreamCollection streams = new BusinessStreamCollection();          
            IPrefetchPath prefetchPath = new PrefetchPath((int)EntityType.BusinessStreamEntity);
            prefetchPath.Add(BusinessStreamEntity.PrefetchPathBusinessGroup);
            streams.GetMulti(null,prefetchPath);
            streamsDTO = StreamsDTOFactory.CreateBusinessStreamDTOs(streams);
            return streamsDTO;

This is the error message I get:


System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: Index was out of range.  Must be non-negative and less than the size of the collection.
   at System.Collections.CollectionBase.System.Collections.IList.set_Item(Int32 index, Object value)
   at System.Collections.CollectionBase.System.Collections.IList.set_Item(Int32 index, Object value)
   at SD.LLBLGen.Pro.ORMSupportClasses.PrefetchPath.Add(IPrefetchPathElement elementToAdd, Int32 maxAmountOfItemsToReturn, IPredicateExpression additionalFilter, IRelationCollection additionalFilterRelations, ISortExpression additionalSorter)

I've tried variations of the code, and even tried adding in a sort object as well... I still get the same error.

Any advise/feedback ideas on why I am getting this error will be greatly appreciated.

regards

Alan

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 22-Jun-2005 17:56:22   

I can't reproduce it here. I'd like to ask you what the version is of LLBLGen Pro you're using. THe prefetch path you're using is very simple and should just result in a simple addition.

The error is particularly weird because it does just a List.Add(element), so why it crashes with an index problem there is beyond me, there is no index based setter called in that Add routine.

You can retrieve the build of the runtime libraries by rightclicking on the ORMSupportclasses.dll -> properties -> version tab. It should say something like 1.0.20042.04222005

Frans Bouma | Lead developer LLBLGen Pro
alekat
User
Posts: 4
Joined: 22-Jun-2005
# Posted on: 23-Jun-2005 11:52:39   

Build number is 1.0.20042.050605

alekat
User
Posts: 4
Joined: 22-Jun-2005
# Posted on: 23-Jun-2005 12:07:44   

Since this call is into a method on D.LLBLGen.Pro.ORMSupportClasses.IPrefetchPathElement there's nothing I can do to debug this.

Is the PDB file for D.LLBLGen.Pro.ORMSupportClasses.IPrefetchPathElement available, so that I can debug

I've tried removing all the keys on the database except for the PK's and the FK relationships on this table and regenerated the DAL and still get the same error.

I'm going to setup a blank project, and start froms scratch and then post the code for this spike here, so that anyone else can reproduce if they want.

I'll post the sql create script,a test data insert script, and a simple webmethod to retrieve all customers and orders, for the following:

customer (int id, string name) order (int orderID, string description, int customerID (fk) )

cheers

Al

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 23-Jun-2005 12:24:08   

I can mail you a debug build and .pdb file. I'll do that to the email address you supplied on the forum.

Your version is very recent so that can't be it, I use almost the same version to reproduce it. (that code hasn't been changed since then)

(edit) mailed.

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 23-Jun-2005 13:25:41   

Shot in the dark: do you by accident reference the .NET 1.0 versions of the ormsupportclasses? (please check the filename of the referenced assembly: the name should contain .NET11, not .NET10)

Frans Bouma | Lead developer LLBLGen Pro
alekat
User
Posts: 4
Joined: 22-Jun-2005
# Posted on: 23-Jun-2005 15:23:17   

oh er no, of course not. I definately have not done that.

And on a completely unrelated note, my project has suddenly started working!

<grin>

Thank you for the excellent support

best regards

Alan Hemmings

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 23-Jun-2005 15:57:19   

alekat wrote:

oh er no, of course not. I definately have not done that.

And on a completely unrelated note, my project has suddenly started working!

<grin>

Thank you for the excellent support

best regards

Alan Hemmings

smile

Frans Bouma | Lead developer LLBLGen Pro