lextudio/sharpsnmplib

System.ArgumentOutOfRangeException in SnmpMessageExtension.GetResponseAsync

RedwoodForest opened this issue · 1 comments

We just saw this ArgumentOutOfRangeException thrown from SharpSnmpLib in our app.

I don't have any information about the SNMP request/response that caused the exception.

System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.\r\nParameter name: index
   at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
   at System.Collections.Generic.List`1.get_Item(Int32 index)
   at Lextm.SharpSnmpLib.Messaging.SnmpMessageExtension.<GetResponseAsync>d_19.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
 at [...stack trace from our code...]

Looking briefly at the code it looks like the issue may be caused when ParseMessages returns an empty List here.

lextm commented

No plan to support non-compliant agents, as they require hacks that do not really contribute to any other users of this library.