One or more properties are not registered for this type

One or more properties are not registered for this type

Old forum URL: forums.lhotka.net/forums/t/11135.aspx


gbetz posted on Tuesday, February 07, 2012

Hi, this is my first time on this forum - i am using CSLA version 3.8.1.0.

Intermittently i am getting this error: 

System.InvalidOperationException: One or more properties are not registered for this type ---> System.IndexOutOfRangeException: Index was outside the bounds of the array.

   at Csla.Core.FieldManager.FieldDataManager.FieldExists(IPropertyInfo propertyInfo) 

I cant really reproduce it in real life over the debugger - it happens every so often and is driving me crazy - as I can tell from looking in the database that the data is present and pretty confident there are even no NULLs anywhere.  Anybody has any ideas on how to deal with this? Thanks a lot in advance.

Here is my property declaration:

 

        private static PropertyInfo<MyList> MyCollection = RegisterProperty< MyList >(p => p.SalesContacts);

here is where this error happens:
   public  MyList  SalesContacts
        {
            get
            {
                if (!(FieldManager.FieldExists( MyCollection ))) -- the error happens on this line 
                {
                    LoadProperty( MyCollection  ,  MyList .GetContactList(_id));
                }
                return GetProperty( MyCollection );
            }
        }

JonnyBee replied on Tuesday, February 07, 2012

Do you use remote dataportal?

You could try to add some extre debug info in your code, specifically:

FieldManager.GetRegisteredProperties()
- the number of properties in this list seems to be lower than the MyCollection.Index property - hence you get an IndexOutOfRangeException.

This may be cause by server code returning less fields than the client expects when using remote dataportal. (wrong version of DLL?)

 

 

gbetz replied on Wednesday, April 04, 2012

thank you for your answer, yes i did use remote data portal and the problem did turn out to be due to wrong dll version.

Copyright (c) Marimer LLC