3 Replies Latest reply on Sep 13, 2013 10:28 AM by tseiferth

    Searching for AF Attributes

    pcloes

      I am trying to search AF for attributes & am getting a TypeLoadException error... code:

       

      Dim alsSearchReturn As OSIsoft.AF.AFNamedCollectionList(Of OSIsoft.AF.Asset.AFAttribute)

       

              ' Search the all attributes

       

              strSearch = "Contents*"

       

              alsSearchReturn = OSIsoft.AF.Asset.AFAttribute.FindElementAttributes(DB, Nothing, "*", Nothing, Nothing, OSIsoft.AF.Asset.AFElementType.None, strSearch, Nothing, TypeCode.String, True, OSIsoft.AF.AFSortField.Name, OSIsoft.AF.AFSortOrder.Ascending, 1000)

       

      Any suggestions?

        • Re: Searching for AF Attributes
          tseiferth

          Possible issues:

           

             The assembly you reference is x64 only and your consumer is x86 or AnyCPU on a 32-Bit CLR

           

             Your consumer assembly was compiled against a different version of the referenced assembly

            • Re: Searching for AF Attributes
              pcloes

              would this not affect all AF SDK calls... ie: AFElement.FindElements?  as this one works... just the AFAttributeFindElementAttributes throws this error

                • Re: Searching for AF Attributes
                  tseiferth

                  Set a break point on the call and examine the InnerException on the thrown TypeLoadException. It might give you a more specific clue on what caused the exception.

                   

                  Another debugging step is to set the break point on the method and look at the versions of the loaded modules (menu Debug->Windows-->Modules). The modules window will show the version of each of the assemblies you have loaded.

                   

                  There's most likely a mismatch of the assembly you reference and the one that gets loaded. I'm not sure I understand how that could occur, but you might want to contact tech support. They might be able to examine your system for any inconsistencies.