This project has moved and is read-only. For the latest updates, please go here.

ObjectStore order


I'm creating an snmp agent. When using the ObjectStore.GetNextObject method I don't always get the correct object. The only way to assure the correct object is returned is by adding them in order in the first place.
I noticed that the ObjectIdentifier implements the IComparable interface. Would it be a fix to change the implementation of GetNextObject to the following code?
(I'm using version 8.5)
    public sealed class ObjectStore
        public ScalarObject GetNextObject(ObjectIdentifier id)
            return _list.Select(o => o.MatchGetNext(id))
                .OrderBy(o => o.Variable.Id)
                .FirstOrDefault(result => result != null);


lextm wrote Jul 7, 2016 at 5:18 AM

Thanks for reporting it.

I intentionally designed it this way, so as to force the agent authors to put objects in a nice order. Such a patch can hide potential issues, so I will not consider accepting it.