This project has moved. For the latest updates, please go here.

There is a question about SharpSnmpLib Exception

Topics: bug report (break and fix), feature request (I want ...), usage (how to ...)
Oct 31, 2008 at 2:29 AM
List<Variable> lv2 = new List<Variable>();

Variable serverName = new Variable(new ObjectIdentifier(ObjectIdentifier.Convert("")));

Variable cpu = new Variable(new ObjectIdentifier(ObjectIdentifier.Convert("")));

lv2.add(serverName );

 IList<Variable> variable2 = Manager.Get(VersionCode.V2, new IPEndPoint(IPAddress.Parse(""), 161), new OctetString("public"), lv2, 5000);

   当lv2中的一个项出错,整个Manager.Get(),variable2 都退出了,抛出异常。

Oct 31, 2008 at 1:56 PM
For latest source code, you may open GetRequestMessage.cs and navigate to line 200,

            if (response.ErrorStatus != ErrorCode.NoError)
                throw SharpErrorException.Create(
                    "error in response",
                    response.Variables[response.ErrorIndex - 1].Id);

comment out these lines so no exception will be raised when error happens. I may provide a better solution in later releases but this is the only workaround right now.


Marked as answer by lextm on 10/6/2013 at 9:13 PM
Nov 3, 2008 at 3:47 AM
Edited Nov 3, 2008 at 4:17 AM
Thank you very much !