Search All Forums
Dart Home | PowerSNMP for .NET | Custom Development Reply | PowerSNMP for .NET Topics | Forums   
AuthorForum: PowerSNMP for .NET
Topic: Trap1Message constructor causing overflow

From: Peterborough, United Kingdom
Posts: 1
Member Since: 07/25/19
posted July 25, 2019 11:07 AM

We are currently using version of the Dart.Snmp.dll and have come across an issue with a system that has been running for well over a year.
When we create traps we use the Trap1Message (or Trap2Message) constructor which passes the SysUpTime as one of its parameters. We rtrieve that value using SNMPAgent.SysUpTime. However we are getting an exception raised as described below:

"Description: The process was terminated due to an unhandled exception.
Exception Info: System.OverflowException
  at System.Convert.ToUInt32(Int64)
  at Dart.Snmp.SimpleType.UIntegerBase..ctor(Int64)
  at Dart.Snmp.Trap1Message..ctor(Int32, Int32, System.String, Int64)"

I was able to replicate it by restarting the system then setting the clock forward by 2 years and saw exactly the same error. It would appear that the Dart.Snmp.SimpleType.UIntegerBase constructor is trying to put an int64 into an int 32 - has this been fixed in a later version of the dll?
Nick B (Admin)

From: Utica, NY USA
Posts: 605
Member Since: 05/25/10

Extra Support Options
Custom Application Development

posted July 25, 2019 4:23 PM


Thank you for your report. Agent.SysUpTime should return a UInt32, and the Trap constructors should take a UInt32, as sysUpTime is TimeTicks, and TimeTicks is a UInt32:

I've entered this as TFS1082. For information or updates on its status, please contact jamie.powell@dart.com.

SysUpTime is defined as: "The time (in hundredths of a second) since the network management portion of the system was last re-initialized", so as a workaround, you could either re-initialize the network management portion of your system (or just fake it), or you could use the remainder operator with Agent.SysUpTime and UInt32.MaxValue-1 when passing that value into the trap constructor.

-Non-current subscribers must contact sales@dart.com to update subscription and receive continued support as needed.

Reply | PowerSNMP for .NET Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX