.NET H5G::iterate exception

I have some code that converts an hdf5 file (or folder of hdf5 files) of hdf files into CSVs. When I run it on a folder of hdf5 files, the code randomly throws exceptions part way through a folder conversion. The exceptions are H5GgetObjectNameByIndexException while doing a H5G::iterate to generate a list of dataset names. When the exception occurs, all files thereafter have the same problem. And the file that triggers it is never consistent. The folder that I'm testing on contains 47 hdf files, most are in the 100-2000K range, though two are 125G and 15G. The big ones don't seem to be the trigger.

Each file is handed independently & serially, so there should be no interaction between them. And I've verified that all hdf objects are closed.

The BuildDatasetList and DatasetIterator code are below.

Given the opaque nature of the HDF5DotNet exceptions, I'm not sure where to turn now.

Scott

···

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

        /// <summary>
        /// Build the internal list of datasets. Ignores Dimension Scales ("_Time")
        /// </summary>
        /// <param name="source">source file</param>
        /// <param name="reason">failure reason</param>
        /// <returns>count of datasets found, negative failure</returns>
        public int BuildDatasetList(H5FileId source, out string reason)
        {
            object something = new object();
            int startIndex = 0;
            string group = "/";
            reason = "";

            // Iterate the list of groups to build mDatasets
            lock (sLocker)
            {
                try
                {
                    int result = H5G.iterate(source, group, DatasetIterator, something, ref startIndex);
                }
                catch (Exception ex)
                {
                    reason = "BuildDatasetList " + ex.GetType().ToString() + ": " + ex.Message;
                    System.Diagnostics.Debug.WriteLine(reason);
                    return -1;
                }
            }

            // Return
            if (mDatasets == null)
                System.Diagnostics.Debug.WriteLine("~~~~~~~~~~~~~~~~~ No Datasets found? ~~~~~~~~~~~~~~~~~");
            return this.mDatasets == null ? 0 : this.mDatasets.Count;
        }

        /// <summary>
        /// Callback for the H5G.iterate(). Opens Datasets (ignoring "_Time" data scales) and stores them for use.
        /// </summary>
        /// <param name="group">container group/file</param>
        /// <param name="name">object name</param>
        /// <param name="parameter">unused</param>
        /// <returns>0 to keep looping</returns>
        protected int DatasetIterator(H5GroupId group, string name, object parameter)
        {
            H5ObjectInfo objInfo;
            try
            {
                objInfo = H5O.getInfoByName(group, name);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("DatasetIterator (" + name + ") " + ex.GetType().ToString() + ": " + ex.Message);
                return 0;
            }

            if (objInfo.objectType != H5ObjectType.DATASET)
            {
                return 0;
            }

            // Filter out "_Time" datasets (time axes)
            if (name.EndsWith("_Time"))
                return 0;

            // Fill in the Dataset name.
            if (mDatasets == null)
                mDatasets = new List<string>();
            lock (mDatasets)
            {
                mDatasets.Add(name);
            }

            // return
            return 0;
        }

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

________________________________

This e-mail and any files transmitted with it may be proprietary and are intended solely for the use of the individual or entity to whom they are addressed. If you have received this e-mail in error please notify the sender. Please note that any views or opinions presented in this e-mail are solely those of the author and do not necessarily represent those of Exelis Inc. The recipient should check this e-mail and any attachments for the presence of viruses. Exelis Inc. accepts no liability for any damage caused by any virus transmitted by this e-mail.