nagendra.saragadam

PI AF Peculiar Error everyday between 12 PM to 3.30 PM (GMT+4)

Discussion created by nagendra.saragadam on May 12, 2012
Latest reply on May 15, 2012 by David Hearn

Hi,

 

I am getting below error when i am trying to get an AFObject using AFObject.FindObject method in AFSDK. I have debugged and found that the path what i am sending is correct. And this error is coming mostly in the afternoon from 12 to 3.30 PM (GMT +4 time zone). Can any one please help me with this.

 

System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at OSIsoft.AF.AFCollection`1.AddKey(Guid id, T item, Boolean inLoad) in c:\Builds\AF\AF 2.4\Sources\SDK\AFCollection.cs:line 3088
   at OSIsoft.AF.AFCollection`1.AddKey(T item, Boolean inLoad) in c:\Builds\AF\AF 2.4\Sources\SDK\AFCollection.cs:line 3245
   at OSIsoft.AF.AFNamedCollection`1.AddKey(T item, Boolean inLoad) in c:\Builds\AF\AF 2.4\Sources\SDK\AFCollection.cs:line 4135
   at OSIsoft.AF.AFCollection`1.InsertItem(List`1 list, Int32 index, T item, Int32 mode) in c:\Builds\AF\AF 2.4\Sources\SDK\AFCollection.cs:line 3439
   at OSIsoft.AF.Asset.AFElements.InsertItem(List`1 list, Int32 index, AFElement item, Int32 mode) in c:\Builds\AF\AF 2.4\Sources\SDK\Asset\AFElements.cs:line 1307
   at OSIsoft.AF.AFCollection`1.Load(Int32 page, Int32 numberToSkip, Boolean fullReload, Boolean fullUpdate, IdcObjectHeader[] headers) in c:\Builds\AF\AF 2.4\Sources\SDK\AFCollection.cs:line 2099
   at OSIsoft.AF.Asset.AFElements.LoadPage(String name, List`1& listPage) in c:\Builds\AF\AF 2.4\Sources\SDK\Asset\AFElements.cs:line 1017
   at OSIsoft.AF.AFNamedCollection`1.GetItemTyped(String name, Boolean returnDeletedItems, Boolean handlePathInName, Boolean inLoad) in c:\Builds\AF\AF 2.4\Sources\SDK\AFCollection.cs:line 4079
   at OSIsoft.AF.Asset.AFElements.GetItemTyped(String name, Boolean returnDeletedItems, Boolean handlePathInName, Boolean inLoad) in c:\Builds\AF\AF 2.4\Sources\SDK\Asset\AFElements.cs:line 1201
   at OSIsoft.AF.AFNamedCollection`1.GetItem(String name, Boolean returnDeletedItems, Boolean handlePathInName, Boolean inLoad) in c:\Builds\AF\AF 2.4\Sources\SDK\AFCollection.cs:line 4029
   at OSIsoft.AF.AFCollection`1.FindItemInCollection(AFCollection`1 items, AFParsedPathPart pathPart, AFObject relativeFrom, Boolean handlePathInName) in c:\Builds\AF\AF 2.4\Sources\SDK\AFCollection.cs:line 3880
   at OSIsoft.AF.Asset.AFElements.FindItemInCollection(AFParsedPathPart pathPart, AFObject relativeFrom, Boolean handlePathInName) in c:\Builds\AF\AF 2.4\Sources\SDK\Asset\AFElements.cs:line 1565
   at OSIsoft.AF.AFObject.FindChildObject(AFParsedPathPart pathPart, Boolean handlePathInName) in c:\Builds\AF\AF 2.4\Sources\SDK\AFObject.cs:line 3250
   at OSIsoft.AF.Support.AFParsedPath.ResolveSubObjectPath(AFParsedPath parsedPath, AFObject relativeFrom) in c:\Builds\AF\AF 2.4\Sources\SDK\Support\AFParsedPath.cs:line 1010
   at OSIsoft.AF.Support.AFParsedPath.ResolveSubObjectPath(AFParsedPath parsedPath, AFObject relativeFrom) in c:\Builds\AF\AF 2.4\Sources\SDK\Support\AFParsedPath.cs:line 1025
   at OSIsoft.AF.Support.AFParsedPath.ResolveObjectPath(AFParsedPath parsedPath, Boolean enableBulkLoad, String& parentPath, Int32& parentPathDepth) in c:\Builds\AF\AF 2.4\Sources\SDK\Support\AFParsedPath.cs:line 869
   at OSIsoft.AF.AFObject.FindObject(String path, AFObject relativeFrom, Nullable`1 queryDate) in c:\Builds\AF\AF 2.4\Sources\SDK\AFObject.cs:line 1144
   at OSIsoft.AF.AFObject.FindObject(String path) in c:\Builds\AF\AF 2.4\Sources\SDK\AFObject.cs:line 1110

 

My Code is given below.

 
myPISystems = new PISystems();
                myPISystem = myPISystems[ConfigurationSettings.AppSettings["PISystem"].ToString()];
                myDB = myPISystem.Databases[ConfigurationSettings.AppSettings["PIDatabase"].ToString()];
                objectAF = AFObject.FindObject(@sElementPath);
                // Null condition Added as there can be chance some Elements do not exist for certain well
                if (objectAF != null)
                {

                    oElement = (AFElement)objectAF;
                    if (oElement != null)
                    {
                        oAFAttrib = oElement.Attributes;

 

 

Appreciate your help.

 

Regarding,

 

Nagendra.

Outcomes